From 53db1c3a4c9c81972b70556a5ba5cd6ccd8e6e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 23 Nov 2018 13:51:05 +0200 Subject: [PATCH] Resolve $PREFIX to an absolute path at the start of shell scripts This fixes building/installing into a relative path. --- build-compiler-rt.sh | 3 +++ build-libcxx.sh | 4 ++++ build-libssp.sh | 2 ++ build-llvm.sh | 3 +++ build-mingw-w64-libraries.sh | 2 ++ build-mingw-w64.sh | 4 ++++ install-wrappers.sh | 2 ++ 7 files changed, 20 insertions(+) diff --git a/build-compiler-rt.sh b/build-compiler-rt.sh index 8712f49..c83dd41 100755 --- a/build-compiler-rt.sh +++ b/build-compiler-rt.sh @@ -19,6 +19,9 @@ if [ -z "$PREFIX" ]; then echo $0 [--build-sanitizers] dest exit 1 fi + +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" export PATH=$PREFIX/bin:$PATH : ${CORES:=$(nproc 2>/dev/null)} diff --git a/build-libcxx.sh b/build-libcxx.sh index 809c093..bede395 100755 --- a/build-libcxx.sh +++ b/build-libcxx.sh @@ -23,6 +23,10 @@ if [ -z "$PREFIX" ]; then echo $0 [--disable-shared] [--disable-static] dest exit 1 fi + +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" + export PATH=$PREFIX/bin:$PATH : ${CORES:=$(nproc 2>/dev/null)} diff --git a/build-libssp.sh b/build-libssp.sh index 8dea69e..71c4b2a 100755 --- a/build-libssp.sh +++ b/build-libssp.sh @@ -7,6 +7,8 @@ if [ $# -lt 1 ]; then exit 1 fi PREFIX="$1" +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" export PATH=$PREFIX/bin:$PATH : ${CORES:=$(nproc 2>/dev/null)} diff --git a/build-llvm.sh b/build-llvm.sh index 6ebdb1e..c755d96 100755 --- a/build-llvm.sh +++ b/build-llvm.sh @@ -22,6 +22,9 @@ if [ -z "$PREFIX" ]; then exit 1 fi +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" + : ${CORES:=$(nproc 2>/dev/null)} : ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)} : ${CORES:=4} diff --git a/build-mingw-w64-libraries.sh b/build-mingw-w64-libraries.sh index f11b8af..cdd3b38 100755 --- a/build-mingw-w64-libraries.sh +++ b/build-mingw-w64-libraries.sh @@ -7,6 +7,8 @@ if [ $# -lt 1 ]; then exit 1 fi PREFIX="$1" +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" export PATH=$PREFIX/bin:$PATH : ${CORES:=$(nproc 2>/dev/null)} diff --git a/build-mingw-w64.sh b/build-mingw-w64.sh index 2b767ad..2fad646 100755 --- a/build-mingw-w64.sh +++ b/build-mingw-w64.sh @@ -14,6 +14,10 @@ if [ -z "$PREFIX" ]; then echo $0 [--skip-include-triplet-prefix] dest exit 1 fi + +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" + if [ -z "$HOST" ]; then # The newly built toolchain isn't crosscompiled; add it to the path. export PATH=$PREFIX/bin:$PATH diff --git a/install-wrappers.sh b/install-wrappers.sh index 81e78e7..920dc3c 100755 --- a/install-wrappers.sh +++ b/install-wrappers.sh @@ -7,6 +7,8 @@ if [ $# -lt 1 ]; then exit 1 fi PREFIX="$1" +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd)" : ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}