]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtool: Fix local testing of shared libraries on OpenBSD
authorIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Thu, 7 Nov 2024 14:29:19 +0000 (16:29 +0200)
committerIleana Dumitrescu <ileanadumitrescu95@gmail.com>
Wed, 20 Nov 2024 15:03:12 +0000 (17:03 +0200)
On OpenBSD 7.5, the shared library cache is updated with finish_cmds,
which causes the test for 'Use local version' to fail. Simply, installed
versions of shared libraries take precedence over those locally built.

To ensure local versions of shared libraries can be tested properly and
more easily, additional options have been added to libtool to skip
executing finish_cmds, like 'ldconfig -m $libdir' in OpenBSD.

* build-aux/ltmain.in: Add libtool option, '--no-finish.
* doc/libtool.texi: Document new option in libtool.
* NEWS: Update.

NEWS
build-aux/ltmain.in
doc/libtool.texi

diff --git a/NEWS b/NEWS
index 96b79902a20c57a5da146697a1234be83e74a034..f97c5e4578d535854ec83505738abfedf7d34376 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ NEWS - list of user-visible changes between releases of GNU Libtool
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** New features:
+
+  - New libtool command line flag, --no-finish, to skip executing
+    finish_cmds that would alter the shared library cache during testing.
+
 ** Bug fixes:
 
   - Fix incorrect use of workarounds designed for Darwin versions that
index 83aaaf92a7c4fe1fb1fde0b1af30c2e2dd529783..76ee77c9779548c00a8f384adc2c6da454746080 100644 (file)
@@ -139,6 +139,7 @@ usage_message="Options:
    -n, --dry-run            display commands without modifying any files
        --features           display basic configuration information and exit
        --mode=MODE          use operation mode MODE
+       --no-finish          don't update shared library cache
        --no-warnings        equivalent to '-Wnone'
        --preserve-dup-deps  don't remove duplicate dependency libraries
        --quiet, --silent    don't print informational messages
@@ -377,6 +378,7 @@ libtool_options_prep ()
     opt_mode=
     opt_preserve_dup_deps=false
     opt_quiet=false
+    opt_finishing=true
 
     nonopt=
     preserve_args=
@@ -474,6 +476,11 @@ libtool_parse_options ()
                         shift
                         ;;
 
+        --no-finish)
+                        opt_finishing=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
         --no-silent|--no-quiet)
                         opt_quiet=false
                         func_append preserve_args " $_G_opt"
@@ -2144,7 +2151,7 @@ func_mode_finish ()
       fi
     fi
 
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs" && $opt_finishing; then
       for libdir in $libdirs; do
        if test -n "$finish_cmds"; then
          # Do each command in the finish commands.
@@ -2169,6 +2176,12 @@ func_mode_finish ()
       for libdir in $libdirs; do
        $ECHO "   $libdir"
       done
+      if test "false" = "$opt_finishing"; then
+        echo
+        echo "NOTE: finish_cmds were not executed during testing, so you must"
+        echo "manually run ldconfig to add a given test directory, LIBDIR, to"
+        echo "the search path for generated executables."
+      fi
       echo
       echo "If you ever happen to want to link against installed libraries"
       echo "in a given directory, LIBDIR, you must either use libtool, and"
index 803c90aaf2364bf7c59bec884d2e457bbbb10125..953abb36b89dc9e31e8296954e509bd659c1857f 100644 (file)
@@ -1272,6 +1272,16 @@ stripped or the link will fail.  In cases where these duplications are
 required, this option will preserve them, only stripping the libraries
 that libtool knows it can safely.
 
+@item --no-finish
+Do not execute finish_cmds (disabled by default). This option is for
+specifying that testing of local changes to shared libraries is being
+performed so that ldconfig will not alter the shared library cache, which
+is an issue observed on OpenBSD 7.5. This option should be combined with
+the usage of @option{--mode=install} and @option{--mode=finish} to have
+any effect. Prior to utilizing this option, the shared library cache must
+not contain links to the listed install directory for shared libraries
+undergoing testing; otherwise, it will have no useful effect.
+
 @item --quiet
 @itemx --silent
 Do not print out any progress or informational messages.
@@ -6855,7 +6865,8 @@ shell does not support the shell option @code{nocaseglob}, making
 
 @defvar finish_cmds
 Commands to tell the dynamic linker how to find shared libraries in a
-specific directory.
+specific directory. These commands can be disabled during testing local
+changes to shared libraries with @option{--no-finish}.
 @end defvar
 
 @defvar finish_eval