Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

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

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.

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:

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.