commit 18ac39015aa9455f3bc8c88a4b5e960163b6e038 Author: EnumDev Date: Thu May 8 17:15:37 2025 +0300 Initial Commit diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..266c4fa --- /dev/null +++ b/pkg.info @@ -0,0 +1,11 @@ +name: openjdk-21 +description: OpenJDK Java 21 +version: 21.0.6+7 +url: https://openjdk.org/ +license: GPL2-only WITH Classpath-exception-2.0 +architecture: any +depends: ["freetype2","gcc","glibc","harfbuzz","hicolor-icon-theme","lcms2","libelf","libjpeg-turbo","libpng","nss"] +optional_depends: ["alsa-lib","gtk3","tide-java-utils"] +make_depends: ["alsa-lib","bash","cpio","cups","giflib","jdk21","libx11","libxext","libxrandr","libxrender","libxt","libxtst","zip","unzip"] +provides: ["jre","jre21","jdk","jdk21"] +type: source diff --git a/post_install.sh b/post_install.sh new file mode 100644 index 0000000..a0a206c --- /dev/null +++ b/post_install.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Set default java version if not already set +[ -d "$BPM_ROOT"/usr/lib/java/default/bin ] || ln -sf openjdk-21 -T "$BPM_ROOT"/usr/lib/java/default diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..4cbea56 --- /dev/null +++ b/source.sh @@ -0,0 +1,53 @@ +# This is the source.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 + +DOWNLOAD="https://github.com/openjdk/jdk${BPM_PKG_VERSION%%.*}u/archive/jdk-${BPM_PKG_VERSION}.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + unset MAKEFLAGS + + bash configure --enable-unlimited-crypto \ + --disable-warnings-as-errors \ + --with-stdc++lib=dynamic \ + --with-giflib=system \ + --with-harfbuzz=system \ + --with-lcms=system \ + --with-libjpeg=system \ + --with-libpng=system \ + --with-zlib=system \ + --with-version-build=${BPM_PKG_VERSION##*+} \ + --with-version-pre="" \ + --with-version-opt="" \ + --with-cacerts-file=/etc/pki/tls/java/cacerts + make images +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + install -d "$BPM_OUTPUT"/usr/lib/java/openjdk-"${BPM_PKG_VERSION%%.*}" + cp -r build/*/images/jdk/* "$BPM_OUTPUT"/usr/lib/java/openjdk-"${BPM_PKG_VERSION%%.*}"/ + chown -R root:root "$BPM_OUTPUT"/usr/lib/java/openjdk-"${BPM_PKG_VERSION%%.*}" + + # Symlink cacerts + ln -sf /etc/pki/tls/java/cacerts "$BPM_OUTPUT"/usr/lib/java/openjdk-"${BPM_PKG_VERSION%%.*}"/lib/security/cacerts + + # Install icons + for size in 16 24 32 48; do + install -Dm644 src/java.desktop/unix/classes/sun/awt/X11/java-icon${size}.png "$BPM_OUTPUT"/usr/share/icons/hicolor/${size}x${size}/apps/java.png + done + + install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/openjdk-21/LICENSE + install -Dm644 "$BPM_SOURCE"/ASSEMBLY_EXCEPTION "$BPM_OUTPUT"/usr/share/licenses/openjdk-21/ASSEMBLY_EXCEPTION +}