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:=@KERNEL/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
64 $(call Package/iproute2/Default)
65 TITLE:=Network statistics utility
68 ifeq ($(BUILD_VARIANT),tiny)
72 define Build/Configure
73 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
74 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
75 $(PKG_BUILD_DIR)/Makefile
76 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
77 $(PKG_BUILD_DIR)/Makefile
78 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-lede\";" \
79 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
82 TARGET_CFLAGS += -DHAVE_SETNS
83 TARGET_CFLAGS += -ffunction-sections -fdata-sections
86 EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
87 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
89 LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
90 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
94 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
97 define Build/InstallDev
98 $(INSTALL_DIR) $(1)/usr/include
99 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
100 $(INSTALL_DIR) $(1)/usr/lib
101 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
104 define Package/ip/install
105 $(INSTALL_DIR) $(1)/usr/bin
106 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/bin/
109 define Package/ip-full/install
110 $(INSTALL_DIR) $(1)/usr/sbin
111 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
114 define Package/tc/install
115 $(INSTALL_DIR) $(1)/usr/sbin
116 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
117 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
118 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
121 define Package/genl/install
122 $(INSTALL_DIR) $(1)/usr/sbin
123 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
126 define Package/ip-bridge/install
127 $(INSTALL_DIR) $(1)/usr/sbin
128 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
131 define Package/ss/install
132 $(INSTALL_DIR) $(1)/usr/sbin
133 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
136 define Package/nstat/install
137 $(INSTALL_DIR) $(1)/usr/sbin
138 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
141 $(eval $(call BuildPackage,ip))
142 $(eval $(call BuildPackage,ip-full))
143 $(eval $(call BuildPackage,tc))
144 $(eval $(call BuildPackage,genl))
145 $(eval $(call BuildPackage,ip-bridge))
146 $(eval $(call BuildPackage,ss))
147 $(eval $(call BuildPackage,nstat))