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