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