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