iproute2: update to 4.3.0
[openwrt/staging/mkresin.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.3.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
15 PKG_SOURCE_URL:=http://kernel.org/pub/linux/utils/net/iproute2/
16 PKG_MD5SUM:=1a2bbb80cfc7ab3f3e987e18b3207c2f
17 PKG_BUILD_PARALLEL:=1
18 PKG_LICENSE:=GPL-2.0
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/iproute2/Default
25 TITLE:=Routing control utility ($(2))
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 VARIANT:=$(1)
33 endef
34
35 define Package/ip
36 $(call Package/iproute2/Default,tiny,Minimal)
37 CONFLICTS:=ip-full
38 endef
39
40 Package/ip-full=$(call Package/iproute2/Default,full,Full)
41
42 define Package/ip-$(BUILD_VARIANT)/conffiles
43 $(Package/ip/conffiles)
44 endef
45
46 define Package/tc
47 $(call Package/iproute2/Default)
48 TITLE:=Traffic control utility
49 DEPENDS:=+kmod-sched-core
50 endef
51
52 define Package/genl
53 $(call Package/iproute2/Default)
54 TITLE:=General netlink utility frontend
55 endef
56
57 define Package/ip-bridge
58 $(call Package/iproute2/Default)
59 TITLE:=Bridge configuration utility from iproute2
60 endef
61
62 define Package/ss
63 $(call Package/iproute2/Default)
64 TITLE:=Socket statistics utility
65 endef
66
67 ifeq ($(BUILD_VARIANT),tiny)
68 IP_CONFIG_TINY:=y
69 endif
70
71 define Build/Configure
72 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
73 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
74 $(PKG_BUILD_DIR)/Makefile
75 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
76 $(PKG_BUILD_DIR)/Makefile
77 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
78 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
79 endef
80
81 TARGET_CFLAGS += -DHAVE_SETNS
82 TARGET_CFLAGS += -ffunction-sections -fdata-sections
83
84 MAKE_FLAGS += \
85 EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
86 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
87 SHARED_LIBS="" \
88 LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
89 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
90 FPIC="$(FPIC)"
91
92 define Build/Compile
93 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
94 endef
95
96 define Build/InstallDev
97 $(INSTALL_DIR) $(1)/usr/include
98 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
99 $(INSTALL_DIR) $(1)/usr/lib
100 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
101 endef
102
103 define Package/ip/install
104 $(INSTALL_DIR) $(1)/usr/bin
105 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/bin/
106 endef
107
108 define Package/ip-full/install
109 $(INSTALL_DIR) $(1)/usr/sbin
110 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
111 endef
112
113 define Package/tc/install
114 $(INSTALL_DIR) $(1)/usr/sbin
115 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
116 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
117 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
118 endef
119
120 define Package/genl/install
121 $(INSTALL_DIR) $(1)/usr/sbin
122 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
123 endef
124
125 define Package/ip-bridge/install
126 $(INSTALL_DIR) $(1)/usr/sbin
127 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
128 endef
129
130 define Package/ss/install
131 $(INSTALL_DIR) $(1)/usr/sbin
132 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
133 endef
134
135 $(eval $(call BuildPackage,ip))
136 $(eval $(call BuildPackage,ip-full))
137 $(eval $(call BuildPackage,tc))
138 $(eval $(call BuildPackage,genl))
139 $(eval $(call BuildPackage,ip-bridge))
140 $(eval $(call BuildPackage,ss))