1################################################################################
2#
3# nut
4#
5################################################################################
6
7NUT_VERSION = 2.8.2
8NUT_SITE = https://github.com/networkupstools/nut/releases/download/v$(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
14
15# Put the PID files in a read-write place (/var/run is a tmpfs)
16# since the default location (/var/state/ups) maybe readonly.
17NUT_CONF_OPTS = \
18	--with-altpidpath=/var/run/upsd \
19	--with-dev \
20	--without-doc \
21	--without-python \
22	--without-python2 \
23	--with-user=nut \
24	--with-group=nut
25
26NUT_CONF_ENV = \
27	ax_cv_check_cflags__Werror__Wno_unknown_warning_option=no \
28	ax_cv_check_cxxflags__Werror__Wno_unknown_warning_option=no \
29	ac_cv_func_strcasecmp=yes \
30	ac_cv_func_strdup=yes \
31	ac_cv_func_strncasecmp=yes \
32	ax_cv__printf_string_null=yes
33
34define NUT_USERS
35	nut -1 nut -1 * - - - NUT user
36endef
37
38ifeq ($(call qstrip,$(BR2_PACKAGE_NUT_DRIVERS)),)
39NUT_CONF_OPTS += --with-drivers=auto
40else
41NUT_CONF_OPTS += --with-drivers=$(BR2_PACKAGE_NUT_DRIVERS)
42endif
43
44ifeq ($(BR2_PACKAGE_AVAHI)$(BR2_PACKAGE_DBUS),yy)
45NUT_DEPENDENCIES += avahi dbus
46NUT_CONF_OPTS += --with-avahi
47else
48NUT_CONF_OPTS += --without-avahi
49endif
50
51ifeq ($(BR2_PACKAGE_FREEIPMI),y)
52NUT_CONF_OPTS += --with-freeipmi
53NUT_DEPENDENCIES += freeipmi
54else
55NUT_CONF_OPTS += --without-freeipmi
56endif
57
58# gd with support for png is required for the CGI
59ifeq ($(BR2_PACKAGE_GD)$(BR2_PACKAGE_LIBPNG),yy)
60NUT_DEPENDENCIES += gd libpng
61NUT_CONF_OPTS += --with-cgi
62else
63NUT_CONF_OPTS += --without-cgi
64endif
65
66# nut-scanner needs libltdl, which is a wrapper around dlopen/dlsym,
67# so is not available for static-only builds.
68# There is no flag to directly enable/disable nut-scanner, it's done
69# via the --enable/disable-libltdl flag.
70ifeq ($(BR2_STATIC_LIBS):$(BR2_PACKAGE_LIBTOOL),:y)
71NUT_DEPENDENCIES += libtool
72NUT_CONF_OPTS += --with-libltdl
73else
74NUT_CONF_OPTS += --without-libltdl
75endif
76
77ifeq ($(BR2_PACKAGE_LIBUSB),y)
78NUT_DEPENDENCIES += libusb
79NUT_CONF_OPTS += --with-usb
80else ifeq ($(BR2_PACKAGE_LIBUSB_COMPAT),y)
81NUT_DEPENDENCIES += libusb-compat
82NUT_CONF_OPTS += --with-usb
83else
84NUT_CONF_OPTS += --without-usb
85endif
86
87ifeq ($(BR2_PACKAGE_NEON_EXPAT)$(BR2_PACKAGE_NEON_LIBXML2),y)
88NUT_DEPENDENCIES += neon
89NUT_CONF_OPTS += --with-neon
90else
91NUT_CONF_OPTS += --without-neon
92endif
93
94ifeq ($(BR2_PACKAGE_NETSNMP),y)
95NUT_DEPENDENCIES += netsnmp
96NUT_CONF_OPTS += \
97	--with-snmp \
98	--with-net-snmp-config=$(STAGING_DIR)/usr/bin/net-snmp-config
99else
100NUT_CONF_OPTS += --without-snmp
101endif
102
103ifeq ($(BR2_PACKAGE_OPENSSL),y)
104NUT_DEPENDENCIES += openssl
105NUT_CONF_OPTS += --with-ssl
106else
107NUT_CONF_OPTS += --without-ssl
108endif
109
110ifeq ($(BR2_PACKAGE_PYTHON3),y)
111NUT_DEPENDENCIES += python3
112NUT_CONF_ENV += nut_cv_PYTHON3_SITE_PACKAGES=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
113NUT_CONF_OPTS += \
114	--with-pynut \
115	--with-python3
116else
117NUT_CONF_OPTS += \
118	--without-pynut \
119	--without-python3
120endif
121
122$(eval $(autotools-package))
123