commit 071193dd0c7d00fd7a1903f9b713c3a4540cf2c4
parent 1baa4be99f527821ef3ca3c6591143c102a545a2
Author: torter <koubbamohamedrayan@gmail.com>
Date: Sat, 14 Nov 2026 18:16:45 +0000
libtool: convenience libraries merge their members and link whole
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/repo/dev-build/libtool/libtool b/repo/dev-build/libtool/libtool
@@ -114,7 +114,7 @@ link() {
if [ -n "$first" ] && [ -e "$d/.libs/$first" ]; then
libs="$libs $d/.libs/$first"
[ -n "$ldir" ] && flags="$flags -Wl,-rpath,$ldir"
- elif [ -n "$old" ]; then libs="$libs $d/.libs/$old"
+ elif [ -n "$old" ]; then libs="$libs -Wl,--whole-archive $d/.libs/$old -Wl,--no-whole-archive"
fi
la_deps="$la_deps $deps"
;;
@@ -135,7 +135,13 @@ link() {
stem=${name%.la}
if [ -z "$rpath" ]; then
rm -f "$dir/.libs/$stem.a"
- run ar cr "$dir/.libs/$stem.a" $pic && run ranlib "$dir/.libs/$stem.a" || exit $?
+ run ar cr "$dir/.libs/$stem.a" $pic || exit $?
+ for a in $libs; do
+ case $a in *.a)
+ t=$(mktemp -d) && abs=$(cd "${a%/*}" && pwd)/${a##*/} && (cd "$t" && ar x "$abs") && { set +f; run ar cr "$dir/.libs/$stem.a" "$t"/*; set -f; } ; rm -rf "$t";;
+ esac
+ done
+ run ranlib "$dir/.libs/$stem.a" || exit $?
write_la "$out" "" "" "$stem.a" "$la_deps $dlibs" "" no
exit 0
fi