1################################################################################
2#
3# iproute2
4#
5################################################################################
6
7IPROUTE2_VERSION = 6.8.0
8IPROUTE2_SOURCE = iproute2-$(IPROUTE2_VERSION).tar.xz
9IPROUTE2_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/net/iproute2
10IPROUTE2_DEPENDENCIES = host-bison host-flex host-pkgconf \
11	$(if $(BR2_PACKAGE_LIBMNL),libmnl)
12IPROUTE2_LICENSE = GPL-2.0+
13IPROUTE2_LICENSE_FILES = COPYING
14IPROUTE2_CPE_ID_VALID = YES
15
16ifeq ($(BR2_PACKAGE_ELFUTILS),y)
17IPROUTE2_DEPENDENCIES += elfutils
18endif
19
20ifeq ($(BR2_PACKAGE_LIBCAP),y)
21IPROUTE2_DEPENDENCIES += libcap
22endif
23
24ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
25IPROUTE2_DEPENDENCIES += libselinux
26endif
27
28ifeq ($(BR2_PACKAGE_IPTABLES)x$(BR2_STATIC_LIBS),yx)
29IPROUTE2_DEPENDENCIES += iptables
30else
31define IPROUTE2_DISABLE_IPTABLES
32	# m_xt.so is built unconditionally
33	echo "TC_CONFIG_XT:=n" >>$(@D)/config.mk
34endef
35endif
36
37ifeq ($(BR2_PACKAGE_BERKELEYDB_COMPAT185),y)
38IPROUTE2_DEPENDENCIES += berkeleydb
39endif
40
41ifeq ($(BR2_PACKAGE_LIBBPF),y)
42IPROUTE2_DEPENDENCIES += libbpf
43IPROUTE2_CONFIGURE_OPTS += --libbpf_force on
44else
45IPROUTE2_CONFIGURE_OPTS += --libbpf_force off
46endif
47
48define IPROUTE2_CONFIGURE_CMDS
49	cd $(@D) && $(TARGET_CONFIGURE_OPTS) ./configure \
50		$(IPROUTE2_CONFIGURE_OPTS)
51	$(IPROUTE2_DISABLE_IPTABLES)
52endef
53
54# workaround for static_assert on uclibc-ng < 1.0.42
55IPROUTE2_CFLAGS = $(TARGET_CFLAGS) -Dstatic_assert=_Static_assert
56
57define IPROUTE2_BUILD_CMDS
58	$(TARGET_MAKE_ENV) LDFLAGS="$(TARGET_LDFLAGS)" \
59		CFLAGS="$(IPROUTE2_CFLAGS) -DXT_LIB_DIR=\\\"/usr/lib/xtables\\\"" \
60		CBUILD_CFLAGS="$(HOST_CFLAGS)" $(MAKE) V=1 LIBDB_LIBS=-lpthread \
61		DBM_INCLUDE="$(STAGING_DIR)/usr/include" \
62		SHARED_LIBS="$(if $(BR2_STATIC_LIBS),n,y)" -C $(@D)
63endef
64
65define IPROUTE2_INSTALL_TARGET_CMDS
66	$(TARGET_MAKE_ENV) DESTDIR="$(TARGET_DIR)" $(MAKE) -C $(@D) install
67endef
68
69$(eval $(generic-package))
70