2 # Copyright (C) 2012-2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
10 PKG_SOURCE_VERSION:=23d6a843f9960c4777ad42909611bec526513d61
11 PKG_VERSION:=2015-07-02-$(PKG_SOURCE_VERSION)
15 PKG_SOURCE_URL:=https://github.com/sbyx/hnetd.git
16 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
19 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
20 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
22 include $(INCLUDE_DIR)/package.mk
23 include $(INCLUDE_DIR)/cmake.mk
25 # Spammy debug builds for now
26 CMAKE_OPTIONS += -DL_LEVEL=7
29 CMAKE_OPTIONS += -DBACKEND=openwrt
31 ifeq ($(BUILD_VARIANT),openssl)
32 CMAKE_OPTIONS += -DDTLS_OPENSSL=1
35 define Package/hnetd/Default
38 TITLE:=HNCP Homenet daemon - $(2)
39 URL:=https://github.com/sbyx/hnetd
40 DEPENDS:=+odhcpd +odhcp6c +netifd +ip $(3)
45 Package/hnetd-nossl=$(call Package/hnetd/Default,nossl,no authentication)
46 Package/hnetd-openssl=$(call Package/hnetd/Default,openssl,authentication via OpenSSL,+libopenssl)
48 define Package/hnet-full
51 TITLE:=HNCP Homenet metapackage
52 URL:=https://github.com/sbyx/hnetd
53 DEPENDS:=+hnetd-nossl +luci-app-hnet
57 DEPENDS+=+ohybridproxy
58 # Distributed PCP support
59 DEPENDS+=+miniupnpd +minimalist-pcproxy
62 define Package/hnet-full-secure
65 TITLE:=HNCP Homenet metapackage
66 URL:=https://github.com/sbyx/hnetd
67 DEPENDS:=+hnetd-openssl +luci-app-hnet
71 DEPENDS+=+ohybridproxy
72 # Distributed PCP support
73 DEPENDS+=+miniupnpd +minimalist-pcproxy
76 define Package/luci-app-hnet
79 SUBMENU:=3. Applications
80 TITLE:=HNCP Homenet configuration and visualization
82 # TBD - how to express dependency on 'some' hnetd?
85 define Package/hnetd-$(BUILD_VARIANT)/description
86 This package provides a daemon which implementats distributed prefix assignment
87 and service discovery for a home network consisting of multiple routers
88 connected to multiple service providers. It provides a netifd protocol "hnet"
89 for use in /etc/config/network.
92 define Package/hnetd-$(BUILD_VARIANT)/install
93 $(INSTALL_DIR) $(1)/usr/sbin/
94 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hnetd $(1)/usr/sbin/
95 $(INSTALL_DIR) $(1)/lib/netifd/proto
96 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/hnet.sh $(1)/lib/netifd/proto
97 ln -s hnetd $(1)/usr/sbin/hnet-ifresolve
98 ln -s hnetd $(1)/usr/sbin/hnet-trust
99 ln -s hnetd $(1)/usr/sbin/hnet-dump
100 $(INSTALL_DIR) $(1)/etc/init.d
101 $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
102 $(INSTALL_DIR) $(1)/etc/config
103 $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
104 $(INSTALL_BIN) ./files/ohp-script $(1)/usr/sbin/hnetd-ohp-script
105 $(INSTALL_BIN) ./files/pcp-script $(1)/usr/sbin/hnetd-pcp-script
106 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
107 $(INSTALL_DIR) $(1)/etc/uci-defaults
108 $(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
111 define Package/hnet-full/install
115 define Package/hnet-full-secure/install
119 define Package/luci-app-hnet/install
120 $(INSTALL_DIR) $(1)/usr/lib/lua/luci
121 $(INSTALL_DIR) $(1)/www
122 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/
123 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/htdocs/* $(1)/www/
126 define Package/hnetd-$(BUILD_VARIANT)/postinst
128 [ -n "$${IPKG_INSTROOT}" ] || {
129 (. /etc/uci-defaults/x-hnetd.defaults) && rm -f /etc/uci-defaults/x-hnetd.defaults
130 [ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart
131 /etc/init.d/hnetd enable
132 /etc/init.d/hnetd start
136 $(eval $(call BuildPackage,hnetd-nossl))
137 $(eval $(call BuildPackage,hnetd-openssl))
138 $(eval $(call BuildPackage,hnet-full))
139 $(eval $(call BuildPackage,hnet-full-secure))
140 $(eval $(call BuildPackage,luci-app-hnet))