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