Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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:=3.19.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=http://kernel.org/pub/linux/utils/net/iproute2/
  13. PKG_MD5SUM:=237083a1e3c388cde7a115a5724dc72a
  14. PKG_BUILD_PARALLEL:=1
  15. PKG_LICENSE:=GPL-2.0
  16. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  17. include $(INCLUDE_DIR)/package.mk
  18. define Package/iproute2/Default
  19. TITLE:=Routing control utility ($(2))
  20. SECTION:=net
  21. CATEGORY:=Network
  22. URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
  23. SUBMENU:=Routing and Redirection
  24. MAINTAINER:=Russell Senior <[email protected]>
  25. DEPENDS:= +libnl-tiny
  26. VARIANT:=$(1)
  27. endef
  28. define Package/ip
  29. $(call Package/iproute2/Default,tiny,Minimal)
  30. CONFLICTS:=ip-full
  31. endef
  32. Package/ip-full=$(call Package/iproute2/Default,full,Full)
  33. define Package/ip/conffiles
  34. /etc/iproute2/rt_tables
  35. endef
  36. define Package/ip-$(BUILD_VARIANT)/conffiles
  37. $(Package/ip/conffiles)
  38. endef
  39. define Package/tc
  40. $(call Package/iproute2/Default)
  41. TITLE:=Traffic control utility
  42. DEPENDS:=+kmod-sched-core
  43. endef
  44. define Package/genl
  45. $(call Package/iproute2/Default)
  46. TITLE:=General netlink utility frontend
  47. endef
  48. define Package/ip-bridge
  49. $(call Package/iproute2/Default)
  50. TITLE:=Bridge configuration utility from iproute2
  51. endef
  52. define Package/ss
  53. $(call Package/iproute2/Default)
  54. TITLE:=Socket statistics utility
  55. endef
  56. ifeq ($(BUILD_VARIANT),tiny)
  57. IP_CONFIG_TINY:=y
  58. endif
  59. define Build/Configure
  60. $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
  61. $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
  62. $(PKG_BUILD_DIR)/Makefile
  63. $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
  64. $(PKG_BUILD_DIR)/Makefile
  65. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-openwrt\";" \
  66. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  67. endef
  68. ifdef CONFIG_USE_EGLIBC
  69. ifndef CONFIG_EGLIBC_VERSION_2_13
  70. TARGET_CFLAGS += -DHAVE_SETNS
  71. endif
  72. endif
  73. ifdef CONFIG_USE_MUSL
  74. TARGET_CFLAGS += -DHAVE_SETNS
  75. endif
  76. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  77. MAKE_FLAGS += \
  78. EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
  79. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  80. SHARED_LIBS="" \
  81. LDFLAGS="-Wl,--gc-sections" \
  82. IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
  83. FPIC="$(FPIC)"
  84. define Build/Compile
  85. +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
  86. endef
  87. define Build/InstallDev
  88. $(INSTALL_DIR) $(1)/usr/include
  89. $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
  90. $(INSTALL_DIR) $(1)/usr/lib
  91. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  92. endef
  93. define Package/ip/install
  94. $(INSTALL_DIR) $(1)/usr/sbin
  95. $(INSTALL_DIR) $(1)/etc/iproute2
  96. $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
  97. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
  98. endef
  99. define Package/ip-$(BUILD_VARIANT)/install
  100. $(Package/ip/install)
  101. endef
  102. define Package/tc/install
  103. $(INSTALL_DIR) $(1)/usr/sbin
  104. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
  105. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  106. $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
  107. endef
  108. define Package/genl/install
  109. $(INSTALL_DIR) $(1)/usr/sbin
  110. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  111. endef
  112. define Package/ip-bridge/install
  113. $(INSTALL_DIR) $(1)/usr/sbin
  114. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
  115. endef
  116. define Package/ss/install
  117. $(INSTALL_DIR) $(1)/usr/sbin
  118. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
  119. endef
  120. $(eval $(call BuildPackage,ip))
  121. $(eval $(call BuildPackage,ip-full))
  122. $(eval $(call BuildPackage,tc))
  123. $(eval $(call BuildPackage,genl))
  124. $(eval $(call BuildPackage,ip-bridge))
  125. $(eval $(call BuildPackage,ss))