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:=d762653ec3e1ab0d4a9689e169ca184f
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)
43 $(call Package/iproute2/Default)
44 TITLE:=Traffic control utility
45 DEPENDS:=+kmod-sched-core
49 $(call Package/iproute2/Default)
50 TITLE:=General netlink utility frontend
53 define Package/ip-bridge
54 $(call Package/iproute2/Default)
55 TITLE:=Bridge configuration utility from iproute2
59 $(call Package/iproute2/Default)
60 TITLE:=Socket statistics utility
63 ifeq ($(BUILD_VARIANT),tiny)
67 define Build/Configure
68 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
69 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
70 $(PKG_BUILD_DIR)/Makefile
71 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
72 $(PKG_BUILD_DIR)/Makefile
73 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-lede\";" \
74 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
77 TARGET_CFLAGS += -DHAVE_SETNS
78 TARGET_CFLAGS += -ffunction-sections -fdata-sections
81 EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
82 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
84 LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
85 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
89 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
92 define Build/InstallDev
93 $(INSTALL_DIR) $(1)/usr/include
94 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
95 $(INSTALL_DIR) $(1)/usr/lib
96 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
99 define Package/ip/install
100 $(INSTALL_DIR) $(1)/usr/bin
101 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/bin/
104 define Package/ip-full/install
105 $(INSTALL_DIR) $(1)/usr/sbin
106 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
109 define Package/tc/install
110 $(INSTALL_DIR) $(1)/usr/sbin
111 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
112 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
113 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
116 define Package/genl/install
117 $(INSTALL_DIR) $(1)/usr/sbin
118 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
121 define Package/ip-bridge/install
122 $(INSTALL_DIR) $(1)/usr/sbin
123 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
126 define Package/ss/install
127 $(INSTALL_DIR) $(1)/usr/sbin
128 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
131 $(eval $(call BuildPackage,ip))
132 $(eval $(call BuildPackage,ip-full))
133 $(eval $(call BuildPackage,tc))
134 $(eval $(call BuildPackage,genl))
135 $(eval $(call BuildPackage,ip-bridge))
136 $(eval $(call BuildPackage,ss))