#!/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 CFLAGS='-O2 -w' CXXFLAGS='-O2 -w' ../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 all-gcc all-target-libgcc all-target-libstdc++-v3 all-target-libjava make install-gcc install-target-libgcc install-target-libstdc++-v3 install-target-libjava 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