2 # Copyright (C) 2006-2014 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:=5b1711c9d16071959052e369a2682d77
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
21 include $(INCLUDE_DIR)/package.mk
23 define Package/iproute2/Default
24 TITLE:=Routing control utility ($(2))
27 URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
28 SUBMENU:=Routing and Redirection
29 MAINTAINER:=Russell Senior <russell@personaltelco.net>
34 Package/ip=$(call Package/iproute2/Default,tiny,Minimal)
35 Package/ip-full=$(call Package/iproute2/Default,full,Full)
37 define Package/ip/conffiles
38 /etc/iproute2/rt_tables
41 define Package/ip-$(BUILD_VARIANT)/conffiles
42 $(Package/ip/conffiles)
46 $(call Package/iproute2/Default)
47 TITLE:=Traffic control utility
48 DEPENDS:=+kmod-sched-core
52 $(call Package/iproute2/Default)
53 TITLE:=General netlink utility frontend
57 $(call Package/iproute2/Default)
58 TITLE:=Socket statistics utility
61 ifeq ($(BUILD_VARIANT),tiny)
65 define Build/Configure
66 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
67 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
68 $(PKG_BUILD_DIR)/Makefile
69 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
70 $(PKG_BUILD_DIR)/Makefile
71 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
72 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
75 ifdef CONFIG_USE_EGLIBC
76 ifndef CONFIG_EGLIBC_VERSION_2_13
77 TARGET_CFLAGS += -DHAVE_SETNS
81 TARGET_CFLAGS += -ffunction-sections -fdata-sections
84 EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
85 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
87 LDFLAGS="-Wl,--gc-sections" \
88 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
92 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
95 define Build/InstallDev
96 $(INSTALL_DIR) $(1)/usr/include
97 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
98 $(INSTALL_DIR) $(1)/usr/lib
99 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
102 define Package/ip/install
103 $(INSTALL_DIR) $(1)/usr/sbin
104 $(INSTALL_DIR) $(1)/etc/iproute2
105 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
106 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
109 define Package/ip-$(BUILD_VARIANT)/install
110 $(Package/ip/install)
113 define Package/tc/install
114 $(INSTALL_DIR) $(1)/usr/sbin
115 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
116 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
117 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
120 define Package/genl/install
121 $(INSTALL_DIR) $(1)/usr/sbin
122 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
125 define Package/ss/install
126 $(INSTALL_DIR) $(1)/usr/sbin
127 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
130 $(eval $(call BuildPackage,ip))
131 $(eval $(call BuildPackage,ip-full))
132 $(eval $(call BuildPackage,tc))
133 $(eval $(call BuildPackage,genl))
134 $(eval $(call BuildPackage,ss))