iproute2: re-enable PIC, it is only applied to libnetlink.a and required for collectd
[15.05/openwrt.git] / package / network / utils / iproute2 / Makefile
1 #
2 # Copyright (C) 2006-2014 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.15.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:=5b1711c9d16071959052e369a2682d77
17 PKG_BUILD_PARALLEL:=1
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/iproute2/Default
24   TITLE:=Routing control utility ($(2))
25   SECTION:=net
26   CATEGORY:=Network
27   URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
28   SUBMENU:=Routing and Redirection
29   MAINTAINER:=Russell Senior <russell@personaltelco.net>
30   DEPENDS:= +libnl-tiny
31   VARIANT:=$(1)
32 endef
33
34 Package/ip=$(call Package/iproute2/Default,tiny,Minimal)
35 Package/ip-full=$(call Package/iproute2/Default,full,Full)
36
37 define Package/ip/conffiles
38 /etc/iproute2/rt_tables
39 endef
40
41 define Package/ip-$(BUILD_VARIANT)/conffiles
42 $(Package/ip/conffiles)
43 endef
44
45 define Package/tc
46 $(call Package/iproute2/Default)
47   TITLE:=Traffic control utility
48   DEPENDS:=+kmod-sched-core
49 endef
50
51 define Package/genl
52 $(call Package/iproute2/Default)
53   TITLE:=General netlink utility frontend
54 endef
55
56 define Package/ss
57 $(call Package/iproute2/Default)
58   TITLE:=Socket statistics utility
59 endef
60
61 ifeq ($(BUILD_VARIANT),tiny)
62   IP_CONFIG_TINY:=y
63 endif
64
65 define Build/Configure
66         $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
67         $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
68                 $(PKG_BUILD_DIR)/Makefile
69         $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
70                 $(PKG_BUILD_DIR)/Makefile
71         echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
72                 > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
73 endef
74
75 ifdef CONFIG_USE_EGLIBC
76   ifndef CONFIG_EGLIBC_VERSION_2_13
77     TARGET_CFLAGS += -DHAVE_SETNS
78   endif
79 endif
80
81 TARGET_CFLAGS += -ffunction-sections -fdata-sections
82
83 MAKE_FLAGS += \
84         EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
85         KERNEL_INCLUDE="$(LINUX_DIR)/include" \
86         SHARED_LIBS="" \
87         LDFLAGS="-Wl,--gc-sections" \
88         IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
89         FPIC="$(FPIC)"
90
91 define Build/Compile
92         +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
93 endef
94
95 define Build/InstallDev
96         $(INSTALL_DIR) $(1)/usr/include
97         $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
98         $(INSTALL_DIR) $(1)/usr/lib
99         $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
100 endef
101
102 define Package/ip/install
103         $(INSTALL_DIR) $(1)/usr/sbin
104         $(INSTALL_DIR) $(1)/etc/iproute2
105         $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
106         $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
107 endef
108
109 define Package/ip-$(BUILD_VARIANT)/install
110         $(Package/ip/install)
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/ss/install
126         $(INSTALL_DIR) $(1)/usr/sbin
127         $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
128 endef
129
130 $(eval $(call BuildPackage,ip))
131 $(eval $(call BuildPackage,ip-full))
132 $(eval $(call BuildPackage,tc))
133 $(eval $(call BuildPackage,genl))
134 $(eval $(call BuildPackage,ss))