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.diff -r1.26 -r1.27 pkgsrc/converters/libiconv/buildlink3.mk
(jperkin)
@@ -1,15 +1,33 @@ | @@ -1,15 +1,33 @@ | |||
1 | # $NetBSD: buildlink3.mk,v 1.26 2009/03/20 19:24:03 joerg Exp $ | 1 | # $NetBSD: buildlink3.mk,v 1.27 2022/08/09 11:31:14 jperkin Exp $ | |
2 | 2 | |||
3 | BUILDLINK_TREE+= iconv | 3 | BUILDLINK_TREE+= iconv | |
4 | 4 | |||
5 | .if !defined(ICONV_BUILDLINK3_MK) | 5 | .if !defined(ICONV_BUILDLINK3_MK) | |
6 | ICONV_BUILDLINK3_MK:= | 6 | ICONV_BUILDLINK3_MK:= | |
7 | 7 | |||
8 | BUILDLINK_API_DEPENDS.iconv+= libiconv>=1.9.1 | 8 | BUILDLINK_API_DEPENDS.iconv+= libiconv>=1.9.1 | |
9 | BUILDLINK_ABI_DEPENDS.iconv+= libiconv>=1.9.1nb4 | 9 | BUILDLINK_ABI_DEPENDS.iconv+= libiconv>=1.9.1nb4 | |
10 | BUILDLINK_PKGSRCDIR.iconv?= ../../converters/libiconv | 10 | BUILDLINK_PKGSRCDIR.iconv?= ../../converters/libiconv | |
11 | BUILDLINK_LIBNAME.iconv= iconv | 11 | BUILDLINK_LIBNAME.iconv= iconv | |
12 | BUILDLINK_LDADD.iconv= ${BUILDLINK_LIBNAME.iconv:S/^/-l/:S/^-l$//} | 12 | BUILDLINK_LDADD.iconv= ${BUILDLINK_LIBNAME.iconv:S/^/-l/:S/^-l$//} | |
13 | ||||
14 | .include "../../mk/bsd.fast.prefs.mk" | |||
15 | ||||
16 | # | |||
17 | # Due to Linux shipping libiconv in libc, third-party software often forgets to | |||
18 | # explicitly look for and add -liconv when required. On systems that use GNU | |||
19 | # ld this isn't always an issue as it will often be pulled in via an explicit | |||
20 | # library, but some systems have a stricter linker that will not pull in | |||
21 | # symbols via implicit dependencies, and so we need to explicitly link here. | |||
22 | # | |||
23 | # Ideally this would be done via CWRAPPERS_LDADD to avoid leaking into LDFLAGS | |||
24 | # but there is no concensus on that yet. | |||
25 | # | |||
26 | .if ${OPSYS_EXPLICIT_LIBDEPS:Uno:tl} == "yes" | |||
27 | BUILDLINK_LDFLAGS.iconv+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.iconv}/lib | |||
28 | BUILDLINK_LDFLAGS.iconv+= ${BUILDLINK_LDADD.iconv} | |||
29 | .endif | |||
30 | ||||
13 | .endif # ICONV_BUILDLINK3_MK | 31 | .endif # ICONV_BUILDLINK3_MK | |
14 | 32 | |||
15 | BUILDLINK_TREE+= -iconv | 33 | BUILDLINK_TREE+= -iconv |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: buildlink3.mk,v 1.40 2019/11/03 10:39:12 rillig Exp $ | 1 | # $NetBSD: buildlink3.mk,v 1.41 2022/08/09 11:31:14 jperkin Exp $ | |
2 | 2 | |||
3 | BUILDLINK_TREE+= gettext | 3 | BUILDLINK_TREE+= gettext | |
4 | 4 | |||
5 | .if !defined(GETTEXT_BUILDLINK3_MK) | 5 | .if !defined(GETTEXT_BUILDLINK3_MK) | |
6 | GETTEXT_BUILDLINK3_MK:= | 6 | GETTEXT_BUILDLINK3_MK:= | |
7 | 7 | |||
8 | BUILDLINK_API_DEPENDS.gettext+= gettext-lib>=0.18 | 8 | BUILDLINK_API_DEPENDS.gettext+= gettext-lib>=0.18 | |
9 | BUILDLINK_ABI_DEPENDS.gettext+= gettext-lib>=0.18 | 9 | BUILDLINK_ABI_DEPENDS.gettext+= gettext-lib>=0.18 | |
10 | BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib | 10 | BUILDLINK_PKGSRCDIR.gettext?= ../../devel/gettext-lib | |
11 | BUILDLINK_LIBNAME.gettext= intl | 11 | BUILDLINK_LIBNAME.gettext= intl | |
12 | BUILDLINK_LDADD.gettext= ${BUILDLINK_LIBNAME.gettext:S/^/-l/:S/^-l$//} | 12 | BUILDLINK_LDADD.gettext= ${BUILDLINK_LIBNAME.gettext:S/^/-l/:S/^-l$//} | |
13 | BUILDLINK_LDADD.gettext+= ${BUILDLINK_LDADD.iconv} | 13 | BUILDLINK_LDADD.gettext+= ${BUILDLINK_LDADD.iconv} | |
14 | 14 | |||
@@ -17,26 +17,41 @@ BUILDLINK_LDADD.gettext+= ${BUILDLINK_LD | @@ -17,26 +17,41 @@ BUILDLINK_LDADD.gettext+= ${BUILDLINK_LD | |||
17 | # Some GNU configure scripts generated with an older and broken gettext.m4 | 17 | # Some GNU configure scripts generated with an older and broken gettext.m4 | |
18 | # fail to detect if gettext is present or not because it fails to add | 18 | # fail to detect if gettext is present or not because it fails to add | |
19 | # "-lintl" to the linker command line. | 19 | # "-lintl" to the linker command line. | |
20 | # | 20 | # | |
21 | # If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl" | 21 | # If BROKEN_GETTEXT_DETECTION is "yes", then automatically add "-lintl" | |
22 | # to LIBS to workaround this brokenness. | 22 | # to LIBS to workaround this brokenness. | |
23 | # | 23 | # | |
24 | BROKEN_GETTEXT_DETECTION?= no | 24 | BROKEN_GETTEXT_DETECTION?= no | |
25 | .if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) | 25 | .if !empty(BROKEN_GETTEXT_DETECTION:M[yY][eE][sS]) | |
26 | BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} | 26 | BUILDLINK_LIBS.gettext+= ${BUILDLINK_LDADD.gettext} | |
27 | CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" | 27 | CONFIGURE_ENV+= INTLLIBS="${BUILDLINK_LDADD.gettext}" | |
28 | .endif | 28 | .endif | |
29 | 29 | |||
30 | # | |||
31 | # Due to Linux shipping libintl in libc, third-party software often forgets to | |||
32 | # explicitly look for and add -lintl when required. On systems that use GNU | |||
33 | # ld this isn't always an issue as it will often be pulled in via an explicit | |||
34 | # library, but some systems have a stricter linker that will not pull in | |||
35 | # symbols via implicit dependencies, and so we need to explicitly link here. | |||
36 | # | |||
37 | # Ideally this would be done via CWRAPPERS_LDADD to avoid leaking into LDFLAGS | |||
38 | # but there is no concensus on that yet. | |||
39 | # | |||
40 | .if ${OPSYS_EXPLICIT_LIBDEPS:Uno:tl} == "yes" | |||
41 | BUILDLINK_LDFLAGS.gettext+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.gettext}/lib | |||
42 | BUILDLINK_LDFLAGS.gettext+= ${BUILDLINK_LDADD.gettext} | |||
43 | .endif | |||
44 | ||||
30 | CHECK_BUILTIN.gettext:= yes | 45 | CHECK_BUILTIN.gettext:= yes | |
31 | .include "../../devel/gettext-lib/builtin.mk" | 46 | .include "../../devel/gettext-lib/builtin.mk" | |
32 | CHECK_BUILTIN.gettext:= no | 47 | CHECK_BUILTIN.gettext:= no | |
33 | 48 | |||
34 | # A built-in gettext is always going to use a built-in iconv. | 49 | # A built-in gettext is always going to use a built-in iconv. | |
35 | .if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) | 50 | .if !empty(USE_BUILTIN.gettext:M[yY][eE][sS]) | |
36 | USE_BUILTIN.iconv= yes | 51 | USE_BUILTIN.iconv= yes | |
37 | .else | 52 | .else | |
38 | #BUILDLINK_INCDIRS.gettext+= include/gettext | 53 | #BUILDLINK_INCDIRS.gettext+= include/gettext | |
39 | BUILDLINK_FNAME_TRANSFORM.gettext+= -e 's|include/gettext/|include/|' | 54 | BUILDLINK_FNAME_TRANSFORM.gettext+= -e 's|include/gettext/|include/|' | |
40 | .endif | 55 | .endif | |
41 | 56 | |||
42 | .include "../../converters/libiconv/buildlink3.mk" | 57 | .include "../../converters/libiconv/buildlink3.mk" |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: SunOS.mk,v 1.82 2021/11/29 16:14:23 jperkin Exp $ | 1 | # $NetBSD: SunOS.mk,v 1.83 2022/08/09 11:31:14 jperkin Exp $ | |
2 | # | 2 | # | |
3 | # Variable definitions for the SunOS/Solaris operating system. | 3 | # Variable definitions for the SunOS/Solaris operating system. | |
4 | 4 | |||
5 | ECHO_N?= ${ECHO} -n | 5 | ECHO_N?= ${ECHO} -n | |
6 | IMAKE_MAKE?= ${MAKE} # program which gets invoked by imake | 6 | IMAKE_MAKE?= ${MAKE} # program which gets invoked by imake | |
7 | PKGLOCALEDIR?= lib | 7 | PKGLOCALEDIR?= lib | |
8 | PS?= /bin/ps | 8 | PS?= /bin/ps | |
9 | # XXX: default from defaults/mk.conf. Verify/correct for this platform | 9 | # XXX: default from defaults/mk.conf. Verify/correct for this platform | |
10 | # and remove this comment. | 10 | # and remove this comment. | |
11 | SU?= /usr/bin/su | 11 | SU?= /usr/bin/su | |
12 | TYPE?= /usr/bin/type | 12 | TYPE?= /usr/bin/type | |
13 | 13 | |||
14 | CATMAN_SECTION_SUFFIX?= yes | 14 | CATMAN_SECTION_SUFFIX?= yes | |
@@ -129,17 +129,20 @@ _OPSYS_SYSTEM_RPATH?= /lib${LIBABISUFFIX | @@ -129,17 +129,20 @@ _OPSYS_SYSTEM_RPATH?= /lib${LIBABISUFFIX | |||
129 | _OPSYS_LIB_DIRS?= /lib${LIBABISUFFIX} /usr/lib${LIBABISUFFIX} | 129 | _OPSYS_LIB_DIRS?= /lib${LIBABISUFFIX} /usr/lib${LIBABISUFFIX} | |
130 | _OPSYS_INCLUDE_DIRS?= /usr/include | 130 | _OPSYS_INCLUDE_DIRS?= /usr/include | |
131 | 131 | |||
132 | # Sun Studio support is untested at this time, but would be strongly desired. | 132 | # Sun Studio support is untested at this time, but would be strongly desired. | |
133 | .if ${PKGSRC_COMPILER} != "sunpro" | 133 | .if ${PKGSRC_COMPILER} != "sunpro" | |
134 | _OPSYS_SUPPORTS_CWRAPPERS= yes | 134 | _OPSYS_SUPPORTS_CWRAPPERS= yes | |
135 | .endif | 135 | .endif | |
136 | 136 | |||
137 | _OPSYS_SUPPORTS_CTF= yes # Compact Type Format conversion. | 137 | _OPSYS_SUPPORTS_CTF= yes # Compact Type Format conversion. | |
138 | _OPSYS_SUPPORTS_FORTIFY= yes # Requires GCC | 138 | _OPSYS_SUPPORTS_FORTIFY= yes # Requires GCC | |
139 | _OPSYS_SUPPORTS_SSP?= yes # Requires GCC | 139 | _OPSYS_SUPPORTS_SSP?= yes # Requires GCC | |
140 | _OPSYS_CAN_CHECK_SHLIBS= yes # Requires readelf | 140 | _OPSYS_CAN_CHECK_SHLIBS= yes # Requires readelf | |
141 | 141 | |||
142 | # The Solaris/illumos linker requires explicit library dependencies. | |||
143 | OPSYS_EXPLICIT_LIBDEPS= yes | |||
144 | ||||
142 | # check for maximum command line length and set it in configure's environment, | 145 | # check for maximum command line length and set it in configure's environment, | |
143 | # to avoid a test required by the libtool script that takes forever. | 146 | # to avoid a test required by the libtool script that takes forever. | |
144 | # FIXME: Adjust to work on this system and enable the lines below. | 147 | # FIXME: Adjust to work on this system and enable the lines below. | |
145 | #_OPSYS_MAX_CMDLEN_CMD= /sbin/sysctl -n kern.argmax | 148 | #_OPSYS_MAX_CMDLEN_CMD= /sbin/sysctl -n kern.argmax |