176.1. openjdk-25.0.4.1
OpenJDK, the Java Development Kit: the JVM, the compiler and the class library (LTS)
| Version | 25.0.4.1, release 2 |
| Shelf | lang — Language implementations, plus the modules of any language that has no module shelf of its own |
| Phase | 42_graphics (Graphics Stack), 77 of 189 in build order |
| Licence | GPL-2.0-only WITH Classpath-exception-2.0 |
| Homepage | https://openjdk.org/ |
| Build time | 81.8 SBU |
| Installed size | 388.9 MiB in 571 files |
| Recipe | ports/core/lang/openjdk/kpkgbuild |
About
OpenJDK is the Java Development Kit: the HotSpot JVM, javac, jar, jlink and the rest of the tools, and the class library, installed as one JDK image under /usr/lib/jvm/java-<feature>-openjdk with /usr/lib/jvm/default-jvm pointing at it and every launcher linked into /usr/bin. It is the Java every JVM program in KDOS runs on (JOSM, the Swing applications, the Java libraries built from their sources), with AWT built for X11, so a Java desktop program runs under Xwayland.
It is compiled here from the OpenJDK source. Building it needs a JDK already, so the recipe’s second source is a bootstrap seed: Adoptium’s musl build (Temurin for Alpine) of the same feature release, used as the boot JDK and then discarded; nothing it built is in the package (see Bootstrap seeds).
Why it is in KDOS
The comment above it in script/phases/42_graphics/packages.d/lang.txt:
OpenJDK, built from source from a bootstrap JDK seed, for the JVM programs.
Sources
OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.4.1_1.tar.gz(133.8 MiB)
sha256f18648ee5ce45261f50dc9493fdae7ddebaa2a7a857cafda3e2a448a79c03dee
upstream: https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.4.1%2B1/OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.4.1_1.tar.gz
archive copy: sources-3/lang--OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.4.1_1.tar.gzopenjdk-25.0.4.1.tar.gz(114.1 MiB)
sha2561e5908f90d732e0ed3f737aac7603863c2cc157e464e036ac0accadb87af4391
upstream: https://github.com/openjdk/jdk25u/archive/refs/tags/jdk-25.0.4.1-ga.tar.gz
archive copy: sources-3/lang--openjdk-25.0.4.1.tar.gz
Dependencies
Depends on: bash, coreutils, autoconf, zip, unzip, file, pandoc, alsa-lib, cups, fontconfig, freetype2, harfbuzz, giflib, lcms2, libjpeg-turbo, libpng, zlib, libX11, libXext, libXrender, libXi, libXtst, libXrandr, libXt, xorgproto.
Required by (5): antlr2, digital, josm, kodi, logisim-evolution.
Patches
build.sh applies these; kpkg applies nothing by itself.
posix-grep.patch— Writes the match inmake/autoconf/basic_tools.m4that decides whetherdateis GNU’s as the extended expressiongrep -E "GNU|BusyBox|uutils"instead of the basic one,"GNU\|BusyBox\|uutils", whose\|alternation is a GNU extension that POSIX does not define. The tree’s grep is GNU’s, the grep port, which reads both forms alike, so the patch changes no result here. When the check fails, configure takesdatefor BSD’s and callsdate -j, the build’s ISO source date comes out empty, andjar --datestops the build; the coreutils port, independs, supplies the GNUdatethe check looks for.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install openjdk'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/lang/openjdk.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/lang/openjdk
echo 'f18648ee5ce45261f50dc9493fdae7ddebaa2a7a857cafda3e2a448a79c03dee OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.4.1_1.tar.gz' | sha256sum -c -
echo '1e5908f90d732e0ed3f737aac7603863c2cc157e464e036ac0accadb87af4391 openjdk-25.0.4.1.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/openjdk
SRC=$SRC_ROOT/openjdk-25.0.4.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf openjdk-25.0.4.1.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.4.1_1.tar.gz -C "$SRC_ROOT"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _build, _feature, _seed, _seedbuild and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/posix-grep.patch"
_seedjdk="$SRC_ROOT/jdk-$_seed+$_seedbuild"
_jhome=/usr/lib/jvm/java-$_feature-openjdk
_cflags="$CFLAGS -D_LARGEFILE64_SOURCE"
_cxxflags="$CXXFLAGS -D_LARGEFILE64_SOURCE"
_ldflags="$LDFLAGS"
unset CFLAGS CXXFLAGS LDFLAGS
unset MAKEFLAGS GNUMAKEFLAGS KDOS_JOBSERVER CARGO_MAKEFLAGS
bash ./configure \
--prefix="$_jhome" \
--with-boot-jdk="$_seedjdk" \
--with-extra-cflags="$_cflags" \
--with-extra-cxxflags="$_cxxflags" \
--with-extra-ldflags="$_ldflags" \
--with-jobs="$KDOS_JOBS" \
--with-jvm-variants=server \
--with-debug-level=release \
--with-native-debug-symbols=none \
--disable-warnings-as-errors \
--disable-precompiled-headers \
--disable-ccache \
--disable-headless-only \
--with-freetype=system \
--with-harfbuzz=system \
--with-zlib=system \
--with-libjpeg=system \
--with-giflib=system \
--with-libpng=system \
--with-lcms=system \
--with-jtreg=no \
--with-gtest=no \
--disable-dtrace \
--with-version-pre= \
--with-version-opt=kdos \
--with-version-build="$_build" \
--with-vendor-name=KDOS
make jdk-image
mkdir -p "$PKG$_jhome"
cp -a build/linux-x86_64-server-release/images/jdk/. "$PKG$_jhome/"
install -dm755 "$PKG/usr/share/man/man1"
mv "$PKG$_jhome"/man/man1/*.1 "$PKG/usr/share/man/man1/"
rm -rf "$PKG$_jhome/man"
ln -s "java-$_feature-openjdk" "$PKG/usr/lib/jvm/default-jvm"
install -dm755 "$PKG/usr/bin"
for f in "$PKG$_jhome"/bin/*; do
ln -s "../lib/jvm/java-$_feature-openjdk/bin/${f##*/}" "$PKG/usr/bin/${f##*/}"
done
The switches, and why each is set:
--with-boot-jdk="$_seedjdk"— The unpacked seed,jdk-<_seed>+<_seedbuild>. OpenJDK accepts a boot JDK of the same feature release or the one before it (DEFAULT_ACCEPTABLE_BOOT_VERSIONS), and the seed’s URL is spelled from_feature, so a bump ofversionto another feature release bumps_seedand_seedbuildwith it.--with-extra-cflags,--with-extra-cxxflags,--with-extra-ldflags— The tree’s compiler and linker flags. configure ignoresCFLAGS,CXXFLAGSandLDFLAGSfrom the environment, sobuild.shsaves them, unsets them and passes them in through these switches, which keeps the-ffile-prefix-mapand build-id settings in the native code.-D_LARGEFILE64_SOURCE— Added to both C and C++ flags. musl declares the*64file functions the class library’s native code calls only under this macro.--with-jobs="$KDOS_JOBS"— The build’s parallelism. The makefiles take it from here and stop the build when make runs under a jobserver, which the tree’s-jinMAKEFLAGSand the--jobserver-authof a--port-jobsbuild would each give it, sobuild.shunsetsMAKEFLAGS, and with itGNUMAKEFLAGS,KDOS_JOBSERVERandCARGO_MAKEFLAGS, which carry that build’s jobserver FIFO.--with-jvm-variants=server,--with-debug-level=release— The C2-compiling server VM, in its release build; both are upstream’s defaults, named here.--with-native-debug-symbols=none— Generates no debug symbols for the native code at all, neither inside the binaries nor as separate.debuginfofiles. Upstream’s default on Linux isexternal, the separate files.--disable-warnings-as-errors— Lets a compiler warning stay a warning; the JDK’s build treats warnings as errors by default. The warnings still show.--disable-precompiled-headers— Compiles HotSpot without precompiled headers.--disable-ccache— Does not compile through ccache.--disable-headless-only— Builds the full AWT, Java 2D and Swing for X11, not only the headless subset; Java desktop programs run under Xwayland (see No Xorg server, and one carve-out). The full build needs CUPS, ALSA, fontconfig and the X11 libraries, and configure refuses it without any of them; each is independs.--with-freetype=system,--with-harfbuzz=system,--with-zlib=system,--with-libjpeg=system,--with-giflib=system,--with-libpng=system,--with-lcms=system— Links each of these from its port instead of compiling the copy that the OpenJDK source carries.--with-jtreg=no,--with-gtest=no— Looks for neither test framework, since no test is run. jtreg is not a port, and--with-gtestwants a googletest source tree (withgooglemock) to compile HotSpot’s unit tests from, not the installed gtest library.--disable-dtrace— Builds no DTrace probes.--with-version-pre=— An empty pre-release field. Without it configure putsinternalthere.--with-version-opt=kdos— Sets the optional field of the version string. Without it configure writesadhoc.<user>.<directory>, which names the build machine and makes the build unreproducible.--with-version-build="$_build",--with-vendor-name=KDOS— The build number, a recipe helper, and the vendor name the JVM reports.make jdk-image— Builds the JDK image,build/linux-x86_64-server-release/images/jdk, which is copied into the package whole.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/openjdk, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf openjdk-25.0.4.1-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/openjdk, and runs the triggers its paths call for.
Contents
Installed programs: jar, jarsigner, java, javac, javadoc, javap, jcmd, jconsole, jdb, jdeprscan, jdeps, jfr, jhsdb, jimage, jinfo, jlink, jmap, jmod, jnativescan, jpackage, jps, jrunscript, jshell, jstack, jstat, jstatd, jwebserver, keytool, rmiregistry, serialver.
Installed directories: /usr/lib/jvm, /usr/share/licenses/openjdk.
Short descriptions
jar |
create an archive for classes and resources, and manipulate or restore individual classes or resources from an archive |
jarsigner |
sign and verify Java Archive (JAR) files |
java |
launch a Java application |
javac |
read Java declarations and compile them into class files |
javadoc |
generate HTML pages of API documentation from Java source files |
javap |
disassemble one or more class files |
jcmd |
send diagnostic command requests to a running Java Virtual Machine (JVM) |
jconsole |
start a graphical console to monitor and manage Java applications |
jdb |
find and fix bugs in Java platform programs |
jdeprscan |
static analysis tool that scans a jar file (or some other aggregation of class files) for uses of deprecated API elements |
jdeps |
launch the Java class dependency analyzer |
jfr |
print and manipulate Flight Recorder files |
jhsdb |
attach to a Java process or launch a postmortem debugger to analyze the content of a core dump from a crashed Java Virtual Machine (JVM) |
jinfo |
generate Java configuration information for a specified Java process |
jlink |
assemble and optimize a set of modules and their dependencies into a custom runtime image |
jmap |
print details of a specified process |
jmod |
create JMOD files and list the content of existing JMOD files |
jnativescan |
static analysis tool that scans one or more jar files for uses of native functionalities, such as restricted method calls or native method declarations. |
jpackage |
tool for packaging self-contained Java applications. |
jps |
list the instrumented JVMs on the target system |
jrunscript |
run a command-line script shell that supports interactive and batch modes |
jshell |
interactively evaluate declarations, statements, and expressions of the Java programming language in a read-eval-print loop (REPL) |
jstack |
print Java stack traces of Java threads for a specified Java process |
jstat |
monitor JVM statistics |
jstatd |
monitor the creation and termination of instrumented Java HotSpot VMs |
jwebserver |
launch the Java Simple Web Server |
keytool |
a key and certificate management utility |
rmiregistry |
create and start a remote object registry on the specified port on the current host |
serialver |
return the serialVersionUID for one or more classes in a form suitable for copying into an evolving class |
Notes
The build reads SOURCE_DATE_EPOCH, which must be set when configure runs, so the class files, jmods and version strings carry the tree’s pinned date.
pandoc renders the manual pages from their Markdown sources; without it the image has none. build.sh moves them from the image’s man/ to /usr/share/man/man1, where man looks, and deletes the image’s copy.
The seed’s binaries name Alpine’s libc.musl-x86_64.so.1 as their C library, which musl’s loader resolves to itself, so they run in the chroot unchanged.