From 48ab146963d624a2e0691ae805b3a133c44bb28d Mon Sep 17 00:00:00 2001 From: mid-kid Date: Mon, 3 Apr 2017 12:43:47 +0200 Subject: [PATCH] Cleanup icedtea a little --- satellites/icedtea.sat | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/satellites/icedtea.sat b/satellites/icedtea.sat index ce7dc3d..8c7433f 100644 --- a/satellites/icedtea.sat +++ b/satellites/icedtea.sat @@ -68,10 +68,15 @@ fi header_end # From: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass -jobs=$(echo " $MAKEFLAGS " | sed -r -n \ - -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ - -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') -jobs=${jobs:-1} +makeopts_jobs() { + [[ $# -eq 0 ]] && set -- ${MAKEFLAGS} + # This assumes the first .* will be more greedy than the second .* + # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). + local jobs=$(echo " $* " | sed -r -n \ + -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ + -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') + echo ${jobs:-1} +} if option bootstrap; then # Build GCJ @@ -81,17 +86,22 @@ if option bootstrap; then sed -i -e 's/\.\/fixinc\.sh/-c true/' gcc/Makefile.in mkdir build; cd build - ../configure --prefix="$PWD/../install" --disable-bootstrap --enable-languages=java --enable-java-home --with-java-home="$PWD/../install/lib/jvm/jre" + ../configure \ + --prefix="$PWD/../install" \ + --disable-bootstrap \ + --enable-languages=java \ + --enable-java-home \ + --with-java-home="$PWD/../install/lib/jvm/jre" make make install ) # Install missing javac sed -e "s#@JAVA@#$PWD/gcc-$version_gcc/install/lib/jvm/bin/java#" \ - -e "s#@ECJ_JAR@#$PWD/gcc-$version_gcc/install/share/java/ecj.jar#" \ - -e "s#@RT_JAR@#$PWD/gcc-$version_gcc/install/lib/jvm/jre/lib/rt.jar#" \ - -e "s#@TOOLS_JAR@#$PWD/gcc-$version_gcc/install/lib/jvm/lib/tools.jar#" \ - javac.in > javac + -e "s#@ECJ_JAR@#$PWD/gcc-$version_gcc/install/share/java/ecj.jar#" \ + -e "s#@RT_JAR@#$PWD/gcc-$version_gcc/install/lib/jvm/jre/lib/rt.jar#" \ + -e "s#@TOOLS_JAR@#$PWD/gcc-$version_gcc/install/lib/jvm/lib/tools.jar#" \ + javac.in > javac install -Dm755 -t "gcc-$version_gcc/install/lib/jvm/bin" javac # Set JAVA_HOME to GCJ @@ -102,9 +112,6 @@ if option bootstrap; then ./build.sh ) - # Add bootstrapped version of Ant to $PATH, for use in the subsequent builds of Icedtea - export PATH="$PWD/apache-ant-$version_apache_ant/dist/bin:$PATH" - # Bootstrap Icedtea7 ( cd "$name-$version_bootstrap" for module in $bootstrap_modules; do @@ -113,9 +120,12 @@ if option bootstrap; then mv "icedtea-$version_bootstrap-$modname.tar.bz2" "$modname.tar.bz2" done + # Use the gcc with java support we just built to be able to properly compile java C modules. Add java tools and ant to $PATH as well. + export PATH="$PWD/../gcc-$version_gcc/install/bin:$JAVA_HOME/bin:$PWD/../apache-ant-$version_apache_ant/dist/bin:$PATH" + ./configure \ --with-jdk-home="$JAVA_HOME" \ - --with-parallel-jobs=$jobs \ + --with-parallel-jobs="$(makeopts_jobs)" \ --disable-downloading \ --without-rhino \ --disable-system-kerberos \ @@ -137,9 +147,10 @@ for module in $modules; do done # Build +export PATH="$JAVA_HOME/bin:$PATH" ./configure \ --with-jdk-home="$JAVA_HOME" \ - --with-parallel-jobs=$jobs \ + --with-parallel-jobs="$(makeopts_jobs)" \ --disable-downloading \ --disable-ccache \ --disable-system-kerberos \