mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-03-23 18:54:01 +08:00
Fix script used to change macOS install names with configure
The previous attempt to fix it in 30c0f6a675 (Fix readlink problem in
configure build under macOS < 12, 2025-08-02) introduced multiple
problems, not least of which was the install name was changed in _not_
installed libraries rather than the installed copies.
Fix this and use more readable names for the different directories
instead of cryptic ${N} variables.
Use realpath instead of readlink because it gives the ultimate link
target directly instead of just another symlink.
Also use printf instead of ls because the latter is unnecessary and we
don't need to worry about using its "-1" option.
See #23143, #25173, #25182, #25675, #26200.
This commit is contained in:
26
configure
vendored
26
configure
vendored
@@ -34272,24 +34272,28 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||
cat <<EOF >change-install-names
|
||||
#!/bin/sh
|
||||
set -e
|
||||
libdir=\$(cd lib ; pwd -P)
|
||||
libnames=\$(cd lib ; ls -1 libwx*${WX_RELEASE}.dylib)
|
||||
[ -z "\${WXDEBUG_X}" ] || set -x
|
||||
destdir=\$1
|
||||
libdir=\$2
|
||||
bindir=\$3
|
||||
build_libdir=\$4
|
||||
libnames=\$(cd \${build_libdir}; printf '%s\n' libwx*${WX_RELEASE}.dylib)
|
||||
changes=''
|
||||
for dep in \${libnames} ; do
|
||||
target=\$(readlink \${4}/\${dep})
|
||||
changes="\${changes} -change \${libdir}\${target} \${3}/\${dep}"
|
||||
for libname in \${libnames} ; do
|
||||
target=\$(realpath \${build_libdir}/\${libname})
|
||||
changes="\${changes} -change \${target} \${libdir}/\$(basename \${target})"
|
||||
done
|
||||
for i in \${libnames} ; do
|
||||
lib=\$(readlink \${1}/\${i})
|
||||
${HOST_PREFIX}install_name_tool \${changes} -id \${3}/\${i} \${libdir}/\${lib}
|
||||
for libname in \${libnames} ; do
|
||||
target=\$(realpath \${build_libdir}/\${libname})
|
||||
${HOST_PREFIX}install_name_tool \${changes} -id \${libdir}/\${libname} \${destdir}\${libdir}/\$(basename \${target})
|
||||
done
|
||||
|
||||
if test -f "\${2}/wxrc-${WX_RELEASE}" ; then
|
||||
${HOST_PREFIX}install_name_tool \${changes} \${2}/wxrc-${WX_RELEASE}
|
||||
if test -f \${destdir}\${bindir}/wxrc-${WX_RELEASE} ; then
|
||||
${HOST_PREFIX}install_name_tool \${changes} \${destdir}\${bindir}/wxrc-${WX_RELEASE}
|
||||
fi
|
||||
EOF
|
||||
chmod +x change-install-names
|
||||
DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \${DESTDIR}\${bindir} \${libdir} \$(wx_top_builddir)/lib"
|
||||
DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \"\${DESTDIR}\" \${libdir} \${bindir} \$(wx_top_builddir)/lib"
|
||||
fi
|
||||
|
||||
HEADER_PAD_OPTION="-headerpad_max_install_names"
|
||||
|
||||
26
configure.in
26
configure.in
@@ -4143,24 +4143,28 @@ if test "$wxUSE_SHARED" = "yes"; then
|
||||
cat <<EOF >change-install-names
|
||||
#!/bin/sh
|
||||
set -e
|
||||
libdir=\$(cd lib ; pwd -P)
|
||||
libnames=\$(cd lib ; ls -1 libwx*${WX_RELEASE}.dylib)
|
||||
[[ -z "\${WXDEBUG_X}" ]] || set -x
|
||||
destdir=\$1
|
||||
libdir=\$2
|
||||
bindir=\$3
|
||||
build_libdir=\$4
|
||||
libnames=\$(cd \${build_libdir}; printf '%s\n' libwx*${WX_RELEASE}.dylib)
|
||||
changes=''
|
||||
for dep in \${libnames} ; do
|
||||
target=\$(readlink \${4}/\${dep})
|
||||
changes="\${changes} -change \${libdir}\${target} \${3}/\${dep}"
|
||||
for libname in \${libnames} ; do
|
||||
target=\$(realpath \${build_libdir}/\${libname})
|
||||
changes="\${changes} -change \${target} \${libdir}/\$(basename \${target})"
|
||||
done
|
||||
for i in \${libnames} ; do
|
||||
lib=\$(readlink \${1}/\${i})
|
||||
${HOST_PREFIX}install_name_tool \${changes} -id \${3}/\${i} \${libdir}/\${lib}
|
||||
for libname in \${libnames} ; do
|
||||
target=\$(realpath \${build_libdir}/\${libname})
|
||||
${HOST_PREFIX}install_name_tool \${changes} -id \${libdir}/\${libname} \${destdir}\${libdir}/\$(basename \${target})
|
||||
done
|
||||
|
||||
if test -f "\${2}/wxrc-${WX_RELEASE}" ; then
|
||||
${HOST_PREFIX}install_name_tool \${changes} \${2}/wxrc-${WX_RELEASE}
|
||||
if test -f \${destdir}\${bindir}/wxrc-${WX_RELEASE} ; then
|
||||
${HOST_PREFIX}install_name_tool \${changes} \${destdir}\${bindir}/wxrc-${WX_RELEASE}
|
||||
fi
|
||||
EOF
|
||||
chmod +x change-install-names
|
||||
DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \${DESTDIR}\${bindir} \${libdir} \$(wx_top_builddir)/lib"
|
||||
DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \"\${DESTDIR}\" \${libdir} \${bindir} \$(wx_top_builddir)/lib"
|
||||
fi
|
||||
|
||||
dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error:
|
||||
|
||||
@@ -268,6 +268,7 @@ wxMSW:
|
||||
|
||||
wxOSX:
|
||||
|
||||
- Fix install names after "make install" (#25675).
|
||||
- Fix bug when deleting wxDataViewCtrl items (Hartwig Wiesmann, #26138).
|
||||
- Fix crash on some key presses in wxDataViewCtrl (#26160).
|
||||
- Fix regression in wxFileDialog filters in 3.2.9 (#26148).
|
||||
|
||||
Reference in New Issue
Block a user