de0c580253f43ebe781a19b79facfd471ae83427
[feed/routing.git] / bmx7 / Makefile
1 # Copyright (C) 2011 Fundacio Privada per a la Xarxa Oberta, Lliure i Neutral guifi.net
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 #
17 # The full GNU General Public License is included in this distribution in
18 # the file called "COPYING".
19 #
20 # Contibutors:
21 # Axel Neumann, Simó Albert i Beltran, Pau Escrich
22 #
23
24
25 include $(TOPDIR)/rules.mk
26
27 PKG_NAME:=bmx7
28
29 PKG_SOURCE_PROTO:=git
30
31 #PKG_SOURCE_URL:=file:///usr/src/bmx6/bmx6.git
32 #PKG_SOURCE_URL:=git://bmx6.net/bmx6.git
33 PKG_SOURCE_URL:=git://github.com/axn/bmx6.git
34
35 PKG_REV:=b9f9322f67373402c3dd0212994512882a734f3b
36 PKG_VERSION:=r2015111101
37 PKG_RELEASE:=4
38 PKG_LICENSE:=GPL-2.0
39
40 PKG_SOURCE_VERSION:=$(PKG_REV)
41 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
42 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
43 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
44
45 include $(INCLUDE_DIR)/package.mk
46
47 TARGET_CFLAGS += $(FPIC)
48
49 MAKE_ARGS += \
50 EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DCRYPTLIB=POLARSSL_1_3_4 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS" \
51 EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib " \
52 GIT_REV="$(PKG_REV)" \
53 CC="$(TARGET_CC)" \
54 INSTALL_DIR="$(PKG_INSTALL_DIR)" \
55 build_all
56
57 define Package/bmx7/Default
58 SECTION:=net
59 CATEGORY:=Network
60 SUBMENU:=Routing and Redirection
61 TITLE:=BMX7 layer 3 routing daemon
62 URL:=http://bmx6.net/
63 MAINTAINER:=Axel Neumann <neumann@cgws.de>
64 DEPENDS:=+zlib +libpolarssl @!bmx6
65 endef
66
67 define Package/bmx7/description
68 BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
69 endef
70
71 define Package/bmx7
72 $(call Package/bmx7/Default)
73 MENU:=1
74 endef
75
76 define Package/bmx7-uci-config
77 $(call Package/bmx7/Default)
78 DEPENDS:=bmx7 +libuci
79 TITLE:=configuration plugin based on uci (recommended!)
80 endef
81
82 define Package/bmx7-json
83 $(call Package/bmx7/Default)
84 DEPENDS:=bmx7 +libjson-c
85 TITLE:=json plugin based on json-c
86 endef
87
88 define Package/bmx7-sms
89 $(call Package/bmx7/Default)
90 DEPENDS:=bmx7
91 TITLE:=sms plugin
92 endef
93
94 define Package/bmx7-tun
95 $(call Package/bmx7/Default)
96 DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun
97 TITLE:=ipip-based tunnel plugin (recommended!)
98 endef
99
100 #define Package/bmx7-quagga
101 # $(call Package/bmx7/Default)
102 # DEPENDS:=bmx7 +bmx7-tun +qmp-quagga @BROKEN
103 # TITLE:=bmx7 quagga plugin to redistribute/export routes (needs manet/bmx patched quagga 0.99.21)
104 #endef
105
106 define Package/bmx7-table
107 $(call Package/bmx7/Default)
108 DEPENDS:=bmx7 +bmx7-tun
109 TITLE:=plugin to announce routes from tables via tunnels
110 endef
111
112 define Build/Configure
113 mkdir -p $(PKG_INSTALL_DIR)
114 endef
115
116 define Build/Compile
117 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
118 endef
119
120 define Package/bmx7/install
121 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
122 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx6 $(1)/usr/sbin/bmx6
123 endef
124
125 define Package/bmx7/postinst
126 #!/bin/sh
127 # # check if we are on real system
128 if [ -z "$${IPKG_INSTROOT}" ]; then
129 if [ -f /etc/sysupgrade.conf ] && ! grep bmx6 /etc/sysupgrade.conf; then
130 echo /etc/bmx6 >> /etc/sysupgrade.conf
131 fi
132 fi
133 endef
134
135
136 define Package/bmx7-uci-config/conffiles
137 /etc/config/bmx6
138 endef
139
140 define Package/bmx7-uci-config/install
141 $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
142 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_uci_config/bmx6_config.so $(1)/usr/lib/bmx6_config.so
143 $(INSTALL_BIN) ./files/etc/init.d/bmx6 $(1)/etc/init.d/bmx6
144 $(INSTALL_DATA) ./files/etc/config/bmx6 $(1)/etc/config/bmx6
145 endef
146
147 define Package/bmx7-json/install
148 $(INSTALL_DIR) $(1)/usr/lib
149 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_json/bmx6_json.so $(1)/usr/lib/bmx6_json.so
150 endef
151
152 define Package/bmx7-sms/install
153 $(INSTALL_DIR) $(1)/usr/lib
154 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_sms/bmx6_sms.so $(1)/usr/lib/bmx6_sms.so
155 endef
156
157 define Package/bmx7-tun/install
158 $(INSTALL_DIR) $(1)/usr/lib
159 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_tun/bmx6_tun.so $(1)/usr/lib/bmx6_tun.so
160 endef
161
162 define Package/bmx7-table/install
163 $(INSTALL_DIR) $(1)/usr/lib
164 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_table/bmx6_table.so $(1)/usr/lib/bmx6_table.so
165 endef
166
167 #define Package/bmx7-quagga/install
168 # $(INSTALL_DIR) $(1)/usr/lib
169 # $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx6_quagga/bmx6_quagga.so $(1)/usr/lib/bmx6_quagga.so
170 #endef
171
172 $(eval $(call BuildPackage,bmx7))
173 $(eval $(call BuildPackage,bmx7-uci-config))
174 $(eval $(call BuildPackage,bmx7-json))
175 $(eval $(call BuildPackage,bmx7-sms))
176 #$(eval $(call BuildPackage,bmx7-quagga))
177 $(eval $(call BuildPackage,bmx7-table))
178 $(eval $(call BuildPackage,bmx7-tun))