aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap
diff options
context:
space:
mode:
authorGravatar Lukacs T. Berki <lberki@google.com>2017-01-23 11:57:42 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2017-01-23 12:17:46 +0000
commitb70343f1ad52fa29541494ce11c4af35168a4f34 (patch)
tree9e06f7d8281869a6c875d404230ca2e8d84b0e30 /scripts/bootstrap
parent549fa152cfab9bf2a7c9ff2eed369c928c4ab19d (diff)
Set JAVA_HOME for every invocation of compile.sh .
This is necessary since it's now passed in --javabase= even if no bootstrap build is requested. Fixes #2384. -- Change-Id: Icc15d9ec174ce9ed82b703c13449d88ec1d936a1 Reviewed-on: https://cr.bazel.build/8408 PiperOrigin-RevId: 145268264 MOS_MIGRATED_REVID=145268264
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-xscripts/bootstrap/buildenv.sh26
-rwxr-xr-xscripts/bootstrap/compile.sh27
2 files changed, 26 insertions, 27 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 4e4d87e1e9..502f2c1690 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -58,6 +58,32 @@ if [ "${MACHINE_TYPE}" = 'ppc64' -o "${MACHINE_TYPE}" = 'ppc64le' ]; then
MACHINE_IS_64BIT='yes'
fi
+case "${PLATFORM}" in
+linux)
+ # JAVA_HOME must point to a Java installation.
+ JAVA_HOME="${JAVA_HOME:-$(readlink -f $(which javac) | sed 's_/bin/javac__')}"
+ ;;
+
+freebsd)
+ # JAVA_HOME must point to a Java installation.
+ JAVA_HOME="${JAVA_HOME:-/usr/local/openjdk8}"
+ ;;
+
+darwin)
+ if [[ -z "$JAVA_HOME" ]]; then
+ JAVA_HOME="$(/usr/libexec/java_home -v ${JAVA_VERSION}+ 2> /dev/null)" \
+ || fail "Could not find JAVA_HOME, please ensure a JDK (version ${JAVA_VERSION}+) is installed."
+ fi
+ ;;
+
+msys*|mingw*)
+ # Use a simplified platform string.
+ PLATFORM="mingw"
+ PATHSEP=";"
+ # Find the latest available version of the SDK.
+ JAVA_HOME="${JAVA_HOME:-$(ls -d /c/Program\ Files/Java/jdk* | sort | tail -n 1)}"
+esac
+
# Extension for executables.
EXE_EXT=""
case "${PLATFORM}" in
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 7030a7d0e5..30495babd3 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -59,33 +59,6 @@ LDFLAGS=${LDFLAGS:-""}
MSYS_DLLS=""
PATHSEP=":"
-case "${PLATFORM}" in
-linux)
- # JAVA_HOME must point to a Java installation.
- JAVA_HOME="${JAVA_HOME:-$(readlink -f $(which javac) | sed 's_/bin/javac__')}"
- ;;
-
-freebsd)
- # JAVA_HOME must point to a Java installation.
- JAVA_HOME="${JAVA_HOME:-/usr/local/openjdk8}"
- ;;
-
-darwin)
- if [[ -z "$JAVA_HOME" ]]; then
- JAVA_HOME="$(/usr/libexec/java_home -v ${JAVA_VERSION}+ 2> /dev/null)" \
- || fail "Could not find JAVA_HOME, please ensure a JDK (version ${JAVA_VERSION}+) is installed."
- fi
- ;;
-
-msys*|mingw*)
- # Use a simplified platform string.
- PLATFORM="mingw"
- PATHSEP=";"
- # Find the latest available version of the SDK.
- JAVA_HOME="${JAVA_HOME:-$(ls -d /c/Program\ Files/Java/jdk* | sort | tail -n 1)}"
-esac
-
-
# Check that javac -version returns a upper version than $JAVA_VERSION.
get_java_version
[ ${JAVA_VERSION#*.} -le ${JAVAC_VERSION#*.} ] || \