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_HASH:=c8adaa6a40f888476b23acb283cfa30c0dd55f07b5aa20663ed5ba2ef1f6fda8
18 PKG_BUILD_DEPENDS:=iptables
20 PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
22 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
24 include $(INCLUDE_DIR)/kernel.mk
25 include $(INCLUDE_DIR)/package.mk
26 include $(INCLUDE_DIR)/nls.mk
28 define Package/iproute2/Default
31 URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
32 SUBMENU:=Routing and Redirection
33 MAINTAINER:=Russell Senior <russell@personaltelco.net>
36 define Package/ip-tiny
37 $(call Package/iproute2/Default)
38 TITLE:=Routing control utility (Minimal)
41 ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
42 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
45 define Package/ip-full
46 $(call Package/iproute2/Default)
47 TITLE:=Routing control utility (Full)
50 ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
51 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
55 $(call Package/iproute2/Default)
56 TITLE:=Traffic control utility
57 DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl
61 $(call Package/iproute2/Default)
62 TITLE:=General netlink utility frontend
63 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
66 define Package/ip-bridge
67 $(call Package/iproute2/Default)
68 TITLE:=Bridge configuration utility from iproute2
69 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
73 $(call Package/iproute2/Default)
74 TITLE:=Socket statistics utility
75 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
79 $(call Package/iproute2/Default)
80 TITLE:=Network statistics utility
81 DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
84 define Package/devlink
85 $(call Package/iproute2/Default)
86 TITLE:=Network devlink utility
91 $(call Package/iproute2/Default)
92 TITLE:=Network rdma utility
96 ifeq ($(BUILD_VARIANT),tiny)
100 ifdef CONFIG_PACKAGE_devlink
104 ifdef CONFIG_PACKAGE_rdma
108 define Build/Configure
109 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
110 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
113 TARGET_CFLAGS += -ffunction-sections -fdata-sections
114 TARGET_LDFLAGS += -Wl,--gc-sections
115 TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
118 KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
120 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
121 HAVE_MNL=$(HAVE_MNL) \
122 IPT_LIB_DIR=/usr/lib/iptables \
123 XT_LIB_DIR=/usr/lib/iptables \
127 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
130 define Build/InstallDev
131 $(INSTALL_DIR) $(1)/usr/include
132 $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
133 $(INSTALL_DIR) $(1)/usr/lib
134 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
137 define Package/ip-tiny/install
138 $(INSTALL_DIR) $(1)/usr/libexec
139 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-tiny
142 define Package/ip-full/install
143 $(INSTALL_DIR) $(1)/usr/libexec
144 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-full
147 define Package/tc/install
148 $(INSTALL_DIR) $(1)/usr/sbin
149 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
150 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
151 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
154 define Package/genl/install
155 $(INSTALL_DIR) $(1)/usr/sbin
156 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
159 define Package/ip-bridge/install
160 $(INSTALL_DIR) $(1)/usr/sbin
161 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
164 define Package/ss/install
165 $(INSTALL_DIR) $(1)/usr/sbin
166 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
169 define Package/nstat/install
170 $(INSTALL_DIR) $(1)/usr/sbin
171 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
174 define Package/devlink/install
175 $(INSTALL_DIR) $(1)/usr/sbin
176 $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
179 define Package/rdma/install
180 $(INSTALL_DIR) $(1)/usr/sbin
181 $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
184 $(eval $(call BuildPackage,ip-tiny))
185 $(eval $(call BuildPackage,ip-full))
186 $(eval $(call BuildPackage,tc))
187 $(eval $(call BuildPackage,genl))
188 $(eval $(call BuildPackage,ip-bridge))
189 $(eval $(call BuildPackage,ss))
190 $(eval $(call BuildPackage,nstat))
191 $(eval $(call BuildPackage,devlink))
192 $(eval $(call BuildPackage,rdma))