build: update to Mac third_party_libs_tool 1.3

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2023-08-27 17:19:08 +00:00
parent cd8d65bddd
commit 0e5d63cd9a
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 15 additions and 48 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
version=1.2 version=1.3
main() { main() {
# parse options # parse options
@ -135,11 +135,14 @@ lib_scan() {
;; ;;
esac esac
# Remove path parts for mark file
bin_mark_file=$(echo "$bin" | sed 's,/,_,g')
# if binary is already processed, continue # if binary is already processed, continue
[ -d "$scratch_dir/$bin" ] && continue [ -d "$scratch_dir/$bin_mark_file" ] && continue
# otherwise mark it processed # otherwise mark it processed
mkdir -p "$scratch_dir/$bin" mkdir -p "$scratch_dir/$bin_mark_file"
set -- set --
@ -156,6 +159,12 @@ lib_scan() {
'@rpath/'*) '@rpath/'*)
lib='/usr/local/lib'"${lib#@rpath}" lib='/usr/local/lib'"${lib#@rpath}"
;; ;;
'@loader_path/../../../../'*)
lib='/usr/local/'"${lib#@loader_path/../../../../}"
;;
'@loader_path/'*)
lib='/usr/local/lib'"${lib#@loader_path}"
;;
esac esac
echo "$lib" echo "$lib"
@ -170,53 +179,11 @@ lib_scan() {
fully_resolve_links() { fully_resolve_links() {
while read -r file; do while read -r file; do
# get initial part for non-absolute path, or blank for absolute
path=${file%%/*}
# and set $file to the rest
file=${file#*/}
OLDIFS=$IFS
IFS='/'
for part in $file; do
[ ! -z "$part" ] && path=$(resolve_link "$path/$part")
done
IFS=$OLDIFS
# remove 'foo/..' path parts
while :; do
case "$path" in
*/../*|*/..)
path=$(echo "$path" | sed 's,//*[^/][^/]*//*\.\./*,/,g')
;;
*)
break
;;
esac
done
# remove trailing /s
while [ "$path" != "${path%/}" ]; do
path=${path%/}
done
echo "$path"
done
}
resolve_link() {
file=$1
while [ -h "$file" ]; do while [ -h "$file" ]; do
ls0=$(ls -ld "$file") file=$(readlink -f "$file")
new_link=$(expr "$ls0" : '.* -> \(.*\)$')
if expr "$new_link" : '/.*' > /dev/null; then
file="$new_link"
else
file="${file%/*}"/"$new_link"
fi
done done
echo "$file" echo "$file"
done
} }
relink_all() { relink_all() {