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