summaryrefslogtreecommitdiff
path: root/converters/libiconv
diff options
context:
space:
mode:
authorjperkin <jperkin@pkgsrc.org>2022-08-09 11:31:14 +0000
committerjperkin <jperkin@pkgsrc.org>2022-08-09 11:31:14 +0000
commitde2c929e25f15120e317bd40fdb81f8e0839d938 (patch)
tree22e7f9244386c1988d9142db8f5d69f5220f13c6 /converters/libiconv
parentecc3fa2c92a5bb2a288c0d579ce803fcbb35b53a (diff)
downloadpkgsrc-de2c929e25f15120e317bd40fdb81f8e0839d938.tar.gz
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 (limited to 'converters/libiconv')
-rw-r--r--converters/libiconv/buildlink3.mk20
1 files changed, 19 insertions, 1 deletions
diff --git a/converters/libiconv/buildlink3.mk b/converters/libiconv/buildlink3.mk
index bd61139690a..98e732f49ed 100644
--- a/converters/libiconv/buildlink3.mk
+++ b/converters/libiconv/buildlink3.mk
@@ -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_ABI_DEPENDS.iconv+= libiconv>=1.9.1nb4
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