innoextract: unbreak on clang+ld.bfd archs

Innoextract used to fail to build on these archs due to undefined references at
linking time, because of the `--as-needed' linker flag. There was a powerpc
specific fix, but since then mips64 can also build innoextract.

Extend the fix by disabling optimizations on all clang+ld.bfd archs. This only
impacts mips64 now that macppc moved to ld.lld, but may be useful to sparc64
in the future if it moves to clang.

Build tested on mips64 by Yifei Zhan < openbsd () zhan ! science >, and macppc
by me (with ld.lld). There is no impact on other archs.

No objection from thfr@ (maintainer)
This commit is contained in:
cwen 2021-08-24 20:32:52 +00:00
parent 9d7aef31b0
commit de0889a5ad
2 changed files with 13 additions and 26 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.17 2020/11/05 11:23:30 sthen Exp $
# $OpenBSD: Makefile,v 1.18 2021/08/24 20:32:52 cwen Exp $
COMMENT= unpack Inno Setup installers
DISTNAME= innoextract-1.9
REVISION= 0
REVISION= 1
CATEGORIES= archivers
HOMEPAGE= https://constexpr.org/innoextract/
MAINTAINER= Thomas Frohwein <thfr@openbsd.org>
@ -38,6 +38,17 @@ CONFIGURE_ARGS+=-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
NO_TEST= Yes
.include <bsd.port.arch.mk>
# The std::unique_ptr configure test fails on ld.bfd archs using base-clang due
# to undefined references caused by the `--as-needed' linker flag. A fallback
# exists, using std::auto_ptr, but it has been disabled by C++17, thus breaking
# the build later. Use the same code as other archs instead of reenabling
# std::auto_ptr by removing the `--as-needed' linker flags to fix the build.
.if ${PROPERTIES:Mclang} && !${PROPERTIES:Mlld}
CONFIGURE_ARGS+= -DSET_OPTIMIZATION_FLAGS=OFF
.endif
do-install:
${INSTALL_PROGRAM} ${WRKBUILD}/innoextract ${PREFIX}/bin
${INSTALL_MAN} ${WRKBUILD}/innoextract.1 ${PREFIX}/man/man1

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-cmake_BuildType_cmake,v 1.1 2020/12/15 19:38:22 cwen Exp $
Fix the build on powerpc.
Should be reviewed once lld becomes the default linker on powerpc
Index: cmake/BuildType.cmake
--- cmake/BuildType.cmake.orig
+++ cmake/BuildType.cmake
@@ -301,6 +301,15 @@ else(MSVC)
if(MACOS)
# TODO For some reason this check succeeds on macOS, but then
# flag causes the actual build to fail :(
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD"
+ AND CMAKE_SYSTEM_PROCESSOR STREQUAL "powerpc")
+ # XXX Need a review once lld is the default linker on powerpc
+ # -Wl,--as-needed causes the std::unique_ptr test to
+ # fail due to undefined reference errors, and user
+ # supplied linker flags are removed during the test. A
+ # fallback exists, using std::auto_ptr, but it has been
+ # disabled by C++17. Use the same code as other archs
+ # instead of reenabling std::auto_ptr.
else()
# Link as few libraries as possible
# This is much easier than trying to decide which libraries are needed for each