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

99.16. hfsprogs-540.1.3

Apple HFS+ filesystem tools — mkfs.hfsplus and fsck.hfsplus, from Apple's diskdev_cmds

Version 540.1.3, release 3
Shelf filesystem — Filesystem utilities, FUSE, and network or encrypted filesystems
Phase 41_system (System), 519 of 1047 in build order
Licence APSL-2.0
Homepage https://src.fedoraproject.org/rpms/hfsplus-tools
Build time 0.1 SBU
Installed size 351.1 KiB in 8 files
Recipe ports/core/filesystem/hfsprogs/kpkgbuild

About

hfsprogs is mkfs.hfsplus and fsck.hfsplus, the tools that create and check Apple’s HFS+ filesystem. They are newfs_hfs and fsck_hfs from Apple’s diskdev_cmds, in the Linux port that Fedora distributes as hfsplus-tools, installed under the names fsck(8) and gparted look up. fsck.hfs is a link to fsck.hfsplus.

Sources

Dependencies

Depends on: clang, openssl, util-linux.

Required by (1): gparted.

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/41_system/phase.env && kpkg install hfsprogs'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/filesystem/hfsprogs.

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/filesystem/hfsprogs
echo 'b01b203a97f9a3bf36a027c13ddfc59292730552e62722d690d33bd5c24f5497  hfsprogs-540.1.3.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/hfsprogs
SRC=$SRC_ROOT/hfsprogs-540.1.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf hfsprogs-540.1.3.tar.gz -C "$SRC" --strip-components=1

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 _upver, _md5 and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/fix-stdarg.patch"
patch -p1 -i "$PORT_SRC/musl-compat.patch"

make \
	CFLAGS="$CFLAGS -Wall -fblocks -I$PWD/BlocksRunTime -I$PWD/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -DLINUX=1 -DBSD=1 -DVERSION=\\\"$_upver\\\" '-D__P(x)=x'" \
	LDFLAGS="$LDFLAGS -Wl,--build-id -L$PWD/BlocksRunTime"

install -Dm755 fsck_hfs.tproj/fsck_hfs "$PKG/usr/sbin/fsck.hfsplus"
install -Dm755 newfs_hfs.tproj/newfs_hfs "$PKG/usr/sbin/mkfs.hfsplus"
ln -s fsck.hfsplus "$PKG/usr/sbin/fsck.hfs"
install -Dm644 fsck_hfs.tproj/fsck_hfs.8 "$PKG/usr/share/man/man8/fsck.hfsplus.8"
install -Dm644 newfs_hfs.tproj/newfs_hfs.8 "$PKG/usr/share/man/man8/mkfs.hfsplus.8"
install -d "$PKG/usr/share/licenses/$name"
head -n 22 fsck_hfs.tproj/fsck_hfs.c > "$PKG/usr/share/licenses/$name/APSL-2.0"
install -m644 BlocksRunTime/LICENSE.TXT "$PKG/usr/share/licenses/$name/BlocksRunTime-LICENSE.TXT"
head -n 54 fsck_hfs.tproj/utilities.c | tail -n 32 > "$PKG/usr/share/licenses/$name/BSD-4-Clause-UC"

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/hfsprogs, 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 hfsprogs-540.1.3-3.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/hfsprogs, and runs the triggers its paths call for.

Contents

Installed programs: fsck.hfs, fsck.hfsplus, mkfs.hfsplus.

Installed directories: /usr/share/licenses/hfsprogs.

Short descriptions

fsck.hfsplus HFS file system consistency check
mkfs.hfsplus construct a new HFS Plus file system

Notes

CFLAGS and LDFLAGS on the make command line are the tree’s exported flags followed by every entry of upstream’s own except -g3, plus the __P definition. The top-level makefile exports both to the per-directory makefiles, so a flag left off this line is missing from every compile.

The tarball unpacks to diskdev_cmds-<upstream version>, and the source is fetched from Fedora’s lookaside cache, whose URL carries the file’s MD5; the recipe keeps it in the _md5 helper, and a version bump changes both.

<sys/cdefs.h> is not part of musl. The copy the compile finds in /usr/include/sys is installed by libbsd, which the recipe’s depends does not name.