#!/bin/sh set -eu # From: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass makeopts_jobs() { # 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 " $MAKEFLAGS " | 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} } version_jdk10=10.0.2+13 dir_download="$PWD/download" mkdir -p build; cd build dir_install="$PWD/install-jdk10" # Prepare source tar xf "$dir_download/jdk10u-jdk-$version_jdk10.tar.bz2" cd "jdk10u-jdk-$version_jdk10" chmod +x configure # Configure source ./configure \ --prefix="$dir_install" \ --with-boot-jdk="$PWD/../install-jdk9" \ --with-jobs="$(makeopts_jobs)" \ --disable-full-docs \ --enable-headless-only \ --disable-warnings-as-errors # Build and install unset MAKEFLAGS make product-images make install