Makefile 3.8 KB

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