7fe917306213c8cdfda43dcbc2cc493cb6b97fa6
[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://github.com/bmx-routing/bmx7.git
31 #PKG_SOURCE_URL:=file:///usr/src/bmx-routing/bmx7.git
32
33
34 PKG_REV:=210f1e3b880d957921dc253792eb228cdfa6100b
35 PKG_MIRROR_HASH:=44d983336f51dcfe4ca4adf2a4977a95868d69de0e67d4720f24186d74643215
36 PKG_VERSION:=r2018030407
37 PKG_RELEASE:=1
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 += 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://github.com/bmx-routing/bmx7
64 MAINTAINER:=Axel Neumann <neumann@cgws.de>
65 DEPENDS:=+zlib +libmbedtls +libiwinfo
66 endef
67
68 define Package/bmx7/description
69 BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
70 endef
71
72 define Package/bmx7
73 $(call Package/bmx7/Default)
74 MENU:=1
75 endef
76
77 define Package/bmx7-uci-config
78 $(call Package/bmx7/Default)
79 DEPENDS:=bmx7 +libuci
80 TITLE:=configuration plugin based on uci (recommended!)
81 endef
82
83 define Package/bmx7-iwinfo
84 $(call Package/bmx7/Default)
85 DEPENDS:=bmx7 +libiwinfo
86 TITLE:=link characteristics plugin based on libiwinfo (recommended!)
87 endef
88
89 define Package/bmx7-topology
90 $(call Package/bmx7/Default)
91 DEPENDS:=bmx7
92 TITLE:=topology plugin
93 endef
94
95 define Package/bmx7-json
96 $(call Package/bmx7/Default)
97 DEPENDS:=bmx7 +libjson-c
98 TITLE:=json plugin based on json-c
99 endef
100
101 define Package/bmx7-sms
102 $(call Package/bmx7/Default)
103 DEPENDS:=bmx7
104 TITLE:=sms plugin
105 endef
106
107 define Package/bmx7-tun
108 $(call Package/bmx7/Default)
109 DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun
110 TITLE:=ipip-based tunnel plugin (recommended!)
111 endef
112
113 define Package/bmx7-table
114 $(call Package/bmx7/Default)
115 DEPENDS:=bmx7 +bmx7-tun
116 TITLE:=plugin to announce routes from tables via tunnels
117 endef
118
119 define Build/Configure
120 mkdir -p $(PKG_INSTALL_DIR)
121 endef
122
123 define Build/Compile
124 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
125 endef
126
127 define Package/bmx7/install
128 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
129 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx7 $(1)/usr/sbin/bmx7
130 endef
131
132 define Package/bmx7/postinst
133 #!/bin/sh
134 # # check if we are on real system
135 if [ -z "$${IPKG_INSTROOT}" ]; then
136 if [ -f /etc/sysupgrade.conf ] && ! grep bmx7 /etc/sysupgrade.conf; then
137 echo /etc/bmx7 >> /etc/sysupgrade.conf
138 fi
139 fi
140 endef
141
142
143 define Package/bmx7-uci-config/conffiles
144 /etc/config/bmx7
145 endef
146
147 define Package/bmx7-uci-config/install
148 $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
149 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_uci_config/bmx7_config.so $(1)/usr/lib/bmx7_config.so
150 $(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7
151 $(INSTALL_DATA) ./files/etc/config/bmx7 $(1)/etc/config/bmx7
152 endef
153
154 define Package/bmx7-iwinfo/install
155 $(INSTALL_DIR) $(1)/usr/lib
156 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_iwinfo/bmx7_iwinfo.so $(1)/usr/lib/bmx7_iwinfo.so
157 endef
158
159 define Package/bmx7-topology/install
160 $(INSTALL_DIR) $(1)/usr/lib
161 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_topology/bmx7_topology.so $(1)/usr/lib/bmx7_topology.so
162 endef
163
164 define Package/bmx7-json/install
165 $(INSTALL_DIR) $(1)/usr/lib
166 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_json/bmx7_json.so $(1)/usr/lib/bmx7_json.so
167 endef
168
169 define Package/bmx7-sms/install
170 $(INSTALL_DIR) $(1)/usr/lib
171 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_sms/bmx7_sms.so $(1)/usr/lib/bmx7_sms.so
172 endef
173
174 define Package/bmx7-tun/install
175 $(INSTALL_DIR) $(1)/usr/lib
176 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_tun/bmx7_tun.so $(1)/usr/lib/bmx7_tun.so
177 endef
178
179 define Package/bmx7-table/install
180 $(INSTALL_DIR) $(1)/usr/lib
181 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_table/bmx7_table.so $(1)/usr/lib/bmx7_table.so
182 endef
183
184
185 $(eval $(call BuildPackage,bmx7))
186 $(eval $(call BuildPackage,bmx7-uci-config))
187 $(eval $(call BuildPackage,bmx7-iwinfo))
188 $(eval $(call BuildPackage,bmx7-topology))
189 $(eval $(call BuildPackage,bmx7-json))
190 $(eval $(call BuildPackage,bmx7-sms))
191 $(eval $(call BuildPackage,bmx7-table))
192 $(eval $(call BuildPackage,bmx7-tun))