diff --git a/core/c/jbigi/find-java-home b/core/c/find-java-home similarity index 74% rename from core/c/jbigi/find-java-home rename to core/c/find-java-home index fd069f4a6..bf7084862 100644 --- a/core/c/jbigi/find-java-home +++ b/core/c/find-java-home @@ -17,6 +17,12 @@ elif [ $UNIXTYPE = "linux" ] && [ -e /etc/debian_version ]; then if [ -d /usr/lib/jvm/default-java ]; then JAVA_HOME="/usr/lib/jvm/default-java" fi +elif [ $UNIXTYPE = "linux" ] && [ -e /etc/arch-release ]; then + if [ -d /usr/lib/jvm/java-7-openjdk ]; then + JAVA_HOME="/usr/lib/jvm/java-7-openjdk" + elif [ -d /usr/lib/jvm/java-6-openjdk ]; then + JAVA_HOME="/usr/lib/jvm/java-6-openjdk" + fi elif [ $UNIXTYPE = "darwin" ]; then JAVA_HOME=$(/usr/libexec/java_home) fi diff --git a/core/c/jbigi/build.sh b/core/c/jbigi/build.sh index f87932e48..643014ff6 100755 --- a/core/c/jbigi/build.sh +++ b/core/c/jbigi/build.sh @@ -25,7 +25,7 @@ mkdir -p lib bin/local VER=4.3.2 # If JAVA_HOME isn't set, try to figure it out on our own -[ -z $JAVA_HOME ] && . ./find-java-home +[ -z $JAVA_HOME ] && . ../find-java-home if [ ! -f "$JAVA_HOME/include/jni.h" ]; then echo "ERROR: Cannot find jni.h! Looked in \"$JAVA_HOME/include/jni.h\"" >&2 echo "Please set JAVA_HOME to a java home that has the JNI" >&2 diff --git a/core/c/jbigi/build_jbigi.sh b/core/c/jbigi/build_jbigi.sh index 91135d211..de137796e 100755 --- a/core/c/jbigi/build_jbigi.sh +++ b/core/c/jbigi/build_jbigi.sh @@ -5,7 +5,7 @@ CC="gcc" # If JAVA_HOME isn't set we'll try to figure it out -[ -z $JAVA_HOME ] && . ./find-java-home +[ -z $JAVA_HOME ] && . ../find-java-home if [ ! -f "$JAVA_HOME/include/jni.h" ]; then echo "Cannot find jni.h! Looked in '$JAVA_HOME/include/jni.h'" echo "Please set JAVA_HOME to a java home that has the JNI" diff --git a/core/c/jcpuid/build.sh b/core/c/jcpuid/build.sh index 8d3f846c9..278d527dd 100755 --- a/core/c/jcpuid/build.sh +++ b/core/c/jcpuid/build.sh @@ -41,30 +41,18 @@ case `uname -s` in elif [ ${UNIXTYPE} = "kfreebsd" ]; then UNIXTYPE="linux" fi - - # If JAVA_HOME is set elsewhere, obey it. Otherwise we'll try to - # deduce its location ourselves. - if [ -z "${JAVA_HOME}" ]; then - if [ ${UNIXTYPE} = "freebsd" ]; then - if [ -d /usr/local/openjdk6 ]; then - JAVA_HOME="/usr/local/openjdk6" - elif [ -d /usr/local/openjdk7 ]; then - JAVA_HOME="/usr/local/openjdk7" - fi - elif [ ${UNIXTYPE} = "openbsd" ]; then # The default in 4.9 - if [ -d /usr/local/jdk-1.7.0 ]; then - JAVA_HOME="/usr/local/jdk-1.7.0" - fi - elif [ ${UNIXTYPE} = "netbsd" ]; then - if [ -d /usr/pkg/java/openjdk7 ]; then - JAVA_HOME="/usr/pkg/java/openjdk7" - fi - elif [ ${UNIXTYPE} = "linux" -a -e /etc/debian_version ]; then - if [ -d /usr/lib/jvm/default-java ]; then - JAVA_HOME="/usr/lib/jvm/default-java" - fi - fi + # If JAVA_HOME isn't set, try to figure it out on our own + [ -z $JAVA_HOME ] && . ../find-java-home + # JAVA_HOME being set doesn't guarantee that it's usable + if [ ! -f "$JAVA_HOME/include/jni.h" ]; then + echo "Please ensure you have a Java SDK installed" >&2 + echo "and/or set JAVA_HOME then re-run this script." >&2 + exit 1 fi + + # Abort script on uncaught errors + set -e + case `uname -m` in x86_64*|amd64) ARCH="x86_64";; @@ -77,12 +65,6 @@ case `uname -s` in exit 1;; esac - # JAVA_HOME being set doesn't guarantee that it's usable - if [ ! -r ${JAVA_HOME}/include/jni.h ]; then - echo "Please ensure you have a Java SDK installed" - echo "and/or set JAVA_HOME then re-run this script." - exit 1 - fi LINKFLAGS="-shared -Wl,-soname,libjcpuid-${ARCH}-${UNIXTYPE}.so" LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-${ARCH}-${UNIXTYPE}.so" COMPILEFLAGS="-fPIC -Wall"