- New libtool command line flags, --test and --check, to skip executing
finish_cmds that would alter the shared library cache during testing.
+ - New libtool command line flag, --reorder-cache=DIRS, to reorder the
+ shared library cache, only on OpenBSD.
+
** Bug fixes:
- Fix incorrect use of workarounds designed for Darwin versions that
--mode=MODE use operation mode MODE
--no-warnings equivalent to '-Wnone'
--preserve-dup-deps don't remove duplicate dependency libraries
+ --reorder-cache=DIRS reorder shared library cache for preferred DIRS
--test, --check don't update shared library cache during testing
--quiet, --silent don't print informational messages
--tag=TAG use configuration variables from tag TAG
opt_dry_run=false
opt_help=false
opt_mode=
+ opt_reorder_cache=false
opt_preserve_dup_deps=false
opt_quiet=false
opt_testing=true
func_append preserve_args " $_G_opt"
;;
+ --reorder-cache)
+ opt_reorder_cache=true
+ shared_lib_dirs=$1
+ if test -n "$shared_lib_dirs"; then
+ case $1 in
+ # Must begin with /:
+ /*) ;;
+
+ # Catch anything else as an error (relative paths)
+ *) func_warning "invalid argument '$1' for $_G_opt"
+ func_warning "absolute paths are required for $_G_opt"
+ exit_cmd=exit
+ break
+ ;;
+ esac
+ fi
+ ;;
+
--silent|--quiet)
opt_quiet=:
opt_verbose=false
# end func_convert_path_front_back_pathsep
+# func_convert_delimited_path PATH ORIG_DELIMITER NEW_DELIMITER
+# Replaces a delimiter for a given path.
+func_convert_delimited_path ()
+{
+ converted_path=`$ECHO "$1" | $SED "s#$2#$3#g"`
+}
+# end func_convert_delimited_path
+
+
##################################################
# $build to $host FILE NAME CONVERSION FUNCTIONS #
##################################################
}
+# func_reorder_shared_lib_cache DIRS
+# Reorder the shared library cache by unconfiguring previous shared library cache
+# and configuring preferred search directories before previous search directories.
+# Previous shared library cache: /usr/lib /usr/local/lib
+# Preferred search directories: /tmp/testing
+# Reordered shared library cache: /tmp/testing /usr/lib /usr/local/lib
+func_reorder_shared_lib_cache ()
+{
+ $debug_cmd
+
+ case $host_os in
+ openbsd*)
+ get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"`
+ func_convert_delimited_path "$get_search_directories" ':' '\ '
+ save_search_directories=$converted_path
+ func_convert_delimited_path "$1" ':' '\ '
+
+ # Ensure directories exist
+ for dir in $converted_path; do
+ # Ensure each directory is an absolute path
+ case $dir in
+ /*) ;;
+ *) func_warning "Directory '$dir' is not an absolute path"
+ exit $EXIT_FAILURE ;;
+ esac
+ # Ensure no trailing slashes
+ func_stripname '' '/' "$dir"
+ dir=$func_stripname_result
+ if test -d "$dir"; then
+ if test -n "$preferred_search_directories"; then
+ preferred_search_directories="$preferred_search_directories $dir"
+ else
+ preferred_search_directories=$dir
+ fi
+ else
+ func_warning "Directory '$dir' does not exist"
+ exit $EXIT_FAILURE
+ fi
+ done
+
+ PATH="$PATH:/sbin" ldconfig -U $save_search_directories
+ PATH="$PATH:/sbin" ldconfig -m $preferred_search_directories $save_search_directories
+ get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"`
+ func_convert_delimited_path "$get_search_directories" ':' '\ '
+ reordered_search_directories=$converted_path
+
+ $ECHO "Original: $save_search_directories"
+ $ECHO "Reordered: $reordered_search_directories"
+ exit $EXIT_SUCCESS
+ ;;
+ *)
+ func_warning "--reorder-cache is not supported for host_os=$host_os."
+ exit $EXIT_FAILURE
+ ;;
+ esac
+}
+# end func_reorder_shared_lib_cache
+
+
# func_mode_compile arg...
func_mode_compile ()
{
fi
+# If option '--reorder-cache', reorder the shared library cache and exit.
+if $opt_reorder_cache; then
+ func_reorder_shared_lib_cache $shared_lib_dirs
+fi
+
+
# func_mode_execute arg...
func_mode_execute ()
{
@item --test
@itemx --check
Do not execute finish_cmds (disabled by default). This option is for
-specifying that the testsuite is executing so that ldconfig will not alter
-the shared library cache, which is an issue observed on OpenBSD 7.5.
+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. The shared
+library cache can be reordered to prefer directories for testing shared
+libraries over the directories already listed in the shared library cache
+with @option{--reorder-cache=@var{shared_lib_dirs}}.
+
+@item --reorder-cache=@var{shared_lib_dirs}
+Reorder the shared library cache by providing the preferred directories
+(@var{shared_lib_dirs}) to link shared libraries from. The previous
+shared library cache is unconfigured, and the preferred directories are
+configured with the previous directories appended to the end (if not in
+the preferred directory list)@footnote{Additionally, all directories
+that no longer exist will be removed from the shared library cache.}.
+This option is currently only available on OpenBSD where @code{make
+install} has been required before @code{make check} for the shared
+library cache to be updated.
+
+This option is essentially a wrapper for executing @command{ldconfig},
+and it should be used as an independent option before and after testing
+changes to shared libraries. Below are some usage examples:
+
+@example
+$ @kbd{libtool --reorder-cache=/tmp/testing}
+Original: /usr/lib /usr/X11R6/lib /usr/local/lib
+Reordered: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
+$ @kbd{libtool --reorder-cache=/usr/lib:/usr/X11R6/lib:/usr/local/lib}
+Original: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
+Reordered: /usr/lib /usr/X11R6/lib /usr/local/lib /tmp/testing
+@end example
+
+@example
+$ @kbd{libtool --reorder-cache=/tmp/testing}
+Original: /usr/lib /usr/X11R6/lib /usr/local/lib
+Reordered: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
+$ @kbd{rm -rf /tmp/testing}
+$ @kbd{libtool --reorder-cache=/usr/lib:/usr/X11R6/lib:/usr/local/lib}
+Original: /tmp/testing /usr/lib /usr/X11R6/lib /usr/local/lib
+Reordered: /usr/lib /usr/X11R6/lib /usr/local/lib
+@end example
+
+@example
+$ @kbd{libtool --reorder-cache=/tmp/testing:/usr/local/lib:/home/user/dir}
+Original: /usr/lib /usr/X11R6/lib /usr/local/lib
+Reordered: /tmp/testing /usr/local/lib /home/user/dir /usr/lib /usr/X11R6/lib
+$ @kbd{libtool --reorder-cache=/usr/lib /usr/X11R6/lib /usr/local/lib}
+Original: /tmp/testing /usr/local/lib /home/user/dir /usr/lib /usr/X11R6/lib
+Reordered: /usr/lib /usr/X11R6/lib /usr/local/lib /tmp/testing /home/user/dir
+@end example
@item --quiet
@itemx --silent
@defvar finish_cmds
Commands to tell the dynamic linker how to find shared libraries in a
specific directory. These commands can be disabled during testing local
-changes with @option{--test} or @option{--check}.
+changes to shared libraries with @option{--test} or @option{--check}.
@end defvar
@defvar finish_eval
cd build_local
LT_AT_CONFIGURE([--prefix=$prefix], [$ltb2/configure])
LT_AT_MAKE([])
+
+ case $host_os in
+ openbsd*)
+ build_local_dir=$(pwd)
+ AT_CHECK(
+ [
+ $LIBTOOL --reorder-cache="$build_local_dir/liba/.libs:$build_local_dir/libb/.libs"
+ ], 0, ignore, ignore);;
+ *) ;;
+ esac
)
# Although we have installed ltb2, we still expect that we are using the local