Merge pull request #483 from aparcar/luci-app-bmx7-transfer
[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:=https://github.com/bmx-routing/bmx7.git
31
32 PKG_REV:=cc245a22e54b5e110384485f18d9b805c91d8b71
33 PKG_MIRROR_HASH:=378228450b7790bb07b1d478f123e9196c1040d9f55ec42e83090249574a3d6b
34 PKG_VERSION:=r2019030802
35 PKG_RELEASE:=1
36 PKG_LICENSE:=GPL-2.0
37
38 PKG_SOURCE_VERSION:=$(PKG_REV)
39 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
40 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
41 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
42
43 include $(INCLUDE_DIR)/package.mk
44
45 TARGET_CFLAGS += $(FPIC)
46
47 MAKE_ARGS += EXTRA_CFLAGS="$(TARGET_CFLAGS) -I. -I$(STAGING_DIR)/usr/include -DCRYPTLIB=MBEDTLS_2_8_0 -DCORE_LIMIT=20000 -DTRAFFIC_DUMP -DNO_TRACE_FUNCTION_CALLS -DBMX7_LIB_IWINFO"
48
49 MAKE_ARGS += \
50 EXTRA_LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib -liwinfo" \
51 GIT_REV="$(PKG_REV)" \
52 CC="$(TARGET_CC)" \
53 INSTALL_DIR="$(PKG_INSTALL_DIR)" \
54 build_all
55
56 define Package/bmx7/Default
57 SECTION:=net
58 CATEGORY:=Network
59 SUBMENU:=Routing and Redirection
60 TITLE:=BMX7 layer 3 routing daemon
61 URL:=http://github.com/bmx-routing/bmx7
62 MAINTAINER:=Axel Neumann <neumann@cgws.de>
63 DEPENDS:=+zlib +libmbedtls +libiwinfo
64 endef
65
66 define Package/bmx7/description
67 BMX7 routing daemon supporting securely-entrusted IPv6 (and IPv4in6) routing
68 endef
69
70 define Package/bmx7
71 $(call Package/bmx7/Default)
72 MENU:=1
73 endef
74
75 define Package/bmx7-uci-config
76 $(call Package/bmx7/Default)
77 DEPENDS:=bmx7 +libuci
78 TITLE:=configuration plugin based on uci (recommended!)
79 endef
80
81 define Package/bmx7-iwinfo
82 $(call Package/bmx7/Default)
83 DEPENDS:=bmx7 +libiwinfo
84 TITLE:=link characteristics plugin based on libiwinfo (recommended!)
85 endef
86
87 define Package/bmx7-topology
88 $(call Package/bmx7/Default)
89 DEPENDS:=bmx7
90 TITLE:=topology plugin
91 endef
92
93 define Package/bmx7-json
94 $(call Package/bmx7/Default)
95 DEPENDS:=bmx7 +libjson-c
96 TITLE:=json plugin based on json-c
97 endef
98
99 define Package/bmx7-sms
100 $(call Package/bmx7/Default)
101 DEPENDS:=bmx7
102 TITLE:=sms plugin
103 endef
104
105 define Package/bmx7-tun
106 $(call Package/bmx7/Default)
107 DEPENDS:=bmx7 +kmod-ip6-tunnel +kmod-iptunnel6 +kmod-tun
108 TITLE:=ipip-based tunnel plugin (recommended!)
109 endef
110
111 define Package/bmx7-table
112 $(call Package/bmx7/Default)
113 DEPENDS:=bmx7 +bmx7-tun
114 TITLE:=plugin to announce routes from tables via tunnels
115 endef
116
117 define Build/Configure
118 mkdir -p $(PKG_INSTALL_DIR)
119 endef
120
121 define Build/Compile
122 $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
123 endef
124
125 define Package/bmx7/install
126 $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
127 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bmx7 $(1)/usr/sbin/bmx7
128 endef
129
130 define Package/bmx7/postinst
131 #!/bin/sh
132 # # check if we are on real system
133 if [ -z "$${IPKG_INSTROOT}" ]; then
134 if [ -f /etc/sysupgrade.conf ] && ! grep bmx7 /etc/sysupgrade.conf; then
135 echo /etc/bmx7 >> /etc/sysupgrade.conf
136 fi
137 fi
138 endef
139
140
141 define Package/bmx7-uci-config/conffiles
142 /etc/config/bmx7
143 /etc/bmx7
144 endef
145
146 define Package/bmx7-uci-config/install
147 $(INSTALL_DIR) $(1)/usr/lib $(1)/etc/config $(1)/etc/init.d
148 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_uci_config/bmx7_config.so $(1)/usr/lib/bmx7_config.so
149 $(INSTALL_BIN) ./files/etc/init.d/bmx7 $(1)/etc/init.d/bmx7
150 $(INSTALL_DATA) ./files/etc/config/bmx7 $(1)/etc/config/bmx7
151 endef
152
153 define Package/bmx7-iwinfo/install
154 $(INSTALL_DIR) $(1)/usr/lib
155 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_iwinfo/bmx7_iwinfo.so $(1)/usr/lib/bmx7_iwinfo.so
156 endef
157
158 define Package/bmx7-topology/install
159 $(INSTALL_DIR) $(1)/usr/lib
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_topology/bmx7_topology.so $(1)/usr/lib/bmx7_topology.so
161 endef
162
163 define Package/bmx7-json/install
164 $(INSTALL_DIR) $(1)/usr/lib
165 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_json/bmx7_json.so $(1)/usr/lib/bmx7_json.so
166 endef
167
168 define Package/bmx7-sms/install
169 $(INSTALL_DIR) $(1)/usr/lib
170 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_sms/bmx7_sms.so $(1)/usr/lib/bmx7_sms.so
171 endef
172
173 define Package/bmx7-tun/install
174 $(INSTALL_DIR) $(1)/usr/lib
175 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_tun/bmx7_tun.so $(1)/usr/lib/bmx7_tun.so
176 endef
177
178 define Package/bmx7-table/install
179 $(INSTALL_DIR) $(1)/usr/lib
180 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/bmx7_table/bmx7_table.so $(1)/usr/lib/bmx7_table.so
181 endef
182
183
184 $(eval $(call BuildPackage,bmx7))
185 $(eval $(call BuildPackage,bmx7-uci-config))
186 $(eval $(call BuildPackage,bmx7-iwinfo))
187 $(eval $(call BuildPackage,bmx7-topology))
188 $(eval $(call BuildPackage,bmx7-json))
189 $(eval $(call BuildPackage,bmx7-sms))
190 $(eval $(call BuildPackage,bmx7-table))
191 $(eval $(call BuildPackage,bmx7-tun))