Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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:=4.19.0
  10. PKG_RELEASE:=6
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
  13. PKG_HASH:=d9ec5ca1f47d8a85416fa26e7dc1cbf5d067640eb60e90bdc1c7e5bdc6a29984
  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. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  19. include $(INCLUDE_DIR)/kernel.mk
  20. include $(INCLUDE_DIR)/package.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. PROVIDES:=ip
  33. ALTERNATIVES:=200:/sbin/ip:/usr/libexec/ip-tiny
  34. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  35. endef
  36. define Package/ip-full
  37. $(call Package/iproute2/Default)
  38. TITLE:=Routing control utility (Full)
  39. VARIANT:=full
  40. PROVIDES:=ip
  41. ALTERNATIVES:=300:/sbin/ip:/usr/libexec/ip-full
  42. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  43. endef
  44. define Package/tc
  45. $(call Package/iproute2/Default)
  46. TITLE:=Traffic control utility
  47. DEPENDS:=+kmod-sched-core +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  48. endef
  49. define Package/genl
  50. $(call Package/iproute2/Default)
  51. TITLE:=General netlink utility frontend
  52. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  53. endef
  54. define Package/ip-bridge
  55. $(call Package/iproute2/Default)
  56. TITLE:=Bridge configuration utility from iproute2
  57. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  58. endef
  59. define Package/ss
  60. $(call Package/iproute2/Default)
  61. TITLE:=Socket statistics utility
  62. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  63. endef
  64. define Package/nstat
  65. $(call Package/iproute2/Default)
  66. TITLE:=Network statistics utility
  67. DEPENDS:=+libnl-tiny +(PACKAGE_devlink||PACKAGE_rdma):libmnl
  68. endef
  69. define Package/devlink
  70. $(call Package/iproute2/Default)
  71. TITLE:=Network devlink utility
  72. DEPENDS:=+libmnl
  73. endef
  74. define Package/rdma
  75. $(call Package/iproute2/Default)
  76. TITLE:=Network rdma utility
  77. DEPENDS:=+libmnl
  78. endef
  79. ifeq ($(BUILD_VARIANT),tiny)
  80. IP_CONFIG_TINY:=y
  81. endif
  82. ifdef CONFIG_PACKAGE_devlink
  83. HAVE_MNL:=y
  84. endif
  85. ifdef CONFIG_PACKAGE_rdma
  86. HAVE_MNL:=y
  87. endif
  88. define Build/Configure
  89. $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
  90. $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
  91. $(PKG_BUILD_DIR)/Makefile
  92. $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
  93. $(PKG_BUILD_DIR)/Makefile
  94. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-librecmc\";" \
  95. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  96. endef
  97. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  98. MAKE_FLAGS += \
  99. EXTRA_CCOPTS="-I$(STAGING_DIR)/usr/include/libnl-tiny" \
  100. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  101. SHARED_LIBS="" \
  102. LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
  103. IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
  104. HAVE_MNL=$(HAVE_MNL) \
  105. IPT_LIB_DIR=/usr/lib/iptables \
  106. FPIC="$(FPIC)"
  107. define Build/Compile
  108. +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
  109. endef
  110. define Build/InstallDev
  111. $(INSTALL_DIR) $(1)/usr/include
  112. $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink}.h $(1)/usr/include/
  113. $(INSTALL_DIR) $(1)/usr/lib
  114. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  115. endef
  116. define Package/ip-tiny/install
  117. $(INSTALL_DIR) $(1)/usr/libexec
  118. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-tiny
  119. endef
  120. define Package/ip-full/install
  121. $(INSTALL_DIR) $(1)/usr/libexec
  122. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/libexec/ip-full
  123. endef
  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. define Package/genl/install
  131. $(INSTALL_DIR) $(1)/usr/sbin
  132. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  133. endef
  134. define Package/ip-bridge/install
  135. $(INSTALL_DIR) $(1)/usr/sbin
  136. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
  137. endef
  138. define Package/ss/install
  139. $(INSTALL_DIR) $(1)/usr/sbin
  140. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
  141. endef
  142. define Package/nstat/install
  143. $(INSTALL_DIR) $(1)/usr/sbin
  144. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
  145. endef
  146. define Package/devlink/install
  147. $(INSTALL_DIR) $(1)/usr/sbin
  148. $(INSTALL_BIN) $(PKG_BUILD_DIR)/devlink/devlink $(1)/usr/sbin/
  149. endef
  150. define Package/rdma/install
  151. $(INSTALL_DIR) $(1)/usr/sbin
  152. $(INSTALL_BIN) $(PKG_BUILD_DIR)/rdma/rdma $(1)/usr/sbin/
  153. endef
  154. $(eval $(call BuildPackage,ip-tiny))
  155. $(eval $(call BuildPackage,ip-full))
  156. $(eval $(call BuildPackage,tc))
  157. $(eval $(call BuildPackage,genl))
  158. $(eval $(call BuildPackage,ip-bridge))
  159. $(eval $(call BuildPackage,ss))
  160. $(eval $(call BuildPackage,nstat))
  161. $(eval $(call BuildPackage,devlink))
  162. $(eval $(call BuildPackage,rdma))