Tobias Stöckmann

Bootstrap OpenJDK 11 on GNU/Linux

Required Packages

Required Patches

Installation

Installing GCC 4.0.4

tar -xf gcc-4.0.4.tar.bz2
cd gcc-4.0.4

patch -Np1 -i ../gcc-4.0.4-compat.patch

case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' \
        -i.orig gcc/config/i386/t-linux64
  ;;
esac

mkdir -v build
cd       build

SED=sed                                    \
../configure --prefix=/opt/gcc-4.0.4       \
             --enable-languages=c,c++,java \
             --disable-multilib            \
             --disable-bootstrap           \
             --with-system-zlib

make

sudo make install

Installing ECJ for GCC 4.9

mkdir eclipse
cd eclipse
tar -xf ../ecj-4.9-source.tar.bz2
patch -Np1 -i ../ecj-4.9-Makefile.patch
make checkout
patch -Np1 -i ../ecj-4.9-Main.patch
make compile
make ecj.jar
sudo mkdir /opt/ecj
sudo cp ecj.jar /opt/ecj/ecj-4.9.jar
sudo chown root:root /opt/ecj/ecj-4.9.jar

Installing GCC 6.3.0

tar -xf gcc-6.3.0.tar.bz2
cd gcc-6.3.0

patch -Np1 -i ../gcc-6.3.0-compat.patch

case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' \
        -i.orig gcc/config/i386/t-linux64
  ;;
esac

mkdir -v build
cd       build

SED=sed                                          \
../configure --prefix=/opt/gcc-6.3.0             \
             --with-ecj-jar=/opt/ecj/ecj-4.9.jar \
             --enable-java-home                  \
             --enable-languages=java             \
             --disable-libsanitizer              \
             --disable-multilib                  \
             --disable-bootstrap                 \
             --with-system-zlib

make

sudo make install

sudo bash -c "echo /opt/gcc-6.3.0/lib > /etc/ld.so.conf.d/gcj.conf"
sudo ldconfig

export PATH=/opt/gcc-6.3.0/bin:$PATH
set +h

Installing Apache Ant 1.9.13

tar -xf apache-ant-1.9.13-src.tar.bz2
cd apache-ant-1.9.13

patch -Np1 -i ../apache-ant-1.9.13-compat.patch

JAVACMD=/opt/gcc-6.3.0/bin/gij \
JAVAC="/opt/gcc-6.3.0/bin/gcj" \
BOOTJAVAC_OPTS="-C" ./build.sh

sudo cp -R dist /opt/apache-ant-1.9.13
sudo chown -R root:root /opt/apache-ant-1.9.13

export PATH=$PATH:/opt/apache-ant-1.9.13/bin

Installing IcedTea 2.6.9

tar -xf icedtea-2.6.9.tar.xz
cd icedtea-2.6.9

#ln -s /bin/find /usr/bin/find &&
#ln -s /bin/head /usr/bin/head && 
#ln -s /bin/test /usr/bin/test &&
#ln -s /usr/bin/touch /bin/touch
#echo 'curl -LO $@' > /usr/bin/wget

#replace attr/xattr.h with sys/xattr.h in openjdk-boot/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
#or ln -s ../sys/xattr.h /usr/include/attr/

./configure --prefix=/opt/icedtea-2.6.9            \
            --with-jdk-home=/opt/gcc-6.3.0/lib/jvm \
            --with-gcj                             \
            --with-ecj-jar=/opt/ecj/ecj-4.9.jar    \
            --without-rhino                        \
            --disable-system-kerberos              \
            --disable-system-gif                   \
            --disable-system-lcms                  \
            --disable-system-pcsc                  \
            --disable-system-sctp

make

mkdir openjdk.build/j2sdk-image/tapset
touch openjdk.build/j2sdk-image/tapset/something.stp

sudo make install

sudo rm -rf /opt/icedtea-2.6.9/tapset

Installing OpenJDK 8

export CFLAGS="-Wno-error=deprecated-declarations -Wno-error=stringop-overflow= -Wno-error=return-type -Wno-error=cpp -fno-lifetime-dse -fno-delete-null-pointer-checks"
bash configure --with-boot-jdk=/opt/icedtea-3.9.0 --disable-headful \
   --disable-warnings-as-errors --enable-unlimited-crypto \
   --with-cacerts-file=/etc/ssl/ca-bundle.crt --with-version-string=8u192-b26

make images

sudo install -vdm755 /opt/openjdk-8u192-b26
sudo cp -Rv build/*/images/jdk/* /opt/openjdk-8u192-b26
sudo chown -R root:root /opt/openjdk-8u192-b26

Installing OpenJDK 9

export CFLAGS="-Wno-error=deprecated-declarations -Wno-error=stringop-overflow= -Wno-error=return-type -Wno-error=cpp -fno-lifetime-dse -fno-delete-null-pointer-checks"
bash configure --with-boot-jdk=/opt/openjdk-8u192-b26 --disable-headful \
   --disable-warnings-as-errors --enable-unlimited-crypto \
   --with-cacerts-file=/etc/ssl/ca-bundle.crt --with-version-string=9+181

make images

sudo install -vdm755 /opt/openjdk-9+181
sudo cp -Rv build/*/images/jdk/* /opt/openjdk-9+181
sudo chown -R root:root /opt/openjdk-9+181

Installing OpenJDK 10

tar -xf jdk-10.0.2+13.tar.bz2
cd jdk11u-jdk-10.0.2+13

bash configure --enable-unlimited-crypto --disable-warnings-as-errors \
   --with-stdc++lib=dynamic --enable-headless-only                    \
   --with-libjpeg=system --with-libpng=system --with-zlib=system      \
   --with-version-build=13 --with-version-pre= --with-version-opt=    \
   --with-cacerts-file=/etc/ssl/ca-bundle.crt                         \
   --with-boot-jdk=/opt/openjdk-9+181

make images

sudo install -vdm755 /opt/openjdk-10.0.2+13
sudo cp -Rv build/*/images/jdk/* /opt/openjdk-10.0.2+13
sudo chown -R root:root /opt/openjdk-10.0.2+13

Installing OpenJDK 11

tar -xf jdk-11.0.1+13.tar.bz2
cd jdk11u-jdk-11.0.1+13

bash configure --enable-unlimited-crypto --disable-warnings-as-errors \
   --with-stdc++lib=dynamic --enable-headless-only                    \
   --with-libjpeg=system --with-libpng=system --with-zlib=system      \
   --with-version-build=13 --with-version-pre= --with-version-opt=    \
   --with-cacerts-file=/etc/ssl/ca-bundle.crt                         \
   --with-boot-jdk=/opt/openjdk-10.0.2+13

make images

sudo install -vdm755 /opt/openjdk-11.0.1+13
sudo cp -Rv build/*/images/jdk/* /opt/openjdk-11.0.1+13
sudo chown -R root:root /opt/openjdk-11.0.1+13

Cleanup

sudo rm /etc/ld.so.conf.d/gcj.conf
sudo ldconfig
sudo rm -rf /opt/{gcc-4.0.4,gcc-6.3.0,ecj,apache-ant-1.9.13,openjdk-8u192-b26,openjdk-9+181,openjdk-10.0.2+13}