93.4. ncdu-2.11.1
Disk usage analyser with an ncurses interface
2.11.1-2 · MIT · 4.0 SBU · 787.3 KiB, 5 files · 41_system, 502 of 1047 · ports/core/files/ncdu
Homepage: https://github.com/BratishkaErik/ncdu
ncdu shows which directories fill a disk, in a browsable ncurses view. It is written in Zig, and the port builds it with zig, linking ncurses and zstd from the system. ncdudep-translate_c and ncdudep-aro are the two Zig packages its build.zig fetches; the recipe unpacks them where zig build --system looks, so the build uses no network.
Depends on: zig, ncurses, zstd.
Required by: no port names it.
Sources: ncdu-2.11.1.tar.gz (80.6 KiB), ncdudep-translate_c.tar.gz (150.9 KiB), ncdudep-aro.tar.gz (956.5 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install ncdu'
build.sh:
export ZIG_GLOBAL_CACHE_DIR="$SRC_ROOT/zig-cache"
mkdir -p "$ZIG_GLOBAL_CACHE_DIR/p"
unpack_zig_dep() {
mkdir -p "$ZIG_GLOBAL_CACHE_DIR/p/$2"
tar xf "$PORT_SRC/ncdudep-$1.tar.gz" --strip-components=1 \
-C "$ZIG_GLOBAL_CACHE_DIR/p/$2"
}
unpack_zig_dep translate_c translate_c-0.0.0-Q_BUWgpXBwDWbTJQO9Ul01ZN4NJ4CEqQ4ZX1vLrcy38W
unpack_zig_dep aro aro-0.0.0-JSD1QrExOgBF8ySFOvEaZfP1LBTjgwg58Y7UHoGJ3nOd
unset PKG_CONFIG_PATH
zig build --system "$ZIG_GLOBAL_CACHE_DIR/p" -fsys=ncurses -fsys=zstd \
-Doptimize=ReleaseFast -Dcpu=baseline -Dpie=true \
--prefix "$PKG/usr"
strip --strip-debug "$PKG/usr/bin/ncdu"
install -Dm644 ncdu.1 "$PKG/usr/share/man/man1/ncdu.1"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/ncdu.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Disk Usage
GenericName=Disk Usage Analyser
Comment=Find what is filling the disk
Exec=ncdu
Icon=drive-harddisk
Terminal=true
Categories=System;Filesystem;
Keywords=disk;usage;space;du;ncdu;
EOF
chmod 644 "$PKG/usr/share/applications/ncdu.desktop"
unset PKG_CONFIG_PATH— Leaves pkgconf with its built-in search path, where it findsncurseswandlibzstdall the same. Zig reads the whole ofpkg-config --list-allto look up a system library and stops witherror: ReadFailurepast 400 KiB. The tree’sPKG_CONFIG_PATHrepeats directories pkgconf already searches, so each package is listed three times and a tree of about 1,800.pcfiles passes the limit. With its own path pkgconf lists each one once.-Dcpu=baseline— Compiles for the architecture’s base instruction set and not the build machine’s CPU.-Dpie=true— Links a position-independent executable, as every program in the tree is.-Doptimize=ReleaseFast— The optimised build; without a mode, Zig builds for debugging.
Programs: ncdu.
Directories: /usr/share/licenses/ncdu.