diff options
Diffstat (limited to 'packaging/macos/030-funcs.sh')
| -rw-r--r-- | packaging/macos/030-funcs.sh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/packaging/macos/030-funcs.sh b/packaging/macos/030-funcs.sh index e421178df..525e736e2 100644 --- a/packaging/macos/030-funcs.sh +++ b/packaging/macos/030-funcs.sh @@ -64,6 +64,7 @@ function get_source [ ! -d $TMP_DIR ] && mkdir -p $TMP_DIR local log=$(mktemp $TMP_DIR/$FUNCNAME.XXXX) [ -z $target_dir ] && target_dir=$SRC_DIR + [ ! -d $SRC_DIR ] && mkdir -p $SRC_DIR cd $target_dir @@ -165,3 +166,29 @@ function relocate_dependency install_name_tool -change $source $target $library } +### 'readlink -f' replacement ################################################## + +# This is what the oneliner used to set SELF_DIR is based on. + +function readlinkf +{ + # 'readlink -f' replacement: https://stackoverflow.com/a/1116890 + # 'do while' replacement: https://stackoverflow.com/a/16491478 + + local file=$1 + + # iterate down a (possible) chain of symlinks + while + [ ! -z $(readlink $file) ] && file=$(readlink $file) + cd $(dirname $file) + file=$(basename $file) + [ -L "$file" ] + do + : + done + + # Compute the canonicalized name by finding the physical path + # for the directory we're in and appending the target file. + echo $(pwd -P)/$file +} + |
