57d13a428fe5a1849c21d1b1915ec0ca2efa282e
[feed/routing.git] / hnetd / Makefile
1 #
2 # Copyright (C) 2012-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME:=hnetd
10 PKG_SOURCE_VERSION:=606d7e904603ad8792ac1a7ba825618df97b5a4e
11 PKG_VERSION:=2016-06-28-$(PKG_SOURCE_VERSION)
12 PKG_RELEASE:=2
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=https://github.com/sbyx/hnetd.git
16 PKG_MIRROR_HASH:=5f06f72d5620de25e29b3e34a6524aebd8e7b5c8160cfd29135a6ec0f12ffa3e
17 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
18 PKG_LICENSE:=GPL-2.0
19
20 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
21 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24 include $(INCLUDE_DIR)/cmake.mk
25
26 # Spammy debug builds for now
27 CMAKE_OPTIONS += -DL_LEVEL=7
28
29 # OpenWRT target
30 CMAKE_OPTIONS += -DBACKEND=openwrt
31
32 ifeq ($(BUILD_VARIANT),openssl)
33 CMAKE_OPTIONS += -DDTLS_OPENSSL=1
34 endif
35
36 define Package/hnetd/Default
37 SECTION:=net
38 CATEGORY:=Network
39 TITLE:=HNCP Homenet daemon - $(2)
40 URL:=https://github.com/sbyx/hnetd
41 DEPENDS:=+odhcpd +odhcp6c +netifd $(3)
42 DEPENDS+=@IPV6
43 VARIANT:=$1
44 endef
45
46 Package/hnetd-nossl=$(call Package/hnetd/Default,nossl,no authentication)
47 Package/hnetd-openssl=$(call Package/hnetd/Default,openssl,authentication via OpenSSL,+libopenssl)
48
49 define Package/hnet-full
50 SECTION:=net
51 CATEGORY:=Network
52 TITLE:=HNCP Homenet metapackage
53 URL:=https://github.com/sbyx/hnetd
54 DEPENDS:=+hnetd-nossl +luci-app-hnet +ip
55 # Routing
56 DEPENDS+=+babeld
57 # Service discovery
58 DEPENDS+=+ohybridproxy +zonestitcher
59 # Distributed PCP support
60 DEPENDS+=+miniupnpd +minimalist-pcproxy
61 endef
62
63 define Package/hnet-full-secure
64 SECTION:=net
65 CATEGORY:=Network
66 TITLE:=HNCP Homenet metapackage (w/ SSL)
67 URL:=https://github.com/sbyx/hnetd
68 DEPENDS:=+hnetd-openssl +luci-app-hnet +ip
69 # Routing
70 DEPENDS+=+babeld
71 # Service discovery
72 DEPENDS+=+ohybridproxy +zonestitcher
73 # Distributed PCP support
74 DEPENDS+=+miniupnpd +minimalist-pcproxy
75 endef
76
77 define Package/hnet-full-l2tp
78 SECTION:=net
79 CATEGORY:=Network
80 TITLE:=HNCP Homenet metapackage (w/ L2TP)
81 URL:=https://github.com/sbyx/hnetd
82 DEPENDS:=+hnetd-nossl +luci-app-hnet +ip-full +kmod-l2tp-eth
83 # Routing
84 DEPENDS+=+babeld
85 # Service discovery
86 DEPENDS+=+ohybridproxy +zonestitcher
87 # Distributed PCP support
88 DEPENDS+=+miniupnpd +minimalist-pcproxy
89 endef
90
91 define Package/luci-app-hnet
92 SECTION:=luci
93 CATEGORY:=LuCI
94 SUBMENU:=3. Applications
95 TITLE:=HNCP Homenet configuration and visualization
96 # DEPENDS:=+hnetd
97 # TBD - how to express dependency on 'some' hnetd?
98 endef
99
100 define Package/hnetd-$(BUILD_VARIANT)/description
101 This package provides a daemon which implementats distributed prefix assignment
102 and service discovery for a home network consisting of multiple routers
103 connected to multiple service providers. It provides a netifd protocol "hnet"
104 for use in /etc/config/network.
105 endef
106
107 define Package/hnetd-$(BUILD_VARIANT)/install
108 $(INSTALL_DIR) $(1)/usr/sbin/
109 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hnetd $(1)/usr/sbin/
110 $(INSTALL_DIR) $(1)/lib/netifd/proto
111 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/hnet.sh $(1)/lib/netifd/proto
112 ln -s hnetd $(1)/usr/sbin/hnet-ifresolve
113 ln -s hnetd $(1)/usr/sbin/hnet-trust
114 ln -s hnetd $(1)/usr/sbin/hnet-dump
115 $(INSTALL_DIR) $(1)/etc/init.d
116 $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
117 $(INSTALL_DIR) $(1)/etc/config
118 $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
119 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ohp.script $(1)/usr/sbin/hnetd-ohp-script
120 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/ddz.script $(1)/usr/sbin/hnetd-ddz-script
121 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/pcp.script $(1)/usr/sbin/hnetd-pcp-script
122 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
123 $(INSTALL_DIR) $(1)/etc/uci-defaults
124 $(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
125 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/multicast.script $(1)/usr/sbin/hnet-multicast
126 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/autowifi.script $(1)/usr/sbin/autowifi
127 endef
128
129 define Package/hnet-full/install
130 true
131 endef
132
133 define Package/hnet-full-secure/install
134 true
135 endef
136
137 define Package/hnet-full-l2tp/install
138 $(INSTALL_DIR) $(1)/usr/sbin/
139 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/tunnel.script $(1)/usr/sbin/hnetd-tunnel
140 endef
141
142 define Package/luci-app-hnet/install
143 $(INSTALL_DIR) $(1)/usr/lib/lua/luci
144 $(INSTALL_DIR) $(1)/www
145 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/
146 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/htdocs/* $(1)/www/
147 endef
148
149 define Package/hnetd-$(BUILD_VARIANT)/postinst
150 #!/bin/sh
151 [ -n "$${IPKG_INSTROOT}" ] || {
152 (. /etc/uci-defaults/x-hnetd.defaults) && rm -f /etc/uci-defaults/x-hnetd.defaults
153 [ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart
154 /etc/init.d/hnetd enable
155 /etc/init.d/hnetd start
156 }
157 endef
158
159 $(eval $(call BuildPackage,hnetd-nossl))
160 $(eval $(call BuildPackage,hnetd-openssl))
161 $(eval $(call BuildPackage,hnet-full))
162 $(eval $(call BuildPackage,hnet-full-secure))
163 $(eval $(call BuildPackage,hnet-full-l2tp))
164 $(eval $(call BuildPackage,luci-app-hnet))