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