1
0

Makefile 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=iproute2
  9. PKG_VERSION:=5.0.0
  10. PKG_RELEASE:=2.1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
  13. PKG_HASH:=df047302a39650ef832c07e8dab5df7a23218cd398bd310c8628e386161d20ba
  14. PKG_BUILD_PARALLEL:=1
  15. PKG_BUILD_DEPENDS:=iptables
  16. PKG_LICENSE:=GPL-2.0
  17. PKG_CPE_ID:=cpe:/a:iproute2_project:iproute2
  18. include $(INCLUDE_DIR)/kernel.mk
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/nls.mk
  21. define Package/iproute2/Default
  22. SECTION:=net
  23. CATEGORY:=Network
  24. URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
  25. SUBMENU:=Routing and Redirection
  26. MAINTAINER:=Russell Senior <russell@personaltelco.net>
  27. endef
  28. define Package/ip-tiny
  29. $(call Package/iproute2/Default)
  30. TITLE:=Routing control utility (Minimal)
  31. VARIANT:=tiny
  32. DEFAULT_VARIANT:=1
  33. PROVIDES:=ip
  34. ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
  35. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  36. endef
  37. define Package/ip-full
  38. $(call Package/iproute2/Default)
  39. TITLE:=Routing control utility (Full)
  40. VARIANT:=full
  41. PROVIDES:=ip
  42. ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
  43. DEPENDS:=+libnl-tiny +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +libcap
  44. endef
  45. define Package/tc
  46. $(call Package/iproute2/Default)
  47. TITLE:=Traffic control utility
  48. VARIANT:=tc
  49. PROVIDES:=tc
  50. DEPENDS:=+kmod-sched-core +libxtables +libelf +(PACKAGE_devlink||PACKAGE_rdma):libmnl +PACKAGE_ip-full:libcap
  51. endef
  52. define Package/genl
  53. $(call Package/iproute2/Default)
  54. TITLE:=General netlink utility frontend
  55. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
  56. endef
  57. define Package/ip-bridge
  58. $(call Package/iproute2/Default)
  59. TITLE:=Bridge configuration utility from iproute2
  60. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
  61. endef
  62. define Package/ss
  63. $(call Package/iproute2/Default)
  64. TITLE:=Socket statistics utility
  65. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
  66. endef
  67. define Package/nstat
  68. $(call Package/iproute2/Default)
  69. TITLE:=Network statistics utility
  70. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
  71. endef
  72. define Package/devlink
  73. $(call Package/iproute2/Default)
  74. TITLE:=Network devlink utility
  75. DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
  76. endef
  77. define Package/rdma
  78. $(call Package/iproute2/Default)
  79. TITLE:=Network rdma utility
  80. DEPENDS:=+libmnl +(PACKAGE_tc||PACKAGE_ip-full):libelf +PACKAGE_ip-full:libcap
  81. endef
  82. ifeq ($(BUILD_VARIANT),tiny)
  83. IP_CONFIG_TINY:=y
  84. endif
  85. ifeq ($(BUILD_VARIANT),full)
  86. HAVE_ELF:=y
  87. HAVE_CAP:=y
  88. endif
  89. ifeq ($(BUILD_VARIANT),tc)
  90. HAVE_ELF:=y
  91. SHARED_LIBS:=y
  92. endif
  93. ifdef CONFIG_PACKAGE_devlink
  94. HAVE_MNL:=y
  95. endif
  96. ifdef CONFIG_PACKAGE_rdma
  97. HAVE_MNL:=y
  98. endif
  99. define Build/Configure
  100. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-librecmc\";" \
  101. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  102. endef
  103. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  104. TARGET_LDFLAGS += -Wl,--gc-sections
  105. TARGET_CPPFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
  106. MAKE_FLAGS += \
  107. KERNEL_INCLUDE="$(LINUX_DIR)/user_headers/include" \
  108. SHARED_LIBS=$(SHARED_LIBS) \
  109. IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
  110. HAVE_ELF=$(HAVE_ELF) \
  111. HAVE_MNL=$(HAVE_MNL) \
  112. HAVE_CAP=$(HAVE_CAP) \
  113. IPT_LIB_DIR=/usr/lib/iptables \
  114. XT_LIB_DIR=/usr/lib/iptables \
  115. FPIC="$(FPIC)"
  116. define Build/Compile
  117. +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
  118. endef
  119. define Build/InstallDev
  120. $(INSTALL_DIR) $(1)/usr/include
  121. $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
  122. $(INSTALL_DIR) $(1)/usr/lib
  123. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  124. endef
  125. define Package/ip-tiny/install
  126. $(INSTALL_DIR) $(1)/usr/libexec
  127. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-tiny
  128. endef
  129. define Package/ip-full/install
  130. $(INSTALL_DIR) $(1)/usr/libexec
  131. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-full
  132. endef
  133. define Package/tc/install
  134. $(INSTALL_DIR) $(1)/usr/sbin
  135. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
  136. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  137. $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
  138. ifeq ($(SHARED_LIBS),y)
  139. $(INSTALL_DIR) $(1)/usr/lib/tc
  140. $(CP) $(PKG_BUILD_DIR)/tc/*.so $(1)/usr/lib/tc
  141. endif
  142. endef
  143. define Package/genl/install
  144. $(INSTALL_DIR) $(1)/usr/sbin
  145. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  146. endef
  147. define Package/ip-bridge/install
  148. $(INSTALL_DIR) $(1)/usr/sbin
  149. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
  150. endef
  151. define Package/ss/install
  152. $(INSTALL_DIR) $(1)/usr/sbin
  153. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
  154. endef
  155. define Package/nstat/install
  156. $(INSTALL_DIR) $(1)/usr/sbin
  157. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
  158. endef
  159. define Package/devlink/install
  160. $(INSTALL_DIR) $(1)/usr/sbin
  161. $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
  162. endef
  163. define Package/rdma/install
  164. $(INSTALL_DIR) $(1)/usr/sbin
  165. $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
  166. endef
  167. $(eval $(call BuildPackage,ip-tiny))
  168. $(eval $(call BuildPackage,ip-full))
  169. $(eval $(call BuildPackage,tc))
  170. $(eval $(call BuildPackage,genl))
  171. $(eval $(call BuildPackage,ip-bridge))
  172. $(eval $(call BuildPackage,ss))
  173. $(eval $(call BuildPackage,nstat))
  174. $(eval $(call BuildPackage,devlink))
  175. $(eval $(call BuildPackage,rdma))