sys-power/nut: Fix for slibtool

Thanks-to: orbea <orbea@riseup.net>
Upstream: https://github.com/networkupstools/nut/commit/5d98d55
Upstream: https://github.com/networkupstools/nut/commit/a0328e3
Closes: https://bugs.gentoo.org/778584
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/20689
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Lars Wendler
2021-05-04 07:16:41 -07:00
committed by Sam James
parent 915f56b619
commit a56c59f4e9
4 changed files with 98 additions and 14 deletions

View File

@@ -1,13 +0,0 @@
diff --git a/drivers/Makefile.am b/drivers/Makefile.am
index 99614ca..42b3611 100644
--- a/drivers/Makefile.am
+++ b/drivers/Makefile.am
@@ -267,5 +267,6 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
# Define a dummy library so that Automake builds rules for the
# corresponding object files. This library is not actually built,
-EXTRA_LIBRARIES = libdummy.a
-libdummy_a_SOURCES = main.c dstate.c serial.c
+EXTRA_LIBRARIES =
+#EXTRA_LIBRARIES = libdummy.a
+#libdummy_a_SOURCES = main.c dstate.c serial.c

View File

@@ -0,0 +1,35 @@
From 5d98d5536699222bc93c58c1e6f6df43dc9bfcff Mon Sep 17 00:00:00 2001
From: Arnaud Quette <arnaud.quette@free.fr>
Date: Thu, 10 Mar 2016 14:41:40 +0100
Subject: [PATCH] Fix nut-scanner compilation in some environments
Following the commits 5187dab (common: add some string-related functions) and
e767df5 (common: consolidate some string-related functions), the build rules of
nut-scanner were not updated to also use str.c. Since the libcommon.la
dependency was still there, some environments managed to build cleanly, while
other are failing. Update build dependencies to fix this situation
---
tools/nut-scanner/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am
index 558cb23b8f..db85c68287 100644
--- a/tools/nut-scanner/Makefile.am
+++ b/tools/nut-scanner/Makefile.am
@@ -14,14 +14,14 @@ libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \
scan_avahi.c scan_eaton_serial.c nutscan-serial.c \
../../drivers/serial.c \
../../drivers/bcmxcp_ser.c \
- ../../common/common.c
+ ../../common/common.c ../../common/str.c
libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS)
libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0
libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers
nut_scanner_SOURCES = nut-scanner.c
nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include
-nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la
+nut_scanner_LDADD = libnutscan.la
if WITH_SSL
libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS)

View File

@@ -0,0 +1,61 @@
From a0328e384ad3fb230c2276c8b6dd9f2c47ac07fb Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Sat, 27 Mar 2021 15:18:17 -0700
Subject: [PATCH] drivers: Fix undefined references with slibtool.
Signed-off-by: orbea <orbea@riseup.net>
---
drivers/Makefile.am | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/Makefile.am b/drivers/Makefile.am
index 40746364e3..3c2277cfc0 100644
--- a/drivers/Makefile.am
+++ b/drivers/Makefile.am
@@ -4,8 +4,8 @@
# (libtool version of the static lib, in order to access LTLIBOBJS)
#FIXME: SERLIBS is only useful for LDADD_DRIVERS_SERIAL not for LDADD_COMMON
LDADD_COMMON = ../common/libcommon.la ../common/libparseconf.la
-LDADD_DRIVERS = $(LDADD_COMMON) main.o dstate.o
-LDADD_DRIVERS_SERIAL = $(LDADD_DRIVERS) $(SERLIBS) serial.o
+LDADD_DRIVERS = libdummy.la $(LDADD_COMMON)
+LDADD_DRIVERS_SERIAL = libdummy_serial.la $(LDADD_DRIVERS) $(SERLIBS)
# most targets are drivers, so make this the default
LDADD = $(LDADD_DRIVERS_SERIAL)
@@ -109,6 +109,7 @@ bcmxcp_LDADD = $(LDADD) -lm
belkin_SOURCES = belkin.c
belkinunv_SOURCES = belkinunv.c
bestfcom_SOURCES = bestfcom.c
+bestfortress_SOURCES = bestfortress.c
bestuferrups_SOURCES = bestuferrups.c
bestups_SOURCES = bestups.c
blazer_ser_SOURCES = blazer.c blazer_ser.c
@@ -198,7 +199,6 @@ richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
riello_usb_SOURCES = riello.c riello_usb.c libusb.c usb-common.c
riello_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
-
# HID-over-serial
mge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c
# per-target CFLAGS are necessary here
@@ -253,7 +253,7 @@ nutdrv_qx_LDADD = $(LDADD_DRIVERS) -lm
nutdrv_qx_CFLAGS = $(AM_CFLAGS)
if WITH_SERIAL
nutdrv_qx_CFLAGS += -DQX_SERIAL
-nutdrv_qx_LDADD += $(SERLIBS) serial.o
+nutdrv_qx_LDADD += libdummy_serial.la $(SERLIBS)
endif
if WITH_USB
nutdrv_qx_CFLAGS += -DQX_USB
@@ -291,5 +291,8 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h bcmxcp_ser.h \
# Define a dummy library so that Automake builds rules for the
# corresponding object files. This library is not actually built,
-EXTRA_LIBRARIES = libdummy.a
-libdummy_a_SOURCES = main.c dstate.c serial.c
+EXTRA_LTLIBRARIES = libdummy.la libdummy_serial.la
+libdummy_la_SOURCES = main.c dstate.c
+libdummy_la_LDFLAGS = -no-undefined -static
+libdummy_serial_la_SOURCES = serial.c
+libdummy_serial_la_LDFLAGS = -no-undefined -static

View File

@@ -83,11 +83,12 @@ NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
PATCHES=(
"${FILESDIR}"/${PN}-2.7.2-no-libdummy.patch
"${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
"${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
"${FILESDIR}"/nut-openssl-1.1-support.patch
"${FILESDIR}"/nut-2.7.4-py3.patch
"${FILESDIR}"/nut-2.7.4-nut-scanner.patch
"${FILESDIR}"/nut-2.7.4-slibtool.patch
)
src_prepare() {