#!/bin/sh set -eu version_gcc=6.5.0 version_ecj=4.9 dir_download="$PWD/download" mkdir -p build; cd build dir_install="$PWD/install-gcc" # Prepare source tar xf "$dir_download/gcc-$version_gcc.tar.xz" cd "gcc-$version_gcc" cp "$dir_download/ecj-$version_ecj.jar" ecj.jar cp "$dir_download/javac.in" . sed -i -e 's/\.\/fixinc\.sh/-c true/' gcc/Makefile.in mkdir -p build; cd build # Configure source ../configure \ --prefix="$dir_install" \ --disable-multilib \ --disable-bootstrap \ --disable-nls \ --enable-languages=java \ --enable-java-home \ --with-java-home="$dir_install/lib/jvm/jre" # Build and install make make install cd .. sed -e "s#@JAVA@#$dir_install/lib/jvm/bin/java#" \ -e "s#@ECJ_JAR@#$dir_install/share/java/ecj.jar#" \ -e "s#@RT_JAR@#$dir_install/lib/jvm/jre/lib/rt.jar#" \ -e "s#@TOOLS_JAR@#$dir_install/lib/jvm/lib/tools.jar#" \ javac.in > javac install -Dm755 -t "$dir_install/lib/jvm/bin" javac