This is an automated email from the ASF dual-hosted git repository. jimjag pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit aa60cec58cfe1440733603fd4097d36d5d1eef29 Author: Jim Jagielski <[email protected]> AuthorDate: Thu Aug 6 15:30:18 2026 -0400 --with-static-system-libs: accept NAME:DIR, and support libiconv iconv is only ever pulled in as a transitive dep of the XML libs and has no --with-system-libiconv, so it has no prefix of its own -- hence the NAME:DIR form, e.g. --with-static-system-libs=libiconv:/usr/local. Pinning it rewrites -liconv in the libxml/libxslt/curl link flags and in the bundled-libxml2 macOS path in RepositoryExternal.mk and libs.mk. The SDK ships only a .tbd stub for the iconv dylib, so there is no system libiconv.a to fall back on; without a prefix the link stays -liconv. --- main/RepositoryExternal.mk | 12 ++++++++++- main/configure.ac | 53 +++++++++++++++++++++++++++++++++++++++------- main/set_soenv.in | 2 ++ main/solenv/inc/libs.mk | 6 ++++++ 4 files changed, 64 insertions(+), 9 deletions(-) diff --git a/main/RepositoryExternal.mk b/main/RepositoryExternal.mk index 523065187d..a8b4216f04 100644 --- a/main/RepositoryExternal.mk +++ b/main/RepositoryExternal.mk @@ -160,10 +160,20 @@ ifeq ($(OS),MACOSX) # not a dylib, so it can't be a PLAINLIB like the else-branch below. A static # archive carries no transitive deps, so its own libxml-2.0.pc's # "Libs.private: -lpthread -liconv -lm" must be added explicitly. +# +# --with-static-system-libs=libiconv:DIR pins iconv to that archive; the SDK +# ships only a .tbd stub for the dylib, so there is no system libiconv.a to +# fall back on. +ifeq ($(STATIC_SYSTEM_LIBICONV),YES) +gb_libiconv_lib := $(LIBICONV_PREFIX)/lib/libiconv.a +else +gb_libiconv_lib := -liconv +endif + define gb_LinkTarget__use_libxml2 $(call gb_LinkTarget_add_libs,$(1),\ $(OUTDIR)/lib/libxml2.a \ - -lpthread -liconv -lm \ + -lpthread $(gb_libiconv_lib) -lm \ ) endef diff --git a/main/configure.ac b/main/configure.ac index f560a33bfb..74ac4ec1a8 100644 --- a/main/configure.ac +++ b/main/configure.ac @@ -444,11 +444,16 @@ AC_ARG_WITH(system-libxml, AC_ARG_WITH(static-system-libs, [ --with-static-system-libs=LIST Comma-separated list of system libraries to link - statically, e.g. "libxml,libxslt,curl". Supported: - libxml, libxslt, curl. Without this the archive is - used only when the prefix happens to have no dylib, - so a dylib appearing there silently switches the - build to dynamic linking. + statically, each NAME or NAME:DIR, e.g. + "libxml,libxslt,curl,libiconv:/usr/local". + Supported: libxml, libxslt, curl, libiconv. + NAME alone uses the prefix the matching + --with-system-NAME resolved; libiconv has no such + option, so it always needs the :DIR form. Without + this the archive is used only when the prefix + happens to have no dylib, so a dylib appearing + there silently switches the build to dynamic + linking. ],,) AC_ARG_WITH(system-python, [ --with-system-python Use python already on system @@ -4755,11 +4760,21 @@ STATIC_SYSTEM_LIBS= STATIC_SYSTEM_LIBXML=NO STATIC_SYSTEM_LIBXSLT=NO STATIC_SYSTEM_CURL=NO +STATIC_SYSTEM_LIBICONV=NO +LIBICONV_PREFIX= if test -n "$with_static_system_libs" -a "$with_static_system_libs" != "no"; then if test "$with_static_system_libs" = "yes"; then AC_MSG_ERROR([--with-static-system-libs needs a list, e.g. --with-static-system-libs=libxml,libxslt,curl]) fi - for _sslib in `echo "$with_static_system_libs" | $SED -e 's/,/ /g'`; do + for _ssentry in `echo "$with_static_system_libs" | $SED -e 's/,/ /g'`; do + dnl Each entry is NAME or NAME:DIR. The explicit DIR is what makes + dnl libiconv usable here: it has no --with-system-libiconv, so + dnl configure has no prefix of its own to fall back on. + _sslib=`echo "$_ssentry" | $SED -e 's/:.*//'` + _ssgiven= + case "$_ssentry" in + *:*) _ssgiven=`echo "$_ssentry" | $SED -e 's/^[[^:]]*://'` ;; + esac AC_MSG_CHECKING([for a static system $_sslib]) case "$_sslib" in libxml) @@ -4774,15 +4789,27 @@ if test -n "$with_static_system_libs" -a "$with_static_system_libs" != "no"; the _ssenabled="$SYSTEM_CURL"; _ssprefix="$CURL_PREFIX"; _ssopt="--with-system-curl" _ssarchives="libcurl.a"; _sslflags="-lcurl" ;; + libiconv) + dnl No --with-system-libiconv exists: iconv is only ever pulled in + dnl as a transitive dep of the XML libs, so there is nothing to + dnl enable and the prefix must be given as libiconv:DIR. + _ssenabled=YES; _ssprefix="$_ssgiven"; _ssopt= + _ssarchives="libiconv.a"; _sslflags="-liconv" + ;; *) - AC_MSG_ERROR([unsupported library "$_sslib" in --with-static-system-libs; supported: libxml, libxslt, curl]) + AC_MSG_ERROR([unsupported library "$_sslib" in --with-static-system-libs; supported: libxml, libxslt, curl, libiconv]) ;; esac + test -n "$_ssgiven" && _ssprefix="$_ssgiven" if test "$_ssenabled" != "YES"; then AC_MSG_ERROR([--with-static-system-libs=$_sslib requires $_ssopt]) fi if test -z "$_ssprefix"; then - AC_MSG_ERROR([--with-static-system-libs=$_sslib needs a prefix; give $_ssopt=DIR (macOS only)]) + if test -n "$_ssopt"; then + AC_MSG_ERROR([--with-static-system-libs=$_sslib needs a prefix; give $_ssopt=DIR (macOS only)]) + else + AC_MSG_ERROR([--with-static-system-libs=$_sslib needs a prefix; write $_sslib:DIR, e.g. $_sslib:/usr/local]) + fi fi for _ssa in $_ssarchives; do if test ! -f "$_ssprefix/lib/$_ssa"; then @@ -4801,12 +4828,20 @@ if test -n "$with_static_system_libs" -a "$with_static_system_libs" != "no"; the libxml) LIBXML_LIBS=`echo "$LIBXML_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` ;; libxslt) LIBXSLT_LIBS=`echo "$LIBXSLT_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` ;; curl) CURL_LIBS=`echo "$CURL_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` ;; + libiconv) + dnl iconv is a transitive dep, so -liconv turns up in whichever + dnl of these *-config reported it -- rewrite all of them. + LIBXML_LIBS=`echo "$LIBXML_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` + LIBXSLT_LIBS=`echo "$LIBXSLT_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` + CURL_LIBS=`echo "$CURL_LIBS " | $SED -e "s|$_ssl |$_ssprefix/lib/$_ssa |g" -e 's| *$||'` + ;; esac done case "$_sslib" in libxml) STATIC_SYSTEM_LIBXML=YES ;; libxslt) STATIC_SYSTEM_LIBXSLT=YES ;; curl) STATIC_SYSTEM_CURL=YES ;; + libiconv) STATIC_SYSTEM_LIBICONV=YES; LIBICONV_PREFIX="$_ssprefix" ;; esac STATIC_SYSTEM_LIBS="$STATIC_SYSTEM_LIBS $_sslib" AC_MSG_RESULT([$_ssprefix/lib]) @@ -4817,6 +4852,8 @@ AC_SUBST(STATIC_SYSTEM_LIBS) AC_SUBST(STATIC_SYSTEM_LIBXML) AC_SUBST(STATIC_SYSTEM_LIBXSLT) AC_SUBST(STATIC_SYSTEM_CURL) +AC_SUBST(STATIC_SYSTEM_LIBICONV) +AC_SUBST(LIBICONV_PREFIX) dnl =================================================================== dnl Check for system mdds diff --git a/main/set_soenv.in b/main/set_soenv.in index 14157e0381..6c7203db7b 100644 --- a/main/set_soenv.in +++ b/main/set_soenv.in @@ -1989,6 +1989,8 @@ ToFile( "STATIC_SYSTEM_LIBS", "@STATIC_SYSTEM_LIBS@", "e" ); ToFile( "STATIC_SYSTEM_LIBXML", "@STATIC_SYSTEM_LIBXML@", "e" ); ToFile( "STATIC_SYSTEM_LIBXSLT","@STATIC_SYSTEM_LIBXSLT@","e" ); ToFile( "STATIC_SYSTEM_CURL", "@STATIC_SYSTEM_CURL@", "e" ); +ToFile( "STATIC_SYSTEM_LIBICONV","@STATIC_SYSTEM_LIBICONV@","e" ); +ToFile( "LIBICONV_PREFIX", "@LIBICONV_PREFIX@", "e" ); ToFile( "SYSTEM_EXPAT", "@SYSTEM_EXPAT@", "e" ); ToFile( "ENABLE_MYSQLC", "@ENABLE_MYSQLC@", "e" ); ToFile( "SYSTEM_MYSQL", "@SYSTEM_MYSQL@", "e" ); diff --git a/main/solenv/inc/libs.mk b/main/solenv/inc/libs.mk index e7051a7b4e..e6ba0b20c5 100644 --- a/main/solenv/inc/libs.mk +++ b/main/solenv/inc/libs.mk @@ -178,7 +178,13 @@ LIBXML2LIB=$(LIBXML_LIBS:s/-licuuc//) .IF "$(OS)"=="MACOSX" # Bundled libxml2 is a static archive on macOS (main/libxml2/makefile.mk), which # carries no transitive deps -- add what its own .pc's Libs.private needs. +# --with-static-system-libs=libiconv:DIR pins iconv to that archive; the SDK +# ships only a .tbd stub for the dylib, so there is no system libiconv.a. +.IF "$(STATIC_SYSTEM_LIBICONV)"=="YES" +LIBXML2LIB=-lxml2 -lpthread $(LIBICONV_PREFIX)/lib/libiconv.a -lm +.ELSE LIBXML2LIB=-lxml2 -lpthread -liconv -lm +.ENDIF .ELSE LIBXML2LIB=-lxml2 .ENDIF
