Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. USE_CAKE:=$(if $(filter 1y,$(SDK)$(CONFIG_BUILDBOT)),cake-legacy,cake-upstream)
  18. PKG_FLAGS:=$(if $(filter cake-upstream,$(USE_CAKE)),nonshared)
  19. PKG_RELEASE:=$(PKG_RELEASE)-$(USE_CAKE)
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/iproute2/Default
  22. TITLE:=Routing control utility ($(2))
  23. SECTION:=net
  24. CATEGORY:=Network
  25. URL:=http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
  26. SUBMENU:=Routing and Redirection
  27. MAINTAINER:=Russell Senior <russell@personaltelco.net>
  28. DEPENDS:= +libnl-tiny
  29. VARIANT:=$(1)
  30. PROVIDES:=$(3)
  31. endef
  32. define Package/ip-tiny
  33. $(call Package/iproute2/Default,tiny,Minimal,ip)
  34. CONFLICTS:=ip-full
  35. endef
  36. Package/ip-full:=$(call Package/iproute2/Default,full,Full,ip)
  37. define Package/tc
  38. $(call Package/iproute2/Default)
  39. TITLE:=Traffic control utility
  40. DEPENDS:=+kmod-sched-core
  41. endef
  42. define Package/genl
  43. $(call Package/iproute2/Default)
  44. TITLE:=General netlink utility frontend
  45. endef
  46. define Package/ip-bridge
  47. $(call Package/iproute2/Default)
  48. TITLE:=Bridge configuration utility from iproute2
  49. endef
  50. define Package/ss
  51. $(call Package/iproute2/Default)
  52. TITLE:=Socket statistics utility
  53. endef
  54. define Package/nstat
  55. $(call Package/iproute2/Default)
  56. TITLE:=Network statistics utility
  57. endef
  58. ifeq ($(BUILD_VARIANT),tiny)
  59. IP_CONFIG_TINY:=y
  60. endif
  61. PATCH_DIR:=$(PKG_BUILD_DIR)/openwrt-patches
  62. define Build/Patch
  63. $(INSTALL_DIR) $(PATCH_DIR)
  64. $(CP) ./patches/* ./patches-$(USE_CAKE)/* $(PATCH_DIR)/
  65. $(call Build/Patch/Default)
  66. endef
  67. define Build/Configure
  68. $(SED) "s,-I/usr/include/db3,," $(PKG_BUILD_DIR)/Makefile
  69. $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \
  70. $(PKG_BUILD_DIR)/Makefile
  71. $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \
  72. $(PKG_BUILD_DIR)/Makefile
  73. echo "static const char SNAPSHOT[] = \"$(PKG_VERSION)-$(PKG_RELEASE)-lede\";" \
  74. > $(PKG_BUILD_DIR)/include/SNAPSHOT.h
  75. endef
  76. TARGET_CFLAGS += -DHAVE_SETNS
  77. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  78. MAKE_FLAGS += \
  79. EXTRA_CCOPTS="$(TARGET_CFLAGS) -I../include -I$(STAGING_DIR)/usr/include/libnl-tiny" \
  80. KERNEL_INCLUDE="$(LINUX_DIR)/include" \
  81. SHARED_LIBS="" \
  82. LDFLAGS="$(TARGET_LDFLAGS) -Wl,--gc-sections" \
  83. IP_CONFIG_TINY=$(IP_CONFIG_TINY) \
  84. FPIC="$(FPIC)"
  85. define Build/Compile
  86. +$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS)
  87. endef
  88. define Build/InstallDev
  89. $(INSTALL_DIR) $(1)/usr/include
  90. $(CP) $(PKG_BUILD_DIR)/include/{libgenl,libnetlink,ll_map}.h $(1)/usr/include/
  91. $(INSTALL_DIR) $(1)/usr/lib
  92. $(CP) $(PKG_BUILD_DIR)/lib/libnetlink.a $(1)/usr/lib/
  93. endef
  94. define Package/ip-tiny/install
  95. $(INSTALL_DIR) $(1)/usr/bin
  96. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/bin/
  97. endef
  98. define Package/ip-full/install
  99. $(INSTALL_DIR) $(1)/usr/sbin
  100. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ip/ip $(1)/usr/sbin/
  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. define Package/nstat/install
  121. $(INSTALL_DIR) $(1)/usr/sbin
  122. $(INSTALL_BIN) $(PKG_BUILD_DIR)/misc/nstat $(1)/usr/sbin/
  123. endef
  124. $(eval $(call BuildPackage,ip-tiny))
  125. $(eval $(call BuildPackage,ip-full))
  126. $(eval $(call BuildPackage,tc))
  127. $(eval $(call BuildPackage,genl))
  128. $(eval $(call BuildPackage,ip-bridge))
  129. $(eval $(call BuildPackage,ss))
  130. $(eval $(call BuildPackage,nstat))