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
version=1.2
version=1.3
main() {
# parse options
@ -135,11 +135,14 @@ lib_scan() {
;;
esac
# Remove path parts for mark file
bin_mark_file=$(echo "$bin" | sed 's,/,_,g')
# if binary is already processed, continue
[ -d "$scratch_dir/$bin" ] && continue
[ -d "$scratch_dir/$bin_mark_file" ] && continue
# otherwise mark it processed
mkdir -p "$scratch_dir/$bin"
mkdir -p "$scratch_dir/$bin_mark_file"
set --
@ -156,6 +159,12 @@ lib_scan() {
'@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
echo "$lib"
@ -170,55 +179,13 @@ lib_scan() {
fully_resolve_links() {
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")
while [ -h "$file" ]; do
file=$(readlink -f "$file")
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"
echo "$file"
done
}
resolve_link() {
file=$1
while [ -h "$file" ]; do
ls0=$(ls -ld "$file")
new_link=$(expr "$ls0" : '.* -> \(.*\)$')
if expr "$new_link" : '/.*' > /dev/null; then
file="$new_link"
else
file="${file%/*}"/"$new_link"
fi
done
echo "$file"
}
relink_all() {
for exe in "$@"; do
# dylib search path for executable