xref: /OK3568_Linux_fs/buildroot/package/nut/nut.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# nut
4#
5################################################################################
6
7NUT_VERSION = 03c3bbe8df9a2caf3c09c120ae7045d35af99b76
8NUT_SITE = $(call github,networkupstools,nut,$(NUT_VERSION))
9NUT_LICENSE = GPL-2.0+, GPL-3.0+ (python scripts), GPL/Artistic (perl client)
10NUT_LICENSE_FILES = COPYING LICENSE-GPL2 LICENSE-GPL3
11NUT_SELINUX_MODULES = apache nut
12NUT_INSTALL_STAGING = YES
13NUT_DEPENDENCIES = host-pkgconf host-perl
14
15# From git:
16NUT_AUTORECONF = YES
17
18# Generate files otherwise generated by autogen.sh
19# buildroot does not support augeas, creating an empty file prevents
20# us from adding a dependency to host-python
21define NUT_PREGEN
22	touch $(@D)/scripts/augeas/nutupsconf.aug.in
23	cd $(@D)/tools && PATH=$(BR_PATH) ./nut-usbinfo.pl
24endef
25NUT_PRE_CONFIGURE_HOOKS += NUT_PREGEN
26
27# Race condition in tools generation
28NUT_MAKE = $(MAKE1)
29
30# Put the PID files in a read-write place (/var/run is a tmpfs)
31# since the default location (/var/state/ups) maybe readonly.
32NUT_CONF_OPTS = \
33	--with-altpidpath=/var/run/upsd \
34	--with-dev
35
36NUT_CONF_ENV = ax_cv__printf_string_null=yes
37
38# For uClibc-based toolchains, nut forgets to link with -lm
39ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
40NUT_CONF_ENV += LDFLAGS="$(TARGET_LDFLAGS) -lm"
41endif
42
43ifeq ($(call qstrip,$(BR2_PACKAGE_NUT_DRIVERS)),)
44NUT_CONF_OPTS += --with-drivers=all
45else
46NUT_CONF_OPTS += --with-drivers=$(BR2_PACKAGE_NUT_DRIVERS)
47endif
48
49ifeq ($(BR2_PACKAGE_AVAHI)$(BR2_PACKAGE_DBUS),yy)
50NUT_DEPENDENCIES += avahi dbus
51NUT_CONF_OPTS += --with-avahi
52else
53NUT_CONF_OPTS += --without-avahi
54endif
55
56# gd with support for png is required for the CGI
57ifeq ($(BR2_PACKAGE_GD)$(BR2_PACKAGE_LIBPNG),yy)
58NUT_DEPENDENCIES += gd libpng
59NUT_CONF_OPTS += --with-cgi
60else
61NUT_CONF_OPTS += --without-cgi
62endif
63
64# nut-scanner needs libltdl, which is a wrapper arounf dlopen/dlsym,
65# so is not available for static-only builds.
66# There is no flag to directly enable/disable nut-scanner, it's done
67# via the --enable/disable-libltdl flag.
68ifeq ($(BR2_STATIC_LIBS):$(BR2_PACKAGE_LIBTOOL),:y)
69NUT_DEPENDENCIES += libtool
70NUT_CONF_OPTS += --with-libltdl
71else
72NUT_CONF_OPTS += --without-libltdl
73endif
74
75ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
76NUT_DEPENDENCIES += libusb-compat
77NUT_CONF_OPTS += --with-usb
78else
79NUT_CONF_OPTS += --without-usb
80endif
81
82ifeq ($(BR2_PACKAGE_NEON_EXPAT)$(BR2_PACKAGE_NEON_LIBXML2),y)
83NUT_DEPENDENCIES += neon
84NUT_CONF_OPTS += --with-neon
85else
86NUT_CONF_OPTS += --without-neon
87endif
88
89ifeq ($(BR2_PACKAGE_NETSNMP),y)
90NUT_DEPENDENCIES += netsnmp
91NUT_CONF_OPTS += \
92	--with-snmp \
93	--with-net-snmp-config=$(STAGING_DIR)/usr/bin/net-snmp-config
94else
95NUT_CONF_OPTS += --without-snmp
96endif
97
98ifeq ($(BR2_PACKAGE_OPENSSL),y)
99NUT_DEPENDENCIES += openssl
100NUT_CONF_OPTS += --with-ssl
101else
102NUT_CONF_OPTS += --without-ssl
103endif
104
105$(eval $(autotools-package))
106