Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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.4.0
  10. PKG_RELEASE:=10
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
  13. PKG_HASH:=bc91c367288a19f78ef800cd6840363be1f22da8436fbae88e1a7250490d6514
  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. PROVIDES:=$(3)
  28. endef
  29. define Package/ip-tiny
  30. $(call Package/iproute2/Default,tiny,Minimal,ip)
  31. CONFLICTS:=ip-full
  32. endef
  33. Package/ip-full:=$(call Package/iproute2/Default,full,Full,ip)
  34. define Package/tc
  35. $(call Package/iproute2/Default)
  36. TITLE:=Traffic control utility
  37. DEPENDS:=+kmod-sched-core
  38. endef
  39. define Package/genl
  40. $(call Package/iproute2/Default)
  41. TITLE:=General netlink utility frontend
  42. endef
  43. define Package/ip-bridge
  44. $(call Package/iproute2/Default)
  45. TITLE:=Bridge configuration utility from iproute2
  46. endef
  47. define Package/ss
  48. $(call Package/iproute2/Default)
  49. TITLE:=Socket statistics utility
  50. endef
  51. define Package/nstat
  52. $(call Package/iproute2/Default)
  53. TITLE:=Network statistics utility
  54. endef
  55. ifeq ($(BUILD_VARIANT),tiny)
  56. IP_CONFIG_TINY:=y
  57. endif
  58. define Build/Configure
  59. $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
  60. $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
  61. $(PKG_BUILD_DIR)/Makefile
  62. $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
  63. $(PKG_BUILD_DIR)/Makefile
  64. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-lede\";" \
  65. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  66. endef
  67. TARGET_CFLAGS += -DHAVE_SETNS
  68. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  69. MAKE_FLAGS += \
  70. EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
  71. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  72. SHARED_LIBS="" \
  73. LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
  74. IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
  75. FPIC="$(FPIC)"
  76. define Build/Compile
  77. +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
  78. endef
  79. define Build/InstallDev
  80. $(INSTALL_DIR) $(1)/usr/include
  81. $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/
  82. $(INSTALL_DIR) $(1)/usr/lib
  83. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  84. endef
  85. define Package/ip-tiny/install
  86. $(INSTALL_DIR) $(1)/usr/bin
  87. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/bin/
  88. endef
  89. define Package/ip-full/install
  90. $(INSTALL_DIR) $(1)/usr/sbin
  91. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
  92. endef
  93. define Package/tc/install
  94. $(INSTALL_DIR) $(1)/usr/sbin
  95. $(INSTALL_BIN) $(PKG_BUILD_DIR)/tc/tc $(1)/usr/sbin/
  96. $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
  97. $(INSTALL_BIN) ./files/15-teql $(1)/etc/hotplug.d/iface/
  98. endef
  99. define Package/genl/install
  100. $(INSTALL_DIR) $(1)/usr/sbin
  101. $(INSTALL_BIN) $(PKG_BUILD_DIR)/genl/genl $(1)/usr/sbin/
  102. endef
  103. define Package/ip-bridge/install
  104. $(INSTALL_DIR) $(1)/usr/sbin
  105. $(INSTALL_BIN) $(PKG_BUILD_DIR)/bridge/bridge $(1)/usr/sbin/
  106. endef
  107. define Package/ss/install
  108. $(INSTALL_DIR) $(1)/usr/sbin
  109. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/ss $(1)/usr/sbin/
  110. endef
  111. define Package/nstat/install
  112. $(INSTALL_DIR) $(1)/usr/sbin
  113. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
  114. endef
  115. $(eval $(call BuildPackage,ip-tiny))
  116. $(eval $(call BuildPackage,ip-full))
  117. $(eval $(call BuildPackage,tc))
  118. $(eval $(call BuildPackage,genl))
  119. $(eval $(call BuildPackage,ip-bridge))
  120. $(eval $(call BuildPackage,ss))
  121. $(eval $(call BuildPackage,nstat))