kumquat-buildroot/package/apcupsd/apcupsd.mk
Fabrice Fontaine cd2dcaa6c6 package/apcupsd: set LD to TARGET_CXX
As found out by Yann E. Morin in [1], apcupsd configure script is ugly,
and uses gcc to do the link line-wrapping which will raise the following
build failure with gcc 13:

/home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64le-buildroot-linux-gnu/13.2.0/../../../../powerpc64le-buildroot-linux-gnu/bin/ld: /home/buildroot/autobuild/instance-1/output-1/host/opt/ext-toolchain/bin/../lib/gcc/powerpc64le-buildroot-linux-gnu/13.2.0/../../../../powerpc64le-buildroot-linux-gnu/lib/../lib64/libsupc++.a(eh_alloc.o): in function `std::basic_string_view<char, std::char_traits<char> >::compare(unsigned long, unsigned long, char const*, unsigned long) const':
eh_alloc.cc:(.text._ZNKSt17basic_string_viewIcSt11char_traitsIcEE7compareEmmPKcm[_ZNKSt17basic_string_viewIcSt11char_traitsIcEE7compareEmmPKcm]+0x44): undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)'

It will also raise the following build failure on sparc/arc:

/home/autobuild/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arceb-snps-linux-uclibc/9.2.1/../../../../arceb-snps-linux-uclibc/bin/ld: /home/autobuild/autobuild/instance-3/output-1/host/arceb-buildroot-linux-uclibc/sysroot/lib/libsupc++.a(eh_throw.o): in function `__exchange_and_add_dispatch':
/SCRATCH/arcjenkins2/slaves/ru20-custom-arcgnu2/workspace/arcoss_verification/arc_gnu_toolchain_release/arc_gnu_toolchain_release/bd-uclibceb/gcc-stage2/arceb-snps-linux-uclibc/libstdc++-v3/include/ext/atomicity.h:82: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
/home/autobuild/autobuild/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arceb-snps-linux-uclibc/9.2.1/../../../../arceb-snps-linux-uclibc/bin/ld: /SCRATCH/arcjenkins2/slaves/ru20-custom-arcgnu2/workspace/arcoss_verification/arc_gnu_toolchain_release/arc_gnu_toolchain_release/bd-uclibceb/gcc-stage2/arceb-snps-linux-uclibc/libstdc++-v3/include/ext/atomicity.h:82: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'

Instead of trying to patch the configure script as advocated by
Yann E. Morin, set LD to TARGET_CXX as:
 - this solution is quicker
 - usptream is dead (last release in 2016)
 - this solution has already been used in other packages (nodejs, zmqpp)

[1]: https://patchwork.ozlabs.org/project/buildroot/patch/20200812171821.2517-1-Evgeniy.Didin@synopsys.com/

Fixes:
 - http://autobuild.buildroot.org/results/6096c3ddc5edf3204635c2c90246c2e8c8e074e7
 - http://autobuild.buildroot.org/results/d8a/d8a3ab31c5b86871c7e1117f4ffa7b6cedfcb7e0/build-end.log

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-01-14 13:13:31 +01:00

84 lines
2.2 KiB
Makefile

################################################################################
#
# apcupsd
#
################################################################################
APCUPSD_VERSION = 3.14.14
APCUPSD_SITE = http://downloads.sourceforge.net/project/apcupsd/apcupsd%20-%20Stable/$(APCUPSD_VERSION)
APCUPSD_LICENSE = GPL-2.0
APCUPSD_LICENSE_FILES = COPYING
APCUPSD_CPE_ID_VENDOR = apcupsd
APCUPSD_SELINUX_MODULES = apache apcupsd
APCUPSD_CONF_OPTS = --disable-test
ifneq ($(BR2_PACKAGE_APCUPSD_MODBUS_USB)$(BR2_PACKAGE_APCUPSD_USB),)
APCUPSD_CONF_ENV += ac_cv_path_usbcfg=$(STAGING_DIR)/usr/bin/libusb-config
ifeq ($(BR2_STATIC_LIBS),y)
APCUPSD_DEPENDENCIES += host-pkgconf
APCUPSD_CONF_ENV += LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libusb`"
endif
endif
ifeq ($(BR2_PACKAGE_APCUPSD_APCSMART),y)
APCUPSD_CONF_OPTS += --enable-apcsmart
else
APCUPSD_CONF_OPTS += --disable-apcsmart
endif
ifeq ($(BR2_PACKAGE_APCUPSD_DUMB),y)
APCUPSD_CONF_OPTS += --enable-dumb
else
APCUPSD_CONF_OPTS += --disable-dumb
endif
ifeq ($(BR2_PACKAGE_APCUPSD_MODBUS_USB),y)
APCUPSD_CONF_OPTS += --enable-modbus-usb
APCUPSD_DEPENDENCIES += libusb libusb-compat
else
APCUPSD_CONF_OPTS += --disable-modbus-usb
endif
ifeq ($(BR2_PACKAGE_APCUPSD_MODBUS),y)
APCUPSD_CONF_OPTS += --enable-modbus
else
APCUPSD_CONF_OPTS += --disable-modbus
endif
ifeq ($(BR2_PACKAGE_APCUPSD_NET),y)
APCUPSD_CONF_OPTS += --enable-net
else
APCUPSD_CONF_OPTS += --disable-net
endif
ifeq ($(BR2_PACKAGE_APCUPSD_PCNET),y)
APCUPSD_CONF_OPTS += --enable-pcnet
else
APCUPSD_CONF_OPTS += --disable-pcnet
endif
ifeq ($(BR2_PACKAGE_APCUPSD_SNMP),y)
APCUPSD_CONF_OPTS += --enable-snmp
else
APCUPSD_CONF_OPTS += --disable-snmp
endif
ifeq ($(BR2_PACKAGE_APCUPSD_USB),y)
APCUPSD_CONF_OPTS += --enable-usb
APCUPSD_DEPENDENCIES += libusb libusb-compat
else
APCUPSD_CONF_OPTS += --disable-usb
endif
define APCUPSD_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) LD="$(TARGET_CXX)" -C $(@D)/src
$(TARGET_MAKE_ENV) $(MAKE) LD="$(TARGET_CXX)" -C $(@D)/platforms
endef
define APCUPSD_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/src DESTDIR=$(TARGET_DIR) install
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/platforms DESTDIR=$(TARGET_DIR) install
endef
$(eval $(autotools-package))