2 # Copyright (C) 2006-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
12 PKG_RELEASE
:=$(AUTORELEASE
)
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.xz
15 PKG_SOURCE_URL
:=@KERNEL
/linux
/utils
/net
/iproute2
16 PKG_HASH
:=5ce12a0fec6b212725ef218735941b2dab76244db7e72646a76021b0537b43ab
18 PKG_BUILD_DEPENDS
:=iptables
20 PKG_CPE_ID
:=cpe
:/a
:iproute2_project
:iproute2
22 include $(INCLUDE_DIR
)/kernel.mk
23 include $(INCLUDE_DIR
)/package.mk
24 include $(INCLUDE_DIR
)/nls.mk
26 define Package
/iproute2
/Default
29 URL
:=http
://www.linuxfoundation.org
/collaborate
/workgroups
/networking
/iproute2
30 SUBMENU
:=Routing and Redirection
31 MAINTAINER
:=Russell Senior
<russell@personaltelco.net
>
34 define Package
/ip-tiny
35 $(call Package
/iproute2
/Default
)
36 TITLE
:=Routing control utility
(minimal
)
40 ALTERNATIVES
:=200:/sbin
/ip
:/usr
/libexec
/ip-tiny
41 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
44 define Package
/ip-full
45 $(call Package
/iproute2
/Default
)
46 TITLE
:=Routing control utility
(full
)
49 ALTERNATIVES
:=300:/sbin
/ip
:/usr
/libexec
/ip-full
50 DEPENDS
:=+libnl-tiny
+libbpf
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
53 define Package
/tc-tiny
54 $(call Package
/iproute2
/Default
)
55 TITLE
:=Traffic control utility
(minimal
)
59 ALTERNATIVES
:=200:/sbin
/tc
:/usr
/libexec
/tc-tiny
60 DEPENDS
:=+kmod-sched-core
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
64 $(call Package
/iproute2
/Default
)
65 TITLE
:=Traffic control utility
(bpf
)
68 ALTERNATIVES
:=300:/sbin
/tc
:/usr
/libexec
/tc-bpf
69 DEPENDS
:=+kmod-sched-core
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
+libbpf
72 define Package
/tc-full
73 $(call Package
/iproute2
/Default
)
74 TITLE
:=Traffic control utility
(full
)
77 ALTERNATIVES
:=400:/sbin
/tc
:/usr
/libexec
/tc-full
78 DEPENDS
:=+kmod-sched-core
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
+libbpf
+libxtables
+tc-mod-iptables
81 define Package
/tc-mod-iptables
82 $(call Package
/iproute2
/Default
)
83 TITLE
:=Traffic control module
- iptables action
85 DEPENDS
:=+libxtables
+libbpf
89 $(call Package
/iproute2
/Default
)
90 TITLE
:=General netlink utility frontend
91 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
94 define Package
/ip-bridge
95 $(call Package
/iproute2
/Default
)
96 TITLE
:=Bridge configuration utility from iproute2
97 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
101 $(call Package
/iproute2
/Default
)
102 TITLE
:=Socket statistics utility
103 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
+kmod-netlink-diag
107 $(call Package
/iproute2
/Default
)
108 TITLE
:=Network statistics utility
109 DEPENDS
:=+libnl-tiny
+(PACKAGE_devlink||PACKAGE_rdma
):libmnl
112 define Package
/devlink
113 $(call Package
/iproute2
/Default
)
114 TITLE
:=Network devlink utility
119 $(call Package
/iproute2
/Default
)
120 TITLE
:=Network rdma utility
124 ifeq ($(BUILD_VARIANT
),iptiny
)
129 ifeq ($(BUILD_VARIANT
),ipfull
)
134 ifeq ($(BUILD_VARIANT
),tctiny
)
138 ifeq ($(BUILD_VARIANT
),tcbpf
)
144 ifeq ($(BUILD_VARIANT
),tcfull
)
145 #enable iptables/xtables requirement only if tciptables variant is selected
148 TC_CONFIG_XT_OLD_H
:=y
154 #disable iptables requirement by default
157 TC_CONFIG_XT_OLD_H
:=n
161 ifdef CONFIG_PACKAGE_devlink
165 ifdef CONFIG_PACKAGE_rdma
169 define Build
/Configure
170 echo
"static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
171 > $(PKG_BUILD_DIR
)/include/SNAPSHOT.h
174 TARGET_CFLAGS
+= -ffunction-sections
-fdata-sections
-flto
175 TARGET_LDFLAGS
+= -Wl
,--gc-sections
-Wl
,--as-needed
176 TARGET_CPPFLAGS
+= -I
$(STAGING_DIR
)/usr
/include/libnl-tiny
179 KERNEL_INCLUDE
="$(LINUX_DIR)/include/uapi" \
180 SHARED_LIBS
=$(SHARED_LIBS
) \
181 IP_CONFIG_TINY
=$(IP_CONFIG_TINY
) \
182 BUILD_VARIANT
=$(BUILD_VARIANT
) \
183 LIBBPF_FORCE
=$(LIBBPF_FORCE
) \
184 HAVE_ELF
=$(HAVE_ELF
) \
185 HAVE_MNL
=$(HAVE_MNL
) \
186 HAVE_CAP
=$(HAVE_CAP
) \
188 IPT_LIB_DIR
=/usr
/lib
/iptables \
189 XT_LIB_DIR
=/usr
/lib
/iptables \
190 TC_CONFIG_XT
=$(TC_CONFIG_XT
) \
191 TC_CONFIG_XT_OLD
=$(TC_CONFIG_XT_OLD
) \
192 TC_CONFIG_XT_OLD_H
=$(TC_CONFIG_XT_OLD_H
) \
193 TC_CONFIG_IPSET
=$(TC_CONFIG_IPSET
) \
195 $(if
$(findstring c
,$(OPENWRT_VERBOSE
)),V
=1,V
='')
198 +$(MAKE_VARS
) $(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) $(MAKE_FLAGS
)
201 define Build
/InstallDev
202 $(INSTALL_DIR
) $(1)/usr
/include/iproute2
203 $(CP
) $(PKG_BUILD_DIR
)/include/bpf_elf.h
$(1)/usr
/include/iproute2
204 $(CP
) $(PKG_BUILD_DIR
)/include/{libgenl
,libnetlink
}.h
$(1)/usr
/include/
205 $(INSTALL_DIR
) $(1)/usr
/lib
206 $(CP
) $(PKG_BUILD_DIR
)/lib
/libnetlink.a
$(1)/usr
/lib
/
209 define Package
/ip-tiny
/install
210 $(INSTALL_DIR
) $(1)/usr
/libexec
211 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/ip
/ip
$(1)/usr
/libexec
/ip-tiny
214 define Package
/ip-full
/install
215 $(INSTALL_DIR
) $(1)/usr
/libexec
216 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/ip
/ip
$(1)/usr
/libexec
/ip-full
219 define Package
/tc-tiny
/install
220 $(INSTALL_DIR
) $(1)/usr
/libexec
221 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tc
/tc
$(1)/usr
/libexec
/tc-tiny
224 define Package
/tc-bpf
/install
225 $(INSTALL_DIR
) $(1)/usr
/libexec
226 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tc
/tc
$(1)/usr
/libexec
/tc-bpf
229 define Package
/tc-full
/install
230 $(INSTALL_DIR
) $(1)/usr
/libexec
231 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/tc
/tc
$(1)/usr
/libexec
/tc-full
234 define Package
/tc-mod-iptables
/install
235 $(INSTALL_DIR
) $(1)/usr
/lib
/tc
236 $(CP
) $(PKG_BUILD_DIR
)/tc
/m_xt.so
$(1)/usr
/lib
/tc
239 define Package
/genl
/install
240 $(INSTALL_DIR
) $(1)/usr
/sbin
241 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/genl
/genl
$(1)/usr
/sbin
/
244 define Package
/ip-bridge
/install
245 $(INSTALL_DIR
) $(1)/usr
/sbin
246 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/bridge
/bridge
$(1)/usr
/sbin
/
249 define Package
/ss
/install
250 $(INSTALL_DIR
) $(1)/usr
/sbin
251 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/misc
/ss
$(1)/usr
/sbin
/
254 define Package
/nstat
/install
255 $(INSTALL_DIR
) $(1)/usr
/sbin
256 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/misc
/nstat
$(1)/usr
/sbin
/
259 define Package
/devlink
/install
260 $(INSTALL_DIR
) $(1)/usr
/sbin
261 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/devlink
/devlink
$(1)/usr
/sbin
/
264 define Package
/rdma
/install
265 $(INSTALL_DIR
) $(1)/usr
/sbin
266 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/rdma
/rdma
$(1)/usr
/sbin
/
269 $(eval
$(call BuildPackage
,ip-tiny
))
270 $(eval
$(call BuildPackage
,ip-full
))
271 # build tc-mod-iptables before its dependents, to avoid
272 # spurious rebuilds when building multiple variants.
273 $(eval
$(call BuildPackage
,tc-mod-iptables
))
274 $(eval
$(call BuildPackage
,tc-tiny
))
275 $(eval
$(call BuildPackage
,tc-bpf
))
276 $(eval
$(call BuildPackage
,tc-full
))
277 $(eval
$(call BuildPackage
,genl
))
278 $(eval
$(call BuildPackage
,ip-bridge
))
279 $(eval
$(call BuildPackage
,ss
))
280 $(eval
$(call BuildPackage
,nstat
))
281 $(eval
$(call BuildPackage
,devlink
))
282 $(eval
$(call BuildPackage
,rdma
))