25cbd60d43b506ba8c555d8c72e987317bb02e73
[feed/routing.git] / hnetd / Makefile
1 #
2 # Copyright (C) 2012-2013 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:=0c1d55d03983c726aaad010738236c2da64ca7df
11 PKG_VERSION:=2014-09-26-$(PKG_SOURCE_VERSION)
12 PKG_RELEASE:=1
13
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_URL:=git://github.com/sbyx/hnetd.git
16 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
17
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
19 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/package.mk
22 include $(INCLUDE_DIR)/cmake.mk
23
24 # Spammy debug builds for now
25 CMAKE_OPTIONS += -DL_LEVEL=7
26
27 # OpenWRT target
28 CMAKE_OPTIONS += -DBACKEND=openwrt
29
30 define Package/hnetd
31 SECTION:=net
32 CATEGORY:=Network
33 TITLE:=HNCP Homenet daemon
34 URL:=https://github.com/sbyx/hnetd
35 DEPENDS:=+odhcpd +odhcp6c +netifd
36 DEPENDS+=+@IPV6
37 endef
38
39 define Package/hnet-full
40 SECTION:=net
41 CATEGORY:=Network
42 TITLE:=HNCP Homenet metapackage
43 URL:=https://github.com/sbyx/hnetd
44 DEPENDS:=+hnetd +luci-app-hnet
45 # Routing
46 DEPENDS+=+babels
47 # Service discovery
48 DEPENDS+=+ohybridproxy
49 # Distributed PCP support
50 DEPENDS+=+miniupnpd +minimalist-pcproxy
51 endef
52
53 define Package/luci-app-hnet
54 SECTION:=luci
55 CATEGORY:=LuCI
56 SUBMENU:=3. Applications
57 TITLE:=HNCP Homenet configuration and visualization
58 DEPENDS:=+hnetd
59 endef
60
61 define Package/hnetd/description
62 This package provides a daemon which implementats distributed prefix assignment
63 and service discovery for a home network consisting of multiple routers
64 connected to multiple service providers. It provides a netifd protocol "hnet"
65 for use in /etc/config/network.
66 endef
67
68 define Package/hnetd/install
69 $(INSTALL_DIR) $(1)/usr/sbin/
70 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hnetd $(1)/usr/sbin/
71 $(INSTALL_DIR) $(1)/lib/netifd/proto
72 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/hnet.sh $(1)/lib/netifd/proto
73 ln -s hnetd $(1)/usr/sbin/hnet-ifresolve
74 $(INSTALL_DIR) $(1)/etc/init.d
75 $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
76 $(INSTALL_DIR) $(1)/etc/config
77 $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
78 $(INSTALL_BIN) ./files/ohp-script $(1)/usr/sbin/hnetd-ohp-script
79 $(INSTALL_BIN) ./files/pcp-script $(1)/usr/sbin/hnetd-pcp-script
80 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
81 $(INSTALL_DIR) $(1)/etc/uci-defaults
82 $(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
83 endef
84
85 define Package/hnet-full/install
86 true
87 endef
88
89 define Package/luci-app-hnet/install
90 $(INSTALL_DIR) $(1)/usr/lib/lua/luci
91 $(INSTALL_DIR) $(1)/www
92 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/
93 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/htdocs/* $(1)/www/
94 endef
95
96 define Package/hnetd/postinst
97 #!/bin/sh
98 [ -n "$${IPKG_INSTROOT}" ] || {
99 (. /etc/uci-defaults/x-hnetd.defaults) && rm -f /etc/uci-defaults/x-hnetd.defaults
100 [ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart
101 /etc/init.d/hnetd enable
102 /etc/init.d/hnetd start
103 }
104 endef
105
106 $(eval $(call BuildPackage,hnetd))
107 $(eval $(call BuildPackage,hnet-full))
108 $(eval $(call BuildPackage,luci-app-hnet))