Merge pull request #429 from ecsv/batadv-2018.4
[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:=2018.4
13 PKG_RELEASE:=1
14 PKG_HASH:=e43827a5e868b4e134e77ca04da989fde1981463166bf1b6f2053acc3edd6257
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 include $(INCLUDE_DIR)/package.mk
21
22 define Package/batctl
23 URL:=https://www.open-mesh.org/
24 SECTION:=net
25 CATEGORY:=Network
26 DEPENDS:=+kmod-batman-adv +libnl-tiny +libc +librt
27 TITLE:=B.A.T.M.A.N. Advanced user space configuration tool batctl
28 MAINTAINER:=Simon Wunderlich <sw@simonwunderlich.de>
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 # The linker can identify unused sections of a binary when each symbol is stored
39 # in a separate section. This mostly removes unused linker sections and reduces
40 # the size by ~3% on mipsel.
41
42 TARGET_CFLAGS += -ffunction-sections -fdata-sections
43 TARGET_LDFLAGS += -Wl,--gc-sections
44
45 # Link-time optimization allows to move parts of the optimization from the single
46 # source file to the global source view. This is done by emitting the GIMPLE
47 # representation in each object file and analyzing it again during the link step.
48
49 TARGET_CFLAGS += -flto
50 TARGET_LDFLAGS += -fuse-linker-plugin
51
52 MAKE_BATCTL_ENV += \
53 CPPFLAGS="$(TARGET_CPPFLAGS)" \
54 CFLAGS="$(TARGET_CFLAGS)" \
55 LDFLAGS="$(TARGET_LDFLAGS)" \
56 LIBNL_NAME="libnl-tiny" \
57 LIBNL_GENL_NAME="libnl-tiny"
58
59 MAKE_BATCTL_ARGS += \
60 REVISION="$(PKG_BATCTL_SHORTREV)" \
61 CC="$(TARGET_CC)" \
62 DESTDIR="$(PKG_INSTALL_DIR)" \
63 batctl install \
64 REVISION="openwrt-$(PKG_VERSION)-$(PKG_RELEASE)"
65
66
67 define Build/Compile
68 $(MAKE_BATCTL_ENV) $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATCTL_ARGS)
69 endef
70
71 define Package/batctl/install
72 $(INSTALL_DIR) $(1)/usr/sbin
73 $(INSTALL_BIN) $(PKG_BUILD_DIR)/batctl $(1)/usr/sbin/
74 endef
75
76 $(eval $(call BuildPackage,batctl))