Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #
  2. # Copyright (C) 2008-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:=lldpd
  9. PKG_VERSION:=1.0.16
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://codeload.github.com/lldpd/lldpd/tar.gz/$(PKG_VERSION)?
  13. PKG_HASH:=9bc6154377b97187d96d5e22aa5c4946c6cbc85f1416149853cc0940639a77e5
  14. PKG_MAINTAINER:=Stijn Tintel <[email protected]>
  15. PKG_LICENSE:=ISC
  16. PKG_CPE_ID:=cpe:/a:lldpd_project:lldpd
  17. PKG_FIXUP:=autoreconf
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_INSTALL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/lldpd
  22. SECTION:=net
  23. CATEGORY:=Network
  24. SUBMENU:=Routing and Redirection
  25. TITLE:=Link Layer Discovery Protocol daemon
  26. URL:=https://vincentbernat.github.io/lldpd/
  27. DEPENDS:=+libcap +libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c +LLDPD_WITH_SNMP:libnetsnmp
  28. USERID:=lldp=121:lldp=129
  29. MENU:=1
  30. endef
  31. define Package/lldpd/config
  32. source "$(SOURCE)/Config.in"
  33. endef
  34. define Package/lldpd/description
  35. LLDP (Link Layer Discovery Protocol) is an industry standard protocol designed
  36. to supplant proprietary Link-Layer protocols such as
  37. Extreme's EDP (Extreme Discovery Protocol) and
  38. CDP (Cisco Discovery Protocol).
  39. The goal of LLDP is to provide an inter-vendor compatible mechanism to deliver
  40. Link-Layer notifications to adjacent network devices.
  41. endef
  42. define Build/InstallDev
  43. $(INSTALL_DIR) $(1)/usr/lib
  44. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblldpctl.so* $(1)/usr/lib/
  45. $(INSTALL_DIR) $(1)/usr/include
  46. $(CP) $(PKG_INSTALL_DIR)/usr/include/lldpctl.h $(1)/usr/include/lldpctl.h
  47. $(CP) $(PKG_INSTALL_DIR)/usr/include/lldp-const.h $(1)/usr/include/lldp-const.h
  48. endef
  49. define Package/lldpd/install
  50. $(INSTALL_DIR) $(1)/etc/init.d
  51. $(INSTALL_DIR) $(1)/etc/lldpd.d
  52. $(INSTALL_DIR) $(1)/etc/config
  53. $(INSTALL_DIR) $(1)/usr/lib $(1)/usr/sbin
  54. $(CP) $(PKG_INSTALL_DIR)/usr/sbin/lldp{cli,ctl,d} $(1)/usr/sbin/
  55. $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblldpctl.so* $(1)/usr/lib/
  56. $(INSTALL_BIN) ./files/lldpd.init $(1)/etc/init.d/lldpd
  57. $(INSTALL_CONF) ./files/lldpd.config $(1)/etc/config/lldpd
  58. ifneq ($(CONFIG_LLDPD_WITH_CDP),y)
  59. sed -i -e '/cdp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
  60. endif
  61. ifneq ($(CONFIG_LLDPD_WITH_FDP),y)
  62. sed -i -e '/fdp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
  63. endif
  64. ifneq ($(CONFIG_LLDPD_WITH_EDP),y)
  65. sed -i -e '/edp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
  66. endif
  67. ifneq ($(CONFIG_LLDPD_WITH_SONMP),y)
  68. sed -i -e '/sonmp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
  69. endif
  70. ifneq ($(CONFIG_LLDPD_WITH_SNMP),y)
  71. sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
  72. endif
  73. endef
  74. define Package/lldpd/conffiles
  75. /etc/config/lldpd
  76. endef
  77. CONFIGURE_ARGS += \
  78. $(if $(CONFIG_LLDPD_WITH_PRIVSEP), \
  79. --with-privsep-user=lldp \
  80. --with-privsep-group=lldp \
  81. --with-privsep-chroot=/var/run/lldp \
  82. ,--disable-privsep) \
  83. --with-readline=no \
  84. --with-embedded-libevent=no \
  85. --disable-hardening \
  86. --without-xml \
  87. --disable-doxygen-doc \
  88. --sysconfdir=/tmp \
  89. $(if $(CONFIG_LLDPD_WITH_CDP),,--disable-cdp) \
  90. $(if $(CONFIG_LLDPD_WITH_FDP),,--disable-fdp) \
  91. $(if $(CONFIG_LLDPD_WITH_EDP),,--disable-edp) \
  92. $(if $(CONFIG_LLDPD_WITH_LLDPMED),,--disable-lldpmed) \
  93. $(if $(CONFIG_LLDPD_WITH_DOT1),,--disable-dot1) \
  94. $(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \
  95. $(if $(CONFIG_LLDPD_WITH_CUSTOM),,--disable-custom) \
  96. $(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \
  97. $(if $(CONFIG_LLDPD_WITH_JSON),--enable-json0,) \
  98. $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) \
  99. $(if $(CONFIG_USE_GLIBC),,--without-libbsd)
  100. TARGET_CFLAGS += -flto
  101. TARGET_LDFLAGS += -flto -Wl,--gc-sections,--as-needed
  102. $(eval $(call BuildPackage,lldpd))