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