c4afb75b1ace510c012668dc25053d10a3fd8c98
[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 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 define Package/hnetd
32 SECTION:=net
33 CATEGORY:=Network
34 TITLE:=HNCP Homenet daemon
35 URL:=https://github.com/sbyx/hnetd
36 DEPENDS:=+odhcpd +odhcp6c +netifd
37 DEPENDS+=+@IPV6
38 endef
39
40 define Package/hnet-full
41 SECTION:=net
42 CATEGORY:=Network
43 TITLE:=HNCP Homenet metapackage
44 URL:=https://github.com/sbyx/hnetd
45 DEPENDS:=+hnetd +luci-app-hnet
46 # Routing
47 DEPENDS+=+babels
48 # Service discovery
49 DEPENDS+=+ohybridproxy
50 # Distributed PCP support
51 DEPENDS+=+miniupnpd +minimalist-pcproxy
52 endef
53
54 define Package/luci-app-hnet
55 SECTION:=luci
56 CATEGORY:=LuCI
57 SUBMENU:=3. Applications
58 TITLE:=HNCP Homenet configuration and visualization
59 DEPENDS:=+hnetd
60 endef
61
62 define Package/hnetd/description
63 This package provides a daemon which implementats distributed prefix assignment
64 and service discovery for a home network consisting of multiple routers
65 connected to multiple service providers. It provides a netifd protocol "hnet"
66 for use in /etc/config/network.
67 endef
68
69 define Package/hnetd/install
70 $(INSTALL_DIR) $(1)/usr/sbin/
71 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hnetd $(1)/usr/sbin/
72 $(INSTALL_DIR) $(1)/lib/netifd/proto
73 $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/hnet.sh $(1)/lib/netifd/proto
74 ln -s hnetd $(1)/usr/sbin/hnet-ifresolve
75 $(INSTALL_DIR) $(1)/etc/init.d
76 $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
77 $(INSTALL_DIR) $(1)/etc/config
78 $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
79 $(INSTALL_BIN) ./files/ohp-script $(1)/usr/sbin/hnetd-ohp-script
80 $(INSTALL_BIN) ./files/pcp-script $(1)/usr/sbin/hnetd-pcp-script
81 $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
82 $(INSTALL_DIR) $(1)/etc/uci-defaults
83 $(INSTALL_BIN) ./files/hnetd.defaults $(1)/etc/uci-defaults/x-hnetd.defaults
84 endef
85
86 define Package/hnet-full/install
87 true
88 endef
89
90 define Package/luci-app-hnet/install
91 $(INSTALL_DIR) $(1)/usr/lib/lua/luci
92 $(INSTALL_DIR) $(1)/www
93 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/luasrc/* $(1)/usr/lib/lua/luci/
94 $(CP) -R $(PKG_BUILD_DIR)/openwrt/luci/htdocs/* $(1)/www/
95 endef
96
97 define Package/hnetd/postinst
98 #!/bin/sh
99 [ -n "$${IPKG_INSTROOT}" ] || {
100 (. /etc/uci-defaults/x-hnetd.defaults) && rm -f /etc/uci-defaults/x-hnetd.defaults
101 [ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq restart
102 /etc/init.d/hnetd enable
103 /etc/init.d/hnetd start
104 }
105 endef
106
107 $(eval $(call BuildPackage,hnetd))
108 $(eval $(call BuildPackage,hnet-full))
109 $(eval $(call BuildPackage,luci-app-hnet))