From: Carl Woffenden Date: Mon, 18 May 2020 08:12:02 +0000 (+0200) Subject: Reduced generated sized on macOS (and other envs where realpath is missing) X-Git-Tag: v1.4.5^2~9^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b03fa69c3944bf6240195ade2c3a89676eea57;p=thirdparty%2Fzstd.git Reduced generated sized on macOS (and other envs where realpath is missing) Added Python fallback for when realpath fails. --- diff --git a/contrib/single_file_libs/combine.sh b/contrib/single_file_libs/combine.sh index 05c7bce8e..8eac4f9eb 100755 --- a/contrib/single_file_libs/combine.sh +++ b/contrib/single_file_libs/combine.sh @@ -93,6 +93,12 @@ resolve_include() { echo "$relpath" return 0 fi + # Fallback on Python to reduce the path if the above fails. + local relpath=$(python -c "import os,sys; print os.path.relpath(sys.argv[1])" "$root/$inc" 2>/dev/null) + if [ "$relpath" != "" ]; then # not all distros have realpath... + echo "$relpath" + return 0 + fi # Worst case, fall back to just the root + relative include path. The # problem with this is that it is possible to emit multiple different # resolved paths to the same file, depending on exactly how its included.