diff --git a/compile.sh b/compile.sh index f13dfe6..92212c1 100755 --- a/compile.sh +++ b/compile.sh @@ -1,7 +1,23 @@ #!/bin/bash +set -e + HERE=$(realpath $(dirname $0)) . "${HERE}/setup.sh" make JOBS=1 -C openj9-openjdk-jdk11 all + +arch="${TARGET%%-*}" +builddir="${HERE}/openj9-openjdk-jdk11/build/$(ls "${HERE}/openj9-openjdk-jdk11/build" | grep "linux-${arch}-*")" + +if test "${HOST}" != "${TARGET}"; then + qemu=$(type -P qemu-${arch}-static) + if [[ -z "${qemu}" ]]; then + "WARN: no ${qemu} found, cannot test / output 'java -version'!" + else + ${qemu} -L "${SYSROOT}" "${builddir}/images/jdk/bin/java" -version + fi +else + "${builddir}/images/jdk/bin/java" -version +fi \ No newline at end of file diff --git a/configure.sh b/configure.sh index 230ab1a..587fe2d 100755 --- a/configure.sh +++ b/configure.sh @@ -7,17 +7,7 @@ HERE=$(realpath $(dirname $0)) extra_configure_args="" if [[ "${HOST}" != "${TARGET}" ]]; then - extra_configure_args="${extra_configure_args} --disable-ddr --openjdk-target=$TARGET" - if [[ "${TARGET}" == "riscv64-linux-gnu" ]]; then - if [ -d "/opt/riscv/sysroot" ]; then - sysroot="/opt/riscv/sysroot" - elif [ -d "/opt/cross/riscv64" ]; then - sysroot="/opt/cross/riscv64" - else - echo "ERROR: no cross-compilation sysroot found!" - fi - extra_configure_args="${extra_configure_args} --with-sysroot=$sysroot" - fi + extra_configure_args="${extra_configure_args} --disable-ddr --openjdk-target=$TARGET --with-sysroot=${SYSROOT}" fi pushd openj9-openjdk-jdk11 diff --git a/setup.sh b/setup.sh index 4feb800..a0724bb 100644 --- a/setup.sh +++ b/setup.sh @@ -50,6 +50,15 @@ if test "${HOST}" != "${TARGET}" -a "${TARGET}" == "riscv64-linux-gnu"; then if [[ -f "/usr/bin/riscv64-linux-gnu-g++" ]]; then export RISCV_TOOLCHAIN_TYPE=install fi + + if [ -d "/opt/riscv/sysroot" ]; then + SYSROOT="/opt/riscv/sysroot" + elif [ -d "/opt/cross/riscv64" ]; then + SYSROOT="/opt/cross/riscv64" + else + echo "ERROR: no cross-compilation sysroot found!" + exit 2 + fi fi CFLAGS="-gdwarf-4"