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