5c1c20e6bf82d608d97381c6fa7bf4d7f75fb71d
[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:=1
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-tiny
34 $(call Package/batctl/Default)
35 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Minimal)
36 VARIANT:=tiny
37 PROVIDES:=batctl
38 ALTERNATIVES:=100:/usr/sbin/batctl:/usr/libexec/batctl-tiny
39 endef
40
41 define Package/batctl-default
42 $(call Package/batctl/Default)
43 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Default)
44 VARIANT:=default
45 ALTERNATIVES:=200:/usr/sbin/batctl:/usr/libexec/batctl-default
46 endef
47
48 define Package/batctl-full
49 $(call Package/batctl/Default)
50 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool (Full)
51 VARIANT:=full
52 ALTERNATIVES:=300:/usr/sbin/batctl:/usr/libexec/batctl-full
53 endef
54
55 define Package/batctl/description
56 batctl is a more intuitive managment utility for B.A.T.M.A.N.-Advanced.
57 It is an easier method for configuring batman-adv and provides some
58 additional tools for debugging as well. This package builds
59 version $(PKG_VERSION) of the user space utility.
60 endef
61
62 # The linker can identify unused sections of a binary when each symbol is stored
63 # in a separate section. This mostly removes unused linker sections and reduces
64 # the size by ~3% on mipsel.
65
66 TARGET_CFLAGS += -ffunction-sections -fdata-sections
67 TARGET_LDFLAGS += -Wl,--gc-sections
68
69 # Link-time optimization allows to move parts of the optimization from the single
70 # source file to the global source view. This is done by emitting the GIMPLE
71 # representation in each object file and analyzing it again during the link step.
72
73 TARGET_CFLAGS += -flto
74 TARGET_LDFLAGS += -fuse-linker-plugin
75
76 MAKE_BATCTL_ENV += \
77 CPPFLAGS="$(TARGET_CPPFLAGS)" \
78 CFLAGS="$(TARGET_CFLAGS)" \
79 LDFLAGS="$(TARGET_LDFLAGS)" \
80 LIBNL_NAME="libnl-tiny" \
81 LIBNL_GENL_NAME="libnl-tiny"
82
83 MAKE_BATCTL_ARGS += \
84 REVISION="$(PKG_BATCTL_SHORTREV)" \
85 CC="$(TARGET_CC)" \
86 DESTDIR="$(PKG_INSTALL_DIR)" \
87 batctl install \
88 REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
89
90 config-n := \
91 aggregation \
92 ap_isolation \
93 backbonetable \
94 bisect_iv \
95 bonding \
96 bridge_loop_avoidance \
97 claimtable \
98 dat_cache \
99 distributed_arp_table \
100 event \
101 fragmentation \
102 gateways \
103 gw_mode \
104 interface \
105 isolation_mark \
106 log \
107 loglevel \
108 mcast_flags \
109 multicast_mode \
110 nc_nodes \
111 neighbors \
112 network_coding \
113 orig_interval \
114 originators \
115 ping \
116 routing_algo \
117 statistics \
118 tcpdump \
119 throughputmeter \
120 traceroute \
121 transglobal \
122 translate \
123 translocal \
124
125 config-settings := \
126 aggregation \
127 ap_isolation \
128 bonding \
129 bridge_loop_avoidance \
130 distributed_arp_table \
131 fragmentation \
132 gw_mode \
133 interface \
134 isolation_mark \
135 loglevel \
136 multicast_mode \
137 network_coding \
138 orig_interval \
139 routing_algo \
140
141 config-tables := \
142 backbonetable \
143 claimtable \
144 dat_cache \
145 gateways \
146 loglevel \
147 nc_nodes \
148 neighbors \
149 originators \
150 statistics \
151 transglobal \
152 translocal \
153
154 config-tools := \
155 event \
156 log \
157 ping \
158 tcpdump \
159 throughputmeter \
160 traceroute \
161 translate \
162
163 config-extratools := \
164 bisect_iv \
165
166 ifeq ($(BUILD_VARIANT),tiny)
167
168 config-y := \
169 $(config-settings) \
170
171 endif
172
173 ifeq ($(BUILD_VARIANT),default)
174
175 config-y := \
176 $(config-settings) \
177 $(config-tables) \
178 $(config-tools) \
179
180 endif
181
182 ifeq ($(BUILD_VARIANT),full)
183
184 config-y := \
185 $(config-settings) \
186 $(config-tables) \
187 $(config-tools) \
188 $(config-extratools) \
189
190 endif
191
192 define ConfigVars
193 $(subst $(space),,$(foreach opt,$(config-$(1)),CONFIG_$(opt)=$(1)
194 ))
195 endef
196
197 define batctl_config
198 $(call ConfigVars,n)$(call ConfigVars,y)
199 endef
200 $(eval $(call shexport,batctl_config))
201
202 define Build/Compile
203 $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS) \
204 $$$$$(call shvar,batctl_config)
205 endef
206
207 define Package/batctl-tiny/install
208 $(INSTALL_DIR) $(1)/usr/libexec
209 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-tiny
210 endef
211
212 define Package/batctl-default/install
213 $(INSTALL_DIR) $(1)/usr/libexec
214 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-default
215 endef
216
217 define Package/batctl-full/install
218 $(INSTALL_DIR) $(1)/usr/libexec
219 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/libexec/batctl-full
220 endef
221
222 $(eval $(call BuildPackage,batctl-default))
223 $(eval $(call BuildPackage,batctl-tiny))
224 $(eval $(call BuildPackage,batctl-full))