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