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
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=http://kernel.org/pub/linux/utils/net/iproute2/
16 PKG_MD5SUM:=6f6ad51a00007880460e103367b16057
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
22 include $(INCLUDE_DIR)/package.mk
24 define Package/iproute2/Default
25 TITLE:=Routing control utility ($(2))
28 URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
29 SUBMENU:=Routing and Redirection
30 MAINTAINER:=Russell Senior <russell@personaltelco.net>
36 $(call Package/iproute2/Default,tiny,Minimal)
40 Package/ip-full=$(call Package/iproute2/Default,full,Full)
42 define Package/ip/conffiles
43 /etc/iproute2/rt_tables
46 define Package/ip-$(BUILD_VARIANT)/conffiles
47 $(Package/ip/conffiles)
51 $(call Package/iproute2/Default)
52 TITLE:=Traffic control utility
53 DEPENDS:=+kmod-sched-core
57 $(call Package/iproute2/Default)
58 TITLE:=General netlink utility frontend
61 define Package/ip-bridge
62 $(call Package/iproute2/Default)
63 TITLE:=Bridge configuration utility from iproute2
67 $(call Package/iproute2/Default)
68 TITLE:=Socket statistics utility
71 ifeq ($(BUILD_VARIANT),tiny)
75 define Build/Configure
76 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
77 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
78 $(PKG_BUILD_DIR)/Makefile
79 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
80 $(PKG_BUILD_DIR)/Makefile
81 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
82 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
85 ifdef CONFIG_USE_EGLIBC
86 ifndef CONFIG_EGLIBC_VERSION_2_13
87 TARGET_CFLAGS += -DHAVE_SETNS
91 TARGET_CFLAGS += -DHAVE_SETNS
94 TARGET_CFLAGS += -ffunction-sections -fdata-sections
97 EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
98 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
100 LDFLAGS="-Wl,--gc-sections" \
101 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
105 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
108 define Build/InstallDev
109 $(INSTALL_DIR) $(1)/usr/include
110 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
111 $(INSTALL_DIR) $(1)/usr/lib
112 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
115 define Package/ip/install
116 $(INSTALL_DIR) $(1)/usr/sbin
117 $(INSTALL_DIR) $(1)/etc/iproute2
118 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
119 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
122 define Package/ip-$(BUILD_VARIANT)/install
123 $(Package/ip/install)
126 define Package/tc/install
127 $(INSTALL_DIR) $(1)/usr/sbin
128 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
129 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
130 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
133 define Package/genl/install
134 $(INSTALL_DIR) $(1)/usr/sbin
135 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
138 define Package/ip-bridge/install
139 $(INSTALL_DIR) $(1)/usr/sbin
140 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
143 define Package/ss/install
144 $(INSTALL_DIR) $(1)/usr/sbin
145 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
148 $(eval $(call BuildPackage,ip))
149 $(eval $(call BuildPackage,ip-full))
150 $(eval $(call BuildPackage,tc))
151 $(eval $(call BuildPackage,genl))
152 $(eval $(call BuildPackage,ip-bridge))
153 $(eval $(call BuildPackage,ss))