octave: Fix libtool framework link failure on Darwin

This fix moves linker flags of the form `-framework foo` from dependency_libs to
inherited_linker_flags, since libtool doesn't understand them.  See #96977 for
details.

Fixes #96977
This commit is contained in:
Graham Bennett 2020-09-02 23:25:10 +01:00
parent e560459c5b
commit 8e4e38cdcd

View File

@ -5,8 +5,19 @@
fixQmakeLibtool() {
if [ -d "$1" ]; then
find "$1" -name '*.la' | while read la; do
set +e
framework_libs=$(grep '^dependency_libs' "$la" | grep -Eo -- '-framework +\w+' | tr '\n' ' ')
set -e
sed -i "$la" \
-e '/^dependency_libs/ s,\(/[^ ]\+\)/lib\([^/ ]\+\)\.so,-L\1 -l\2,g'
-e '/^dependency_libs/ s,\(/[^ ]\+\)/lib\([^/ ]\+\)\.so,-L\1 -l\2,g' \
-e '/^dependency_libs/ s,-framework \+\w\+,,g'
if [ ! -z "$framework_libs" ]; then
if grep '^inherited_linker_flags=' $la >/dev/null; then
sed -i "$la" -e "s/^\(inherited_linker_flags='[^']*\)/\1 $framework_libs/"
else
echo "inherited_linker_flags='$framework_libs'" >> "$la"
fi
fi
done
fi
}