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