# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT # The prepare function is executed in the root of the temp directory # This function is used for putting downloaded files to the correct location or applying patches prepare() { cd "$BPM_SOURCE" # Do not treats warnings as errors sed -E -i 's/(^WARNINGS_ARE_ERRORS = -W)(error)/\1no-\2/' hotspot/make/linux/makefiles/gcc.make # bool is a keyword in C23. cat > gcc <<-EOF #!/bin/sh exec /usr/bin/gcc -std=gnu17 "\$@" EOF chmod +x gcc # The use of the "register" keyword as storage class specifier has been removed in C++17. cat > g++ <<-EOF #!/bin/sh exec /usr/bin/g++ -std=gnu++14 "\$@" EOF chmod +x g++ } # The build function is executed in the source directory # This function is used to compile the source code build() { unset MAKEFLAGS unset JAVA_HOME # Use the gcc and g++ wrappers export PATH="$PWD":$PATH # Set CFLAGS and CXXFLAGS export CFLAGS="${CFLAGS//-O2/-O3} -fno-lifetime-dse -fno-delete-null-pointer-checks -fno-exceptions -Wno-error=int-conversion -Wno-error=incompatible-pointer-types" export CXXFLAGS="${CXXFLAGS} -fno-exceptions" [ -z "$BOOT_JDK" ] && export BOOT_JDK=/usr/lib/java/openjdk-${BPM_PKG_VERSION%%.*}/ bash configure --enable-unlimited-crypto \ --with-extra-cflags="$CFLAGS" \ --with-extra-cxxflags="$CXXFLAGS" \ --with-extra-ldflags="$LDFLAGS" \ --with-stdc++lib=dynamic \ --with-giflib=system \ --with-zlib=system \ --with-update-version=${BPM_PKG_VERSION:2:3} \ --with-build-number=${BPM_PKG_VERSION##*.} \ --with-cacerts-file=/etc/pki/tls/java/cacerts \ --with-boot-jdk="$BOOT_JDK" make make docs } # The package function is executed in the source directory # This function is used to move the compiled files into the output directory package() { make -j1 images install -d "$BPM_OUTPUT"/usr/lib/java cp -a "$BPM_SOURCE"/build/*/images/j2sdk-image "$BPM_OUTPUT"/usr/lib/java/openjdk-${BPM_PKG_VERSION%%.*} chown -R root:root "$BPM_OUTPUT"/usr/lib/java/openjdk-${BPM_PKG_VERSION%%.*} # Remove unwanted files find "$BPM_OUTPUT" -name '*.diz' rm "$BPM_OUTPUT"/usr/lib/java/openjdk-${BPM_PKG_VERSION%%.*}/{LICENSE,ASSEMBLY_EXCEPTION,THIRD_PARTY_README,src.zip} # Licenses are placed in usr/share/licenses rm "$BPM_OUTPUT"/usr/lib/java/openjdk-${BPM_PKG_VERSION%%.*}/jre/{LICENSE,ASSEMBLY_EXCEPTION,THIRD_PARTY_README} # Licenses are placed in usr/share/licenses # Symlink cacerts ln -sf /etc/ssl/certs/java/cacerts "$BPM_OUTPUT"/usr/lib/java/openjdk-${BPM_PKG_VERSION%%.*}/jre/lib/security/cacerts # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/openjdk-${BPM_PKG_VERSION%%.*}/LICENSE install -Dm644 "$BPM_SOURCE"/ASSEMBLY_EXCEPTION "$BPM_OUTPUT"/usr/share/licenses/openjdk-${BPM_PKG_VERSION%%.*}/ASSEMBLY_EXCEPTION install -Dm644 "$BPM_SOURCE"/THIRD_PARTY_README "$BPM_OUTPUT"/usr/share/licenses/openjdk-${BPM_PKG_VERSION%%.*}/THIRD_PARTY_README }