batctl: upgrade package to latest release 2020.1
[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:=2020.1
7 PKG_RELEASE:=1
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:=a3e21cbac5f7103925872d80d806d8677f034f8ae8bb6bf6296af81ab028c23b
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 bridge_loop_avoidance \
99 claimtable \
100 dat_cache \
101 distributed_arp_table \
102 elp_interval \
103 event \
104 fragmentation \
105 gateways \
106 gw_mode \
107 hop_penalty \
108 interface \
109 isolation_mark \
110 loglevel \
111 mcast_flags \
112 multicast_fanout \
113 multicast_forceflood \
114 multicast_mode \
115 nc_nodes \
116 neighbors \
117 network_coding \
118 orig_interval \
119 originators \
120 ping \
121 routing_algo \
122 statistics \
123 tcpdump \
124 throughput_override \
125 throughputmeter \
126 traceroute \
127 transglobal \
128 translate \
129 translocal \
130
131 config-settings := \
132 aggregation \
133 ap_isolation \
134 bonding \
135 bridge_loop_avoidance \
136 distributed_arp_table \
137 elp_interval \
138 fragmentation \
139 gw_mode \
140 hop_penalty \
141 interface \
142 isolation_mark \
143 loglevel \
144 multicast_fanout \
145 multicast_forceflood \
146 multicast_mode \
147 network_coding \
148 orig_interval \
149 routing_algo \
150 throughput_override \
151
152 config-tables := \
153 backbonetable \
154 claimtable \
155 dat_cache \
156 gateways \
157 loglevel \
158 nc_nodes \
159 neighbors \
160 originators \
161 statistics \
162 transglobal \
163 translocal \
164
165 config-tools := \
166 event \
167 ping \
168 tcpdump \
169 throughputmeter \
170 traceroute \
171 translate \
172
173 config-extratools := \
174 bisect_iv \
175
176 ifeq ($(BUILD_VARIANT),tiny)
177
178 config-y := \
179 $(config-settings) \
180
181 endif
182
183 ifeq ($(BUILD_VARIANT),default)
184
185 config-y := \
186 $(config-settings) \
187 $(config-tables) \
188 $(config-tools) \
189
190 endif
191
192 ifeq ($(BUILD_VARIANT),full)
193
194 config-y := \
195 $(config-settings) \
196 $(config-tables) \
197 $(config-tools) \
198 $(config-extratools) \
199
200 endif
201
202 define ConfigVars
203 $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
204 ))
205 endef
206
207 define batctl_config
208 $(call ConfigVars,n)$(call ConfigVars,y)
209 endef
210 $(eval $(call shexport,batctl_config))
211
212 MAKE_FLAGS += $$$$$(call shvar,batctl_config)
213
214 define Package/batctl-tiny/install
215 $(INSTALL_DIR) $(1)/usr/libexec
216 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
217 endef
218
219 define Package/batctl-default/install
220 $(INSTALL_DIR) $(1)/usr/libexec
221 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
222 endef
223
224 define Package/batctl-full/install
225 $(INSTALL_DIR) $(1)/usr/libexec
226 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
227 endef
228
229 $(eval $(call BuildPackage,batctl-default))
230 $(eval $(call BuildPackage,batctl-tiny))
231 $(eval $(call BuildPackage,batctl-full))