Bootstrap OpenJDK 7 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.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.tar

Installing GCC 6.3.0

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

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-multilib                  \
             --disable-bootstrap                 \
             --with-system-zlib

make

sudo make install

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

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

Installing Apache Ant 1.9.9

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.9
sudo chown -R root:root /opt/apache-ant-1.9.9

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

Installing IcedTea 2.6.9

./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

Cleanup

sudo rm /etc/ld.so.conf.d/gcj
sudo ldconfig
sudo rm -rf /opt/gcc-4.0.4 /opt/gcc-6.3.0 /opt/ecj /opt/apache-ant-1.9.9