iproute2: bump to 4.13
[oweals/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.13.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:=9cfb81edf8c8509e03daa77cf62aead01c4a827132f6c506578f94cc19415c50
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 endef
32
33 define Package/ip-tiny
34 $(call Package/iproute2/Default)
35  TITLE:=Routing control utility (Minimal)
36  VARIANT:=tiny
37  PROVIDES:=ip
38  ALTERNATIVES:=200:/sbin/ip:/sbin/ip-tiny
39  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
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  DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
49 endef
50
51 define Package/tc
52 $(call Package/iproute2/Default)
53   TITLE:=Traffic control utility
54   DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl
55 endef
56
57 define Package/genl
58 $(call Package/iproute2/Default)
59   TITLE:=General netlink utility frontend
60   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
61 endef
62
63 define Package/ip-bridge
64 $(call Package/iproute2/Default)
65   TITLE:=Bridge configuration utility from iproute2
66   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
67 endef
68
69 define Package/ss
70 $(call Package/iproute2/Default)
71   TITLE:=Socket statistics utility
72   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
73 endef
74
75 define Package/nstat
76 $(call Package/iproute2/Default)
77   TITLE:=Network statistics utility
78   DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
79 endef
80
81 define Package/devlink
82 $(call Package/iproute2/Default)
83   TITLE:=Network devlink utility
84   DEPENDS:=+libmnl
85 endef
86
87 define Package/rdma
88 $(call Package/iproute2/Default)
89   TITLE:=Network rdma utility
90   DEPENDS:=+libmnl
91 endef
92
93 ifeq ($(BUILD_VARIANT),tiny)
94   IP_CONFIG_TINY:=y
95 endif
96
97 ifdef CONFIG_PACKAGE_devlink
98   HAVE_MNL:=y
99 endif
100
101 ifdef CONFIG_PACKAGE_rdma
102   HAVE_MNL:=y
103 endif
104
105 define Build/Configure
106         $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
107         $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
108                 $(PKG_BUILD_DIR)/Makefile
109         $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
110                 $(PKG_BUILD_DIR)/Makefile
111         echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-lede\";" \
112                 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
113 endef
114
115 TARGET_CFLAGS += -ffunction-sections -fdata-sections
116
117 MAKE_FLAGS += \
118         EXTRA_CCOPTS="-I$(STAGING_DIR)/usr/include/libnl-tiny" \
119         KERNEL_INCLUDE="$(LINUX_DIR)/include" \
120         SHARED_LIBS="" \
121         LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
122         IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
123         HAVE_MNL=$(HAVE_MNL) \
124         IPT_LIB_DIR=/usr/lib/iptables \
125         FPIC="$(FPIC)"
126
127 define Build/Compile
128         +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
129 endef
130
131 define Build/InstallDev
132         $(INSTALL_DIR) $(1)/usr/include
133         $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/
134         $(INSTALL_DIR) $(1)/usr/lib
135         $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
136 endef
137
138 define Package/ip-tiny/install
139         $(INSTALL_DIR) $(1)/sbin
140         $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/sbin/ip-tiny
141 endef
142
143 define Package/ip-full/install
144         $(INSTALL_DIR) $(1)/sbin
145         $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/sbin/ip-full
146 endef
147
148 define Package/tc/install
149         $(INSTALL_DIR) $(1)/usr/sbin
150         $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
151         $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
152         $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
153 endef
154
155 define Package/genl/install
156         $(INSTALL_DIR) $(1)/usr/sbin
157         $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
158 endef
159
160 define Package/ip-bridge/install
161         $(INSTALL_DIR) $(1)/usr/sbin
162         $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
163 endef
164
165 define Package/ss/install
166         $(INSTALL_DIR) $(1)/usr/sbin
167         $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
168 endef
169
170 define Package/nstat/install
171         $(INSTALL_DIR) $(1)/usr/sbin
172         $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
173 endef
174
175 define Package/devlink/install
176         $(INSTALL_DIR) $(1)/usr/sbin
177         $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
178 endef
179
180 define Package/rdma/install
181         $(INSTALL_DIR) $(1)/usr/sbin
182         $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
183 endef
184
185 $(eval $(call BuildPackage,ip-tiny))
186 $(eval $(call BuildPackage,ip-full))
187 $(eval $(call BuildPackage,tc))
188 $(eval $(call BuildPackage,genl))
189 $(eval $(call BuildPackage,ip-bridge))
190 $(eval $(call BuildPackage,ss))
191 $(eval $(call BuildPackage,nstat))
192 $(eval $(call BuildPackage,devlink))
193 $(eval $(call BuildPackage,rdma))