pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc mk: Add OPSYS_EXPLICIT_LIBDEPS and enable on SunOS.
details: https://anonhg.NetBSD.org/pkgsrc/rev/35acd06ded4a
branches: trunk
changeset: 382938:35acd06ded4a
user: jperkin <jperkin%pkgsrc.org@localhost>
date: Tue Aug 09 11:31:14 2022 +0000
description:
mk: Add OPSYS_EXPLICIT_LIBDEPS and enable on SunOS.
Most systems use GNU ld, which will happily pull in symbols required by a
program even if they are only available via implicit library dependencies. The
SunOS linker is stricter, and if a program uses a symbol then the library that
defines that symbol must be an explicit dependency.
This mostly causes problems with libiconv and libintl, both of which Linux
bundles in its C library, so a lot of third-party software does not correctly
check for them. Until now we've had to add many, many overrides, along with
variables such as BROKEN_GETTEXT_DETECTION which nowadays only has limited
effectiveness.
The situation appears to be getting worse, especially with software built with
meson, and so both libiconv and gettext-lib will now automatically add the
correct LDFLAGS if the OPSYS sets OPSYS_EXPLICIT_LIBDEPS=yes.
This isn't perfect. For one it isn't really an OPSYS setting as you can try to
use GNU ld on SunOS, it just doesn't work very well. It should also really be
done via the wrappers rather than exposing LDFLAGS, but we do not yet have an
approved patch for doing this. However it does improve the current situation.
diffstat:
converters/libiconv/buildlink3.mk | 20 +++++++++++++++++++-
devel/gettext-lib/buildlink3.mk | 17 ++++++++++++++++-
mk/platform/SunOS.mk | 5 ++++-
3 files changed, 39 insertions(+), 3 deletions(-)
diffs (84 lines):
diff -r d390c758a3cd -r 35acd06ded4a converters/libiconv/buildlink3.mk
--- a/converters/libiconv/buildlink3.mk Tue Aug 09 06:38:01 2022 +0000
+++ b/converters/libiconv/buildlink3.mk Tue Aug 09 11:31:14 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.26 2009/03/20 19:24:03 joerg Exp $
+# $NetBSD: buildlink3.mk,v 1.27 2022/08/09 11:31:14 jperkin Exp $
BUILDLINK_TREE+= iconv
@@ -10,6 +10,24 @@
BUILDLINK_PKGSRCDIR.iconv?= ../../converters/libiconv
BUILDLINK_LIBNAME.iconv= iconv
BUILDLINK_LDADD.iconv= ${BUILDLINK_LIBNAME.iconv:S/^/-l/:S/^-l$//}
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+#
+# Due to Linux shipping libiconv in libc, third-party software often forgets to
+# explicitly look for and add -liconv when required. On systems that use GNU
+# ld this isn't always an issue as it will often be pulled in via an explicit
+# library, but some systems have a stricter linker that will not pull in
+# symbols via implicit dependencies, and so we need to explicitly link here.
+#
+# Ideally this would be done via CWRAPPERS_LDADD to avoid leaking into LDFLAGS
+# but there is no concensus on that yet.
+#
+.if ${OPSYS_EXPLICIT_LIBDEPS:Uno:tl} == "yes"
+BUILDLINK_LDFLAGS.iconv+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.iconv}/lib
+BUILDLINK_LDFLAGS.iconv+= ${BUILDLINK_LDADD.iconv}
+.endif
+
.endif # ICONV_BUILDLINK3_MK
BUILDLINK_TREE+= -iconv
diff -r d390c758a3cd -r 35acd06ded4a devel/gettext-lib/buildlink3.mk
--- a/devel/gettext-lib/buildlink3.mk Tue Aug 09 06:38:01 2022 +0000
+++ b/devel/gettext-lib/buildlink3.mk Tue Aug 09 11:31:14 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.40 2019/11/03 10:39:12 rillig Exp $
+# $NetBSD: buildlink3.mk,v 1.41 2022/08/09 11:31:14 jperkin Exp $
BUILDLINK_TREE+= gettext
@@ -27,6 +27,21 @@
CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}"
.endif
+#
+# Due to Linux shipping libintl in libc, third-party software often forgets to
+# explicitly look for and add -lintl when required. On systems that use GNU
+# ld this isn't always an issue as it will often be pulled in via an explicit
+# library, but some systems have a stricter linker that will not pull in
+# symbols via implicit dependencies, and so we need to explicitly link here.
+#
+# Ideally this would be done via CWRAPPERS_LDADD to avoid leaking into LDFLAGS
+# but there is no concensus on that yet.
+#
+.if ${OPSYS_EXPLICIT_LIBDEPS:Uno:tl} == "yes"
+BUILDLINK_LDFLAGS.gettext+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.gettext}/lib
+BUILDLINK_LDFLAGS.gettext+= ${BUILDLINK_LDADD.gettext}
+.endif
+
CHECK_BUILTIN.gettext:= yes
.include "../../devel/gettext-lib/builtin.mk"
CHECK_BUILTIN.gettext:= no
diff -r d390c758a3cd -r 35acd06ded4a mk/platform/SunOS.mk
--- a/mk/platform/SunOS.mk Tue Aug 09 06:38:01 2022 +0000
+++ b/mk/platform/SunOS.mk Tue Aug 09 11:31:14 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: SunOS.mk,v 1.82 2021/11/29 16:14:23 jperkin Exp $
+# $NetBSD: SunOS.mk,v 1.83 2022/08/09 11:31:14 jperkin Exp $
#
# Variable definitions for the SunOS/Solaris operating system.
@@ -139,6 +139,9 @@
_OPSYS_SUPPORTS_SSP?= yes # Requires GCC
_OPSYS_CAN_CHECK_SHLIBS= yes # Requires readelf
+# The Solaris/illumos linker requires explicit library dependencies.
+OPSYS_EXPLICIT_LIBDEPS= yes
+
# check for maximum command line length and set it in configure's environment,
# to avoid a test required by the libtool script that takes forever.
# FIXME: Adjust to work on this system and enable the lines below.
Home |
Main Index |
Thread Index |
Old Index