packages: some (e)glibc fixes after r44701
[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:=3.19.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:=237083a1e3c388cde7a115a5724dc72a
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/conffiles
43 /etc/iproute2/rt_tables
44 endef
45
46 define Package/ip-$(BUILD_VARIANT)/conffiles
47 $(Package/ip/conffiles)
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 ifeq ($(BUILD_VARIANT),tiny)
72 IP_CONFIG_TINY:=y
73 endif
74
75 define Build/Configure
76 $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
77 $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
78 $(PKG_BUILD_DIR)/Makefile
79 $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
80 $(PKG_BUILD_DIR)/Makefile
81 echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
82 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
83 endef
84
85 ifdef CONFIG_USE_GLIBC
86 TARGET_CFLAGS += -DHAVE_SETNS
87 endif
88 ifdef CONFIG_USE_MUSL
89 TARGET_CFLAGS += -DHAVE_SETNS
90 endif
91
92 TARGET_CFLAGS += -ffunction-sections -fdata-sections
93
94 MAKE_FLAGS += \
95 EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
96 KERNEL_INCLUDE="$(LINUX_DIR)/include" \
97 SHARED_LIBS="" \
98 LDFLAGS="-Wl,--gc-sections" \
99 IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
100 FPIC="$(FPIC)"
101
102 define Build/Compile
103 +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
104 endef
105
106 define Build/InstallDev
107 $(INSTALL_DIR) $(1)/usr/include
108 $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
109 $(INSTALL_DIR) $(1)/usr/lib
110 $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
111 endef
112
113 define Package/ip/install
114 $(INSTALL_DIR) $(1)/usr/sbin
115 $(INSTALL_DIR) $(1)/etc/iproute2
116 $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
117 $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
118 endef
119
120 define Package/ip-$(BUILD_VARIANT)/install
121 $(Package/ip/install)
122 endef
123
124 define Package/tc/install
125 $(INSTALL_DIR) $(1)/usr/sbin
126 $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
127 $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
128 $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
129 endef
130
131 define Package/genl/install
132 $(INSTALL_DIR) $(1)/usr/sbin
133 $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
134 endef
135
136 define Package/ip-bridge/install
137 $(INSTALL_DIR) $(1)/usr/sbin
138 $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
139 endef
140
141 define Package/ss/install
142 $(INSTALL_DIR) $(1)/usr/sbin
143 $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
144 endef
145
146 $(eval $(call BuildPackage,ip))
147 $(eval $(call BuildPackage,ip-full))
148 $(eval $(call BuildPackage,tc))
149 $(eval $(call BuildPackage,genl))
150 $(eval $(call BuildPackage,ip-bridge))
151 $(eval $(call BuildPackage,ss))