source: core/c/find-java-home

Last change on this file was c24ddf5, checked in by zzz <zzz@…>, 4 years ago

Build: Fix jbigi build for Arch Linux and others when using Java 8 (ticket #1863)

  • Property mode set to 100644
File size: 2.7 KB
Line 
1UNIXTYPE=$(uname -s | tr "[A-Z]" "[a-z]")
2if [ $UNIXTYPE = "freebsd" ]; then
3    if [ -d /usr/local/openjdk8 ]; then
4        JAVA_HOME="/usr/local/openjdk8"
5    elif [ -d /usr/local/openjdk7 ]; then
6        JAVA_HOME="/usr/local/openjdk7"
7    elif [ -d /usr/local/openjdk6 ]; then
8        JAVA_HOME="/usr/local/openjdk6"
9    fi
10elif [ $UNIXTYPE = "sunos" ]; then
11    UNIXTYPE="solaris"
12    if [ -d /usr/jdk/latest/ ]; then
13        JAVA_HOME="/usr/jdk/latest"
14    elif [ -d /usr/jdk/instances/jdk1.8.0/ ]; then
15        JAVA_HOME="/usr/jdk/instances/jdk1.8.0"
16    elif [ -d /usr/jdk/instances/jdk1.7.0/ ]; then
17        JAVA_HOME="/usr/jdk/instances/jdk1.7.0"
18    elif [ -d /usr/jdk/instances/jdk1.6.0 ]; then
19        JAVA_HOME="/usr/jdk/instances/jdk1.6.0"
20    fi
21elif [ $UNIXTYPE = "openbsd" ]; then
22    if [ -d /usr/local/jdk-1.8.0 ]; then
23        JAVA_HOME="/usr/local/jdk-1.8.0"
24    elif [ -d /usr/local/jdk-1.7.0 ]; then
25        JAVA_HOME="/usr/local/jdk-1.7.0"
26    elif [ -d /usr/local/jdk-1.6.0 ]; then
27        JAVA_HOME="/usr/local/jdk-1.6.0"
28    fi
29elif [ $UNIXTYPE = "netbsd" ]; then
30    if [ -d /usr/pkg/java/openjdk8 ]; then
31        JAVA_HOME="/usr/pkg/java/openjdk8"
32    elif [ -d /usr/pkg/java/openjdk7 ]; then
33        JAVA_HOME="/usr/pkg/java/openjdk7"
34    fi
35elif [ $UNIXTYPE = "linux" ] && [ -e /etc/debian_version ]; then
36    if [ -d /usr/lib/jvm/default-java ]; then
37       JAVA_HOME="/usr/lib/jvm/default-java"
38    fi
39elif [ $UNIXTYPE = "linux" ] && [ -e /etc/arch-release ]; then
40    if [ -d /usr/lib/jvm/java-8-openjdk ]; then
41        JAVA_HOME="/usr/lib/jvm/java-8-openjdk"
42    elif [ -d /usr/lib/jvm/java-7-openjdk ]; then
43        JAVA_HOME="/usr/lib/jvm/java-7-openjdk"
44    elif [ -d /usr/lib/jvm/java-6-openjdk ]; then
45        JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
46    fi
47elif [ $UNIXTYPE = "darwin" ]; then
48    JAVA_HOME=$(/usr/libexec/java_home)
49elif [ $UNIXTYPE = "gnu/kfreebsd" ]; then
50    # Even though the kernel is FreeBSD's, the userland is GNU.
51    # kFreeBSD has $JAVA_HOME/include/linux instead of $JAVA_HOME/include/*bsd
52    UNIXTYPE="linux"
53    # OpenJDK 7 is supported as of Debian Jessie
54    if [ -d /usr/lib/jvm/java-8-openjdk-kfreebsd-amd64/ ]; then
55        JAVA_HOME="/usr/lib/jvm/java-8-openjdk-kfreebsd-amd64"
56    elif [ -d /usr/lib/jvm/java-8-openjdk-kfreebsd-i386/ ]; then
57        JAVA_HOME="/usr/lib/jvm/java-8-openjdk-kfreebsd-i386"
58    elif [ -d /usr/lib/jvm/java-7-openjdk-kfreebsd-amd64/ ]; then
59        JAVA_HOME="/usr/lib/jvm/java-7-openjdk-kfreebsd-amd64"
60    elif [ -d /usr/lib/jvm/java-7-openjdk-kfreebsd-i386/ ]; then
61        JAVA_HOME="/usr/lib/jvm/java-7-openjdk-kfreebsd-i386"
62    elif [ -d /usr/lib/jvm/java-gcj ]; then
63        JAVA_HOME="/usr/lib/jvm/java-gcj"
64    fi
65fi
66
67export JAVA_HOME UNIXTYPE
Note: See TracBrowser for help on using the repository browser.