a8f4400604af8cbbd4271b2b5a9a87884749da53
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / iproute2 / iproute2.mk
1 ################################################################################
2 #
3 # iproute2
4 #
5 ################################################################################
6
7 IPROUTE2_VERSION = 4.0.0
8 IPROUTE2_SOURCE = iproute2-$(IPROUTE2_VERSION).tar.xz
9 IPROUTE2_SITE = $(BR2_KERNEL_MIRROR)/linux/utils/net/iproute2
10 IPROUTE2_DEPENDENCIES = host-bison host-flex host-pkgconf
11 IPROUTE2_LICENSE = GPLv2
12 IPROUTE2_LICENSE_FILES = COPYING
13
14 # If both iproute2 and busybox are selected, make certain we win
15 # the fight over who gets to have their utils actually installed.
16 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
17 IPROUTE2_DEPENDENCIES += busybox
18 endif
19
20 # If we've got iptables enable xtables support for tc
21 ifeq ($(BR2_PACKAGE_IPTABLES)x$(BR2_STATIC_LIBS),yx)
22 IPROUTE2_DEPENDENCIES += iptables
23 define IPROUTE2_WITH_IPTABLES
24         # Makefile is busted so it never passes IPT_LIB_DIR properly
25         $(SED) "s/-DIPT/-DXT/" $(IPROUTE2_DIR)/tc/Makefile
26 endef
27 else
28 define IPROUTE2_WITH_IPTABLES
29         # em_ipset needs xtables, but configure misdetects it
30         echo "TC_CONFIG_IPSET:=n" >>$(IPROUTE2_DIR)/Config
31         echo "TC_CONFIG_XT:=n" >>$(IPROUTE2_DIR)/Config
32 endef
33 endif
34
35 # arpd needs BerkeleyDB and links against pthread
36 ifeq ($(BR2_PACKAGE_BERKELEYDB_COMPAT185)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
37 IPROUTE2_DEPENDENCIES += berkeleydb
38 else
39 define IPROUTE2_DISABLE_ARPD
40         $(SED) "/^TARGETS=/s: arpd : :" $(IPROUTE2_DIR)/misc/Makefile
41 endef
42 endif
43
44 # ifcfg needs bash
45 ifeq ($(BR2_PACKAGE_BASH),)
46 define IPROUTE2_REMOVE_IFCFG
47         rm -f $(TARGET_DIR)/sbin/ifcfg
48 endef
49 endif
50
51 define IPROUTE2_CONFIGURE_CMDS
52         $(SED) 's/gcc/$$CC $$CFLAGS/g' $(@D)/configure
53         cd $(@D) && $(TARGET_CONFIGURE_OPTS) ./configure
54         $(IPROUTE2_DISABLE_ARPD)
55         $(IPROUTE2_WITH_IPTABLES)
56 endef
57
58 define IPROUTE2_BUILD_CMDS
59         $(SED) 's/$$(CCOPTS)//' $(@D)/netem/Makefile
60         $(TARGET_MAKE_ENV) LDFLAGS="$(TARGET_LDFLAGS)" $(MAKE) \
61                 DBM_INCLUDE="$(STAGING_DIR)/usr/include" \
62                 CCOPTS="$(TARGET_CFLAGS) -D_GNU_SOURCE" \
63                 SHARED_LIBS="$(if $(BR2_STATIC_LIBS),n,y)" -C $(@D)
64 endef
65
66 define IPROUTE2_INSTALL_TARGET_CMDS
67         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR="$(TARGET_DIR)" \
68                 SBINDIR=/sbin \
69                 DOCDIR=/usr/share/doc/iproute2-$(IPROUTE2_VERSION) \
70                 MANDIR=/usr/share/man install
71         $(IPROUTE2_REMOVE_IFCFG)
72 endef
73
74 $(eval $(generic-package))