Revert "iproute2: use tc package variant to limit other package sizes"
[oweals/openwrt.git] / package / network / utils / iproute2 / Makefile
1 #
2 # Copyright (C) 2006-2015 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:=iproute2
11 PKG_VERSION:=4.20.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
16 PKG_HASH:=c8adaa6a40f888476b23acb283cfa30c0dd55f07b5aa20663ed5ba2ef1f6fda8
17 PKG_BUILD_PARALLEL:=1
18 PKG_BUILD_DEPENDS:=iptables
19 PKG_LICENSE:=GPL-2.0
20 PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
21
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
23
24 include $(INCLUDE_DIR)/kernel.mk
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/nls.mk
27
28 define Package/iproute2/Default
29   SECTION:=net
30   CATEGORY:=Network
31   URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
32   SUBMENU:=Routing and Redirection
33   MAINTAINER:=Russell Senior <russell@personaltelco.net>
34 endef
35
36 define Package/ip-tiny
37 $(call Package/iproute2/Default)
38  TITLE:=Routing control utility (Minimal)
39  VARIANT:=tiny
40  PROVIDES:=ip
41  ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
42  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
43 endef
44
45 define Package/ip-full
46 $(call Package/iproute2/Default)
47  TITLE:=Routing control utility (Full)
48  VARIANT:=full
49  PROVIDES:=ip
50  ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
51  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
52 endef
53
54 define Package/tc
55 $(call Package/iproute2/Default)
56   TITLE:=Traffic control utility
57   DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
58 endef
59
60 define Package/genl
61 $(call Package/iproute2/Default)
62   TITLE:=General netlink utility frontend
63   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
64 endef
65
66 define Package/ip-bridge
67 $(call Package/iproute2/Default)
68   TITLE:=Bridge configuration utility from iproute2
69   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
70 endef
71
72 define Package/ss
73 $(call Package/iproute2/Default)
74   TITLE:=Socket statistics utility
75   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
76 endef
77
78 define Package/nstat
79 $(call Package/iproute2/Default)
80   TITLE:=Network statistics utility
81   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
82 endef
83
84 define Package/devlink
85 $(call Package/iproute2/Default)
86   TITLE:=Network devlink utility
87   DEPENDS:=+libmnl
88 endef
89
90 define Package/rdma
91 $(call Package/iproute2/Default)
92   TITLE:=Network rdma utility
93   DEPENDS:=+libmnl
94 endef
95
96 ifeq ($(BUILD_VARIANT),tiny)
97   IP_CONFIG_TINY:=y
98 endif
99
100 ifdef CONFIG_PACKAGE_devlink
101   HAVE_MNL:=y
102 endif
103
104 ifdef CONFIG_PACKAGE_rdma
105   HAVE_MNL:=y
106 endif
107
108 define Build/Configure
109         echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
110                 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
111 endef
112
113 TARGET_CFLAGS += -ffunction-sections -fdata-sections
114 TARGET_LDFLAGS += -Wl,--gc-sections
115 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
116
117 MAKE_FLAGS += \
118         KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
119         SHARED_LIBS="" \
120         IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
121         HAVE_MNL=$(HAVE_MNL) \
122         IPT_LIB_DIR=/usr/lib/iptables \
123         XT_LIB_DIR=/usr/lib/iptables \
124         FPIC="$(FPIC)"
125
126 define Build/Compile
127         +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
128 endef
129
130 define Build/InstallDev
131         $(INSTALL_DIR) $(1)/usr/include
132         $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
133         $(INSTALL_DIR) $(1)/usr/lib
134         $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
135 endef
136
137 define Package/ip-tiny/install
138         $(INSTALL_DIR) $(1)/usr/libexec
139         $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-tiny
140 endef
141
142 define Package/ip-full/install
143         $(INSTALL_DIR) $(1)/usr/libexec
144         $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-full
145 endef
146
147 define Package/tc/install
148         $(INSTALL_DIR) $(1)/usr/sbin
149         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
150         $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
151         $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
152 endef
153
154 define Package/genl/install
155         $(INSTALL_DIR) $(1)/usr/sbin
156         $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
157 endef
158
159 define Package/ip-bridge/install
160         $(INSTALL_DIR) $(1)/usr/sbin
161         $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
162 endef
163
164 define Package/ss/install
165         $(INSTALL_DIR) $(1)/usr/sbin
166         $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
167 endef
168
169 define Package/nstat/install
170         $(INSTALL_DIR) $(1)/usr/sbin
171         $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
172 endef
173
174 define Package/devlink/install
175         $(INSTALL_DIR) $(1)/usr/sbin
176         $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
177 endef
178
179 define Package/rdma/install
180         $(INSTALL_DIR) $(1)/usr/sbin
181         $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
182 endef
183
184 $(eval $(call BuildPackage,ip-tiny))
185 $(eval $(call BuildPackage,ip-full))
186 $(eval $(call BuildPackage,tc))
187 $(eval $(call BuildPackage,genl))
188 $(eval $(call BuildPackage,ip-bridge))
189 $(eval $(call BuildPackage,ss))
190 $(eval $(call BuildPackage,nstat))
191 $(eval $(call BuildPackage,devlink))
192 $(eval $(call BuildPackage,rdma))