Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.0.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2/
  13. PKG_MD5SUM:=3adc263ade4ee76c35032e8f50b54108
  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 <russell@personaltelco.net>
  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_GLIBC
  69. TARGET_CFLAGS += -DHAVE_SETNS
  70. endif
  71. ifdef CONFIG_USE_MUSL
  72. TARGET_CFLAGS += -DHAVE_SETNS
  73. endif
  74. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  75. MAKE_FLAGS += \
  76. EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
  77. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  78. SHARED_LIBS="" \
  79. LDFLAGS="-Wl,--gc-sections" \
  80. IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
  81. FPIC="$(FPIC)"
  82. define Build/Compile
  83. +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
  84. endef
  85. define Build/InstallDev
  86. $(INSTALL_DIR) $(1)/usr/include
  87. $(CP) $(PKG_BUILD_DIR)/include/libnetlink.h $(1)/usr/include/
  88. $(INSTALL_DIR) $(1)/usr/lib
  89. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  90. endef
  91. define Package/ip/install
  92. $(INSTALL_DIR) $(1)/usr/sbin
  93. $(INSTALL_DIR) $(1)/etc/iproute2
  94. $(INSTALL_DATA) $(PKG_BUILD_DIR)/etc/iproute2/rt_tables $(1)/etc/iproute2
  95. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
  96. endef
  97. define Package/ip-$(BUILD_VARIANT)/install
  98. $(Package/ip/install)
  99. endef
  100. define Package/tc/install
  101. $(INSTALL_DIR) $(1)/usr/sbin
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
  103. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  104. $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
  105. endef
  106. define Package/genl/install
  107. $(INSTALL_DIR) $(1)/usr/sbin
  108. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  109. endef
  110. define Package/ip-bridge/install
  111. $(INSTALL_DIR) $(1)/usr/sbin
  112. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
  113. endef
  114. define Package/ss/install
  115. $(INSTALL_DIR) $(1)/usr/sbin
  116. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
  117. endef
  118. $(eval $(call BuildPackage,ip))
  119. $(eval $(call BuildPackage,ip-full))
  120. $(eval $(call BuildPackage,tc))
  121. $(eval $(call BuildPackage,genl))
  122. $(eval $(call BuildPackage,ip-bridge))
  123. $(eval $(call BuildPackage,ss))