Use full path for dirname and basename in osx_cc_wrapper.sh.tpl

Context: https://github.com/bazelbuild/rules_rust/pull/2998
This commit is contained in:
Yun Peng 2024-11-18 11:20:50 +01:00 committed by GitHub
parent a0e347f493
commit e4857939bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -113,9 +113,9 @@ function call_install_name() {
for rpath in ${RPATHS}; do for rpath in ${RPATHS}; do
for lib in ${LIBS}; do for lib in ${LIBS}; do
unset libname unset libname
if [ -f "$(dirname ${OUTPUT})/${rpath}/lib${lib}.so" ]; then if [ -f "$(/usr/bin/dirname ${OUTPUT})/${rpath}/lib${lib}.so" ]; then
libname="lib${lib}.so" libname="lib${lib}.so"
elif [ -f "$(dirname ${OUTPUT})/${rpath}/lib${lib}.dylib" ]; then elif [ -f "$(/usr/bin/dirname ${OUTPUT})/${rpath}/lib${lib}.dylib" ]; then
libname="lib${lib}.dylib" libname="lib${lib}.dylib"
fi fi
# ${libname-} --> return $libname if defined, or undefined otherwise. This is to make # ${libname-} --> return $libname if defined, or undefined otherwise. This is to make
@ -129,8 +129,8 @@ for rpath in ${RPATHS}; do
done done
for libpath in ${LIB_PATHS}; do for libpath in ${LIB_PATHS}; do
if [ -f "$libpath" ]; then if [ -f "$libpath" ]; then
libname=$(basename "$libpath") libname=$(/usr/bin/basename "$libpath")
if [ -f "$(dirname ${OUTPUT})/${rpath}/${libname}" ]; then if [ -f "$(/usr/bin/dirname ${OUTPUT})/${rpath}/${libname}" ]; then
call_install_name "${libpath}" "${rpath}" "${libname}" call_install_name "${libpath}" "${rpath}" "${libname}"
fi fi
fi fi