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