iproute2: bump to 4.11
[openwrt/openwrt.git] / package / network / utils / iproute2 / Makefile
1 #
2 # Copyright (C) 2006-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=iproute2
11 PKG_VERSION:=4.11.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
16 PKG_HASH:=72671028bda696d0cb8f48ec8e702581c3a501caeed33eec3a81d7041cbc8026
17 PKG_BUILD_PARALLEL:=1
18 PKG_BUILD_DEPENDS:=iptables
19 PKG_LICENSE:=GPL-2.0
20
21 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/iproute2/Default
26 SECTION:=net
27 CATEGORY:=Network
28 URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
29 SUBMENU:=Routing and Redirection
30 MAINTAINER:=Russell Senior <russell@personaltelco.net>
31 DEPENDS:= +libnl-tiny
32 endef
33
34 define Package/ip-tiny
35 $(call Package/iproute2/Default)
36 TITLE:=Routing control utility (Minimal)
37 VARIANT:=tiny
38 PROVIDES:=ip
39 ALTERNATIVES:=200:/sbin/ip:/sbin/ip-tiny
40 endef
41
42 define Package/ip-full
43 $(call Package/iproute2/Default)
44 TITLE:=Routing control utility (Full)
45 VARIANT:=full
46 PROVIDES:=ip
47 ALTERNATIVES:=300:/sbin/ip:/sbin/ip-full
48 endef
49
50 define Package/tc
51 $(call Package/iproute2/Default)
52 TITLE:=Traffic control utility
53 DEPENDS:=+kmod-sched-core
54 endef
55
56 define Package/genl
57 $(call Package/iproute2/Default)
58 TITLE:=General netlink utility frontend
59 endef
60
61 define Package/ip-bridge
62 $(call Package/iproute2/Default)
63 TITLE:=Bridge configuration utility from iproute2
64 endef
65
66 define Package/ss
67 $(call Package/iproute2/Default)
68 TITLE:=Socket statistics utility
69 endef
70
71 define Package/nstat
72 $(call Package/iproute2/Default)
73 TITLE:=Network statistics utility
74 endef
75
76 define Package/devlink
77 $(call Package/iproute2/Default)
78 TITLE:=Network devlink utility
79 DEPENDS:=+libmnl
80 endef
81
82 ifeq ($(BUILD_VARIANT),tiny)
83 IP_CONFIG_TINY:=y
84 endif
85
86 define Build/Configure
87 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
88 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
89 $(PKG_BUILD_DIR)/Makefile
90 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
91 $(PKG_BUILD_DIR)/Makefile
92 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-lede\";" \
93 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
94 endef
95
96 TARGET_CFLAGS += -ffunction-sections -fdata-sections
97
98 MAKE_FLAGS += \
99 EXTRA_CCOPTS="-I$(STAGING_DIR)/usr/include/libnl-tiny" \
100 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
101 SHARED_LIBS="" \
102 LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
103 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
104 IPT_LIB_DIR=/usr/lib/iptables \
105 FPIC="$(FPIC)"
106
107 define Build/Compile
108 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
109 endef
110
111 define Build/InstallDev
112 $(INSTALL_DIR) $(1)/usr/include
113 $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/
114 $(INSTALL_DIR) $(1)/usr/lib
115 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
116 endef
117
118 define Package/ip-tiny/install
119 $(INSTALL_DIR) $(1)/sbin
120 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/sbin/ip-tiny
121 endef
122
123 define Package/ip-full/install
124 $(INSTALL_DIR) $(1)/sbin
125 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/sbin/ip-full
126 endef
127
128 define Package/tc/install
129 $(INSTALL_DIR) $(1)/usr/sbin
130 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
131 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
132 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
133 endef
134
135 define Package/genl/install
136 $(INSTALL_DIR) $(1)/usr/sbin
137 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
138 endef
139
140 define Package/ip-bridge/install
141 $(INSTALL_DIR) $(1)/usr/sbin
142 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
143 endef
144
145 define Package/ss/install
146 $(INSTALL_DIR) $(1)/usr/sbin
147 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
148 endef
149
150 define Package/nstat/install
151 $(INSTALL_DIR) $(1)/usr/sbin
152 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
153 endef
154
155 define Package/devlink/install
156 $(INSTALL_DIR) $(1)/usr/sbin
157 $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
158 endef
159
160 $(eval $(call BuildPackage,ip-tiny))
161 $(eval $(call BuildPackage,ip-full))
162 $(eval $(call BuildPackage,tc))
163 $(eval $(call BuildPackage,genl))
164 $(eval $(call BuildPackage,ip-bridge))
165 $(eval $(call BuildPackage,ss))
166 $(eval $(call BuildPackage,nstat))
167 $(eval $(call BuildPackage,devlink))