Merge pull request #440 from tohojo/bird-203
[feed/routing.git] / batctl / Makefile
1 #
2 # Copyright (C) 2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=batctl
11
12 PKG_VERSION:=2019.2
13 PKG_RELEASE:=1
14 PKG_HASH:=fb656208ff7d4cd8b1b422f60c9e6d8747302a347cbf6c199d7afa9b80f80ea3
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=https://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
18 PKG_LICENSE:=GPL-2.0
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/batctl/Default
25 URL:=https://www.open-mesh.org/
26 SECTION:=net
27 CATEGORY:=Network
28 DEPENDS:=+libnl-tiny +libc +librt
29 PROVIDES:=batctl
30 MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
31 endef
32
33 define Package/batctl/description
34 batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
35 It is an easier method for configuring batman-adv and provides some
36 additional tools for debugging as well. This package builds
37 version $(PKG_VERSION) of the user space utility.
38 endef
39
40 define Package/batctl-tiny
41 $(call Package/batctl/Default)
42 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
43 VARIANT:=tiny
44 PROVIDES:=batctl
45 ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
46 endef
47
48 define Package/batctl-tiny/description
49 $(Package/batctl/description)
50 Only configuration relevant subcommands are enabled.
51 endef
52
53 define Package/batctl-default
54 $(call Package/batctl/Default)
55 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
56 VARIANT:=default
57 ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
58 endef
59
60 define Package/batctl-default/description
61 $(Package/batctl/description)
62 Standard subcommands for configuration and online debugging are enabled.
63 endef
64
65 define Package/batctl-full
66 $(call Package/batctl/Default)
67 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
68 VARIANT:=full
69 ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
70 endef
71
72 define Package/batctl-full/description
73 $(Package/batctl/description)
74 Subcommands for configuration, online and offline debugging are enabled.
75 endef
76
77 # The linker can identify unused sections of a binary when each symbol is stored
78 # in a separate section. This mostly removes unused linker sections and reduces
79 # the size by ~3% on mipsel.
80
81 TARGET_CFLAGS += -ffunction-sections -fdata-sections
82 TARGET_LDFLAGS += -Wl,--gc-sections
83
84 # Link-time optimization allows to move parts of the optimization from the single
85 # source file to the global source view. This is done by emitting the GIMPLE
86 # representation in each object file and analyzing it again during the link step.
87
88 TARGET_CFLAGS += -flto
89 TARGET_LDFLAGS += -fuse-linker-plugin
90
91 MAKE_BATCTL_ENV += \
92 CPPFLAGS="$(TARGET_CPPFLAGS)" \
93 CFLAGS="$(TARGET_CFLAGS)" \
94 LDFLAGS="$(TARGET_LDFLAGS)" \
95 LIBNL_NAME="libnl-tiny" \
96 LIBNL_GENL_NAME="libnl-tiny"
97
98 MAKE_BATCTL_ARGS += \
99 REVISION="$(PKG_BATCTL_SHORTREV)" \
100 CC="$(TARGET_CC)" \
101 DESTDIR="$(PKG_INSTALL_DIR)" \
102 batctl install \
103 REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
104
105 config-n := \
106 aggregation \
107 ap_isolation \
108 backbonetable \
109 bisect_iv \
110 bonding \
111 bridge_loop_avoidance \
112 claimtable \
113 dat_cache \
114 distributed_arp_table \
115 elp_interval \
116 event \
117 fragmentation \
118 gateways \
119 gw_mode \
120 hop_penalty \
121 interface \
122 isolation_mark \
123 loglevel \
124 mcast_flags \
125 multicast_fanout \
126 multicast_forceflood \
127 multicast_mode \
128 nc_nodes \
129 neighbors \
130 network_coding \
131 orig_interval \
132 originators \
133 ping \
134 routing_algo \
135 statistics \
136 tcpdump \
137 throughput_override \
138 throughputmeter \
139 traceroute \
140 transglobal \
141 translate \
142 translocal \
143
144 config-settings := \
145 aggregation \
146 ap_isolation \
147 bonding \
148 bridge_loop_avoidance \
149 distributed_arp_table \
150 elp_interval \
151 fragmentation \
152 gw_mode \
153 hop_penalty \
154 interface \
155 isolation_mark \
156 loglevel \
157 multicast_fanout \
158 multicast_forceflood \
159 multicast_mode \
160 network_coding \
161 orig_interval \
162 routing_algo \
163 throughput_override \
164
165 config-tables := \
166 backbonetable \
167 claimtable \
168 dat_cache \
169 gateways \
170 loglevel \
171 nc_nodes \
172 neighbors \
173 originators \
174 statistics \
175 transglobal \
176 translocal \
177
178 config-tools := \
179 event \
180 ping \
181 tcpdump \
182 throughputmeter \
183 traceroute \
184 translate \
185
186 config-extratools := \
187 bisect_iv \
188
189 ifeq ($(BUILD_VARIANT),tiny)
190
191 config-y := \
192 $(config-settings) \
193
194 endif
195
196 ifeq ($(BUILD_VARIANT),default)
197
198 config-y := \
199 $(config-settings) \
200 $(config-tables) \
201 $(config-tools) \
202
203 endif
204
205 ifeq ($(BUILD_VARIANT),full)
206
207 config-y := \
208 $(config-settings) \
209 $(config-tables) \
210 $(config-tools) \
211 $(config-extratools) \
212
213 endif
214
215 define ConfigVars
216 $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
217 ))
218 endef
219
220 define batctl_config
221 $(call ConfigVars,n)$(call ConfigVars,y)
222 endef
223 $(eval $(call shexport,batctl_config))
224
225 define Build/Compile
226 $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS) \
227 $$$$$(call shvar,batctl_config)
228 endef
229
230 define Package/batctl-tiny/install
231 $(INSTALL_DIR) $(1)/usr/libexec
232 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
233 endef
234
235 define Package/batctl-default/install
236 $(INSTALL_DIR) $(1)/usr/libexec
237 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
238 endef
239
240 define Package/batctl-full/install
241 $(INSTALL_DIR) $(1)/usr/libexec
242 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
243 endef
244
245 $(eval $(call BuildPackage,batctl-default))
246 $(eval $(call BuildPackage,batctl-tiny))
247 $(eval $(call BuildPackage,batctl-full))