hnetd: update to latest
[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:=faa2b7a42c33f23fac9e08f8e70a8c7ed59ce812
11 PKG_VERSION:=2015-04-10-$(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
54 # Routing
55 DEPENDS+=+babels
56 # Service discovery
57 DEPENDS+=+ohybridproxy
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
66 URL:=https://github.com/sbyx/hnetd
67 DEPENDS:=+hnetd-openssl +luci-app-hnet
68 # Routing
69 DEPENDS+=+babels
70 # Service discovery
71 DEPENDS+=+ohybridproxy
72 # Distributed PCP support
73 DEPENDS+=+miniupnpd +minimalist-pcproxy
74 endef
75
76 define Package/luci-app-hnet
77 SECTION:=luci
78 CATEGORY:=LuCI
79 SUBMENU:=3. Applications
80 TITLE:=HNCP Homenet configuration and visualization
81 # DEPENDS:=+hnetd
82 # TBD - how to express dependency on 'some' hnetd?
83 endef
84
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.
90 endef
91
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
109 endef
110
111 define Package/hnet-full/install
112 true
113 endef
114
115 define Package/hnet-full-secure/install
116 true
117 endef
118
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/
124 endef
125
126 define Package/hnetd-$(BUILD_VARIANT)/postinst
127 #!/bin/sh
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
133 }
134 endef
135
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))