c3753534a682ff68d8a901818bb233ce158ae6a3
[openwrt/staging/ldir.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.16
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:=7753c6e31e938923185f4e10c4ab328929729e22ee4a9687d08881fb82c092ee
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 '/cdp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
72 endif
73 ifneq ($(CONFIG_LLDPD_WITH_FDP),y)
74 sed -i -e '/fdp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
75 endif
76 ifneq ($(CONFIG_LLDPD_WITH_EDP),y)
77 sed -i -e '/edp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
78 endif
79 ifneq ($(CONFIG_LLDPD_WITH_SONMP),y)
80 sed -i -e '/sonmp/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
81 endif
82 ifneq ($(CONFIG_LLDPD_WITH_SNMP),y)
83 sed -i -e '/agentxsocket/d' $(1)/etc/init.d/lldpd $(1)/etc/config/lldpd
84 endif
85 endef
86
87 define Package/lldpd/conffiles
88 /etc/config/lldpd
89 endef
90
91 CONFIGURE_ARGS += \
92 $(if $(CONFIG_LLDPD_WITH_PRIVSEP), \
93 --with-privsep-user=lldp \
94 --with-privsep-group=lldp \
95 --with-privsep-chroot=/var/run/lldp \
96 ,--disable-privsep) \
97 --with-readline=no \
98 --with-embedded-libevent=no \
99 --disable-hardening \
100 --without-xml \
101 --disable-doxygen-doc \
102 --sysconfdir=/tmp \
103 $(if $(CONFIG_LLDPD_WITH_CDP),,--disable-cdp) \
104 $(if $(CONFIG_LLDPD_WITH_FDP),,--disable-fdp) \
105 $(if $(CONFIG_LLDPD_WITH_EDP),,--disable-edp) \
106 $(if $(CONFIG_LLDPD_WITH_LLDPMED),,--disable-lldpmed) \
107 $(if $(CONFIG_LLDPD_WITH_DOT1),,--disable-dot1) \
108 $(if $(CONFIG_LLDPD_WITH_DOT3),,--disable-dot3) \
109 $(if $(CONFIG_LLDPD_WITH_CUSTOM),,--disable-custom) \
110 $(if $(CONFIG_LLDPD_WITH_SONMP),,--disable-sonmp) \
111 $(if $(CONFIG_LLDPD_WITH_JSON),--enable-json0,) \
112 $(if $(CONFIG_LLDPD_WITH_SNMP),--with-snmp,) \
113 $(if $(CONFIG_USE_GLIBC),,--without-libbsd)
114
115 TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
116
117 $(eval $(call BuildPackage,lldpd))