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