Marcel Telka
2023-11-21 edb9f17417fc91f653839e60b941983e5a3a4a7f
commit | author | age
2313e2 1 #
JK 2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
6 #
7 # A full copy of the text of the CDDL should have accompanied this
8 # source.  A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
10 #
11
12 #
d102d5 13 # Copyright 2016-2023 Jim Klimov
2313e2 14 #
JK 15
d102d5 16 # NUT 2.8.0+ is diligently tested to benefit from parallel builds and succeed
JK 17 USE_PARALLEL_BUILD=    yes
18
2313e2 19 include ../../../make-rules/shared-macros.mk
JK 20
21 COMPONENT_NAME=    nut
d102d5 22 COMPONENT_VERSION=    2.8.1
edb9f1 23 COMPONENT_REVISION=    3
2313e2 24 COMPONENT_SUMMARY=    Network UPS Tools (NUT)
JK 25 COMPONENT_DESCRIPTION=    Network UPS Tools (NUT) is a versatile power-device monitoring toolkit to facilitate safe shutdowns
26 COMPONENT_SRC=    $(COMPONENT_NAME)-$(COMPONENT_VERSION)
27 COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.gz
28 COMPONENT_ARCHIVE_HASH=    \
d102d5 29   sha256:7da48ee23b1f0d8d72560bb0af84f5c5ae4dbe35452b84cb49840132e47f099c
2313e2 30 COMPONENT_ARCHIVE_URL=    \
d102d5 31   https://github.com/networkupstools/$(COMPONENT_NAME)/releases/download/v$(COMPONENT_VERSION)/$(COMPONENT_SRC).tar.gz
6bc1e3 32 COMPONENT_PROJECT_URL=    https://networkupstools.org
2313e2 33 COMPONENT_FMRI=    system/management/$(COMPONENT_NAME)
JK 34 COMPONENT_CLASSIFICATION=    System/Administration and Configuration
35 COMPONENT_LICENSE=    GPLv2+
36 COMPONENT_LICENSE_FILE=    COPYING
37
eac4e9 38 include $(WS_MAKE_RULES)/common.mk
2313e2 39
eac4e9 40 CXXFLAGS += $(CXXFLAGS.$(BITS))
AW 41 CFLAGS   += $(CFLAGS.$(BITS))
2313e2 42
d102d5 43 # Drop *.8 man pages (we patch to regenerate them into *.1m - see patches/07-man.patch)
JK 44 # Fix up upsmon.txt encoding that might have gone wrong into the 2.8.1 release tarball
edb9f1 45 COMPONENT_PREP_ACTION =    ( cd $(SOURCE_DIR) && PATH="$(PATH)" ./autogen.sh && cd docs/man && rm -f *.8 && { dos2unix upsmon.txt > upsmon.txt.tmp && mv -f upsmon.txt.tmp upsmon.txt; }  )
2313e2 46
JK 47 COMPONENT_PRE_CONFIGURE_ACTION =    ( $(CLONEY) $(SOURCE_DIR) $(@D) )
b4f492 48
AP 49 # We deliver only 64-bit binaries
d102d5 50 CONFIGURE_BINDIR.64 =    $(USRBINDIR)
JK 51 CONFIGURE_SBINDIR.64 =    $(USRSBINDIR)
2313e2 52
6bc1e3 53 CONFIGURE_ENV     +=    LDFLAGS="$(LDFLAGS.64)"
2313e2 54
6bc1e3 55 CONFIGURE_OPTIONS +=    LDFLAGS="$(LDFLAGS.64)"
2313e2 56
JK 57 CONFIGURE_OPTIONS +=    --disable-static
58 CONFIGURE_OPTIONS +=    --enable-shared
59
d102d5 60 CONFIGURE_OPTIONS +=    --with-solaris-smf=yes
JK 61 CONFIGURE_OPTIONS +=    --with-solaris-init=no
62 CONFIGURE_OPTIONS +=    --with-solaris-pkg-svr4=no
63 CONFIGURE_OPTIONS +=    --with-solaris-pkg-ips=no
64
65 CONFIGURE_OPTIONS +=    --with-systemdsystemunitdir=no
66 CONFIGURE_OPTIONS +=    --with-systemdshutdowndir=no
67 CONFIGURE_OPTIONS +=    --with-systemdtmpfilesdir=no
68
b4f492 69 CONFIGURE_OPTIONS +=    --with-user=nut
AP 70 CONFIGURE_OPTIONS +=    --with-group=nut
71 CONFIGURE_OPTIONS +=    --sysconfdir=/etc/nut
72 CONFIGURE_OPTIONS +=    --sharedstatedir=/usr/share/nut
73 CONFIGURE_OPTIONS +=    --datarootdir=/usr/share/nut
74 CONFIGURE_OPTIONS +=    --with-hotplug-dir=no
75 CONFIGURE_OPTIONS +=    --with-udev-dir=no
d102d5 76
JK 77 #  --with-statepath=PATH   path for ups state files (${STATEPATH}, typically
78 #                          /var/state/ups)
79 #  --with-altpidpath=PATH  path for NUT driver/upsd .pid files not running as
80 #                          root (<statepath>)
81 #  --with-pidpath=PATH     Path for root-owned .pid files (${PIDPATH},
82 #                          typically /var/run)
83 #  --with-powerdownflag=PATH
84 #                          default path for upsmon POWERDOWNFLAG file
85 #                          (${POWERDOWNFLAG}, typically /etc/killpower)
86 CONFIGURE_OPTIONS +=    --with-pidpath=/var/run/nut
b4f492 87 CONFIGURE_OPTIONS +=    --with-altpidpath=/var/run/nut
d102d5 88 CONFIGURE_OPTIONS +=    --with-powerdownflag=/var/run/nut/killpower
b4f492 89 CONFIGURE_OPTIONS +=    --with-statepath=/var/db/nut
d102d5 90
2313e2 91 CONFIGURE_OPTIONS +=    --with-dev
JK 92 CONFIGURE_OPTIONS +=    --with-libltdl
93 CONFIGURE_OPTIONS +=    --with-ssl
94 CONFIGURE_OPTIONS +=    --with-openssl
eac4e9 95 CONFIGURE_OPTIONS +=    --with-gd-includes=-I/usr/include/gd2
2313e2 96
d102d5 97 CONFIGURE_OPTIONS +=    --libexecdir=/usr/lib/nut/bin
6bc1e3 98 CONFIGURE_OPTIONS +=    --with-drvpath=/usr/lib/nut/bin
TM 99 CONFIGURE_OPTIONS +=    --with-cgipath=/usr/lib/nut/cgi-bin
100 CONFIGURE_OPTIONS +=    --with-gd-libs=-L/usr/lib/$(MACH64)
2313e2 101
d102d5 102 CONFIGURE_OPTIONS +=    --with-nut-scanner=yes
2313e2 103
JK 104 # Minimize guesswork: these are features we can and do build and deliver in
105 # package manifest, so the build host must have relevant packages installed
106 CONFIGURE_OPTIONS +=    --with-serial=yes
d102d5 107 #CONFIGURE_OPTIONS +=    --with-usb=yes
JK 108 CONFIGURE_OPTIONS +=    --with-usb=libusb-1.0
109 CONFIGURE_OPTIONS +=    --with-modbus=yes
2313e2 110 CONFIGURE_OPTIONS +=    --with-neon=yes
JK 111 CONFIGURE_OPTIONS +=    --with-avahi=yes
112 CONFIGURE_OPTIONS +=    --with-powerman=yes
113 CONFIGURE_OPTIONS +=    --with-cgi=yes
114 CONFIGURE_OPTIONS +=    --with-ipmi=yes
115 CONFIGURE_OPTIONS +=    --with-freeipmi=yes
116
117 # Likely we'll not have this backend working any time soon
118 CONFIGURE_OPTIONS +=    --with-linux_i2c=no
119 CONFIGURE_OPTIONS +=    --with-macosx_ups=no
120
121 # Note: Link with the correct ISA of net-snmp (for drivers) and gdlib (for cgi)
122 CONFIGURE_OPTIONS +=    --with-snmp
123 CONFIGURE_OPTIONS +=    --with-net-snmp-config=$(USRBINDIR)/net-snmp-config-$(BITS)
124
125 # Note: building the numerous documents of this projects is time-consuming
126 # and we only need one copy. Also, we don't ship "dblatex" (needed here for
127 # compiling PDFs) and probably don't require "html-chunked" chapters.
d102d5 128 CONFIGURE_OPTIONS +=    --with-doc="man=yes"
JK 129
130 # NUT-Monitor GUI client
131 CONFIGURE_OPTIONS +=    --with-nut-monitor=yes
edb9f1 132 CONFIGURE_OPTIONS +=    --with-pynut=no        # we use PyNUTClient from PyPI
d102d5 133 CONFIGURE_OPTIONS +=    --with-python2=no
JK 134 CONFIGURE_OPTIONS +=    --with-python=python$(PYTHON_VERSION)
135
136 # Be sure package is squeaky clean
137 CONFIGURE_OPTIONS +=    --enable-Werror --enable-warnings --enable-Wcolor
138 CONFIGURE_OPTIONS +=    --enable-keep_nut_report_feature
139 CONFIGURE_OPTIONS +=    --enable-silent-rules
140
141 # What do we run in case of `make check`?
142 CONFIGURE_OPTIONS +=    --enable-spellcheck
143 # NUT Integration Test suite, can take time and might fail due
144 # to environment (busy ports, congested hsots and timeouts):
145 #CONFIGURE_OPTIONS +=    --enable-check-NIT
146 # No CPPCHECK here yet:
147 CONFIGURE_OPTIONS +=    --disable-cppcheck
2313e2 148
JK 149 CONFIGURE_OPTIONS +=    $(CONFIGURE_OPTIONS.$(BITS))
d102d5 150
JK 151 # Fiddle with packaging:
152 # * move man1m pages to target directory (see also patches/07-man.patch)
153 COMPONENT_POST_INSTALL_ACTION += \
154     $(MKDIR) $(PROTOUSRSHAREMANDIR)/man1m \
155         && $(MV) $(PROTOUSRSHAREMANDIR)/man1/*.1m $(PROTOUSRSHAREMANDIR)/man1m/ \
156         || { echo "FAILED to fix up man1m" >&2 ; exit 1; } ; \
2313e2 157
eac4e9 158 # Manually added dependencies:
AW 159 REQUIRED_PACKAGES += text/asciidoc
6bc1e3 160 REQUIRED_PACKAGES += library/augeas-tools
2313e2 161
eac4e9 162 # Auto-generated dependencies
edb9f1 163 PYTHON_REQUIRED_PACKAGES += library/python/pynutclient
b94fe7 164 PYTHON_REQUIRED_PACKAGES += library/python/pyqt5
d102d5 165 PYTHON_REQUIRED_PACKAGES += runtime/python
eac4e9 166 REQUIRED_PACKAGES += $(GCC_RUNTIME_PKG)
AW 167 REQUIRED_PACKAGES += $(GXX_RUNTIME_PKG)
2313e2 168 REQUIRED_PACKAGES += library/gd
d102d5 169 REQUIRED_PACKAGES += library/libmodbus
2313e2 170 REQUIRED_PACKAGES += library/libtool/libltdl
d102d5 171 REQUIRED_PACKAGES += library/libusb-1
2313e2 172 REQUIRED_PACKAGES += library/neon
d102d5 173 REQUIRED_PACKAGES += library/security/openssl-31
eac4e9 174 REQUIRED_PACKAGES += shell/ksh93
2313e2 175 REQUIRED_PACKAGES += system/library
JK 176 REQUIRED_PACKAGES += system/library/math
177 REQUIRED_PACKAGES += system/management/freeipmi
178 REQUIRED_PACKAGES += system/management/powerman
179 REQUIRED_PACKAGES += system/management/snmp/net-snmp