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

118.26. aalib-1.4rc5

ASCII art graphics library — renders true-color images to text

Version 1.4rc5, release 1
Shelf image-libs — Raster image formats, codecs, metadata, processing, barcodes, and terminal image output
Phase 41_system (System), 705 of 1047 in build order
Licence LGPL-2.0-or-later
Homepage https://aa-project.sourceforge.net/aalib/
Build time 0.1 SBU
Installed size 455.8 KiB in 79 files
Recipe ports/core/image-libs/aalib/kpkgbuild

About

aalib is the aa-project’s ASCII-art library: it renders an image as text, on a terminal through curses or on the Linux console. kdos-bb draws with it, and aview, gst-plugins-good, gimp and gphoto2 link it. The package also installs aalib’s own demonstrations, aafire, aatest, aainfo and aasavefont.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/image-libs.txt:

ASCII art from the aa-project, on the TTY. aalib's own demos are aafire/aatest/aainfo/aasavefont.

Sources

Dependencies

Depends on: ncurses.

Required by (5): aview, gimp, gphoto2, gst-plugins-good, kdos-bb.

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 aalib'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/image-libs/aalib.

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/image-libs/aalib
echo 'fbddda9230cf6ee2a4f5706b4b11e2190ae45f5eda1f0409dc4f99b35e0a70ee  aalib-1.4rc5.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/aalib
SRC=$SRC_ROOT/aalib-1.4rc5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf aalib-1.4rc5.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i $PORT_SRC/ncurses-opaque-window.patch
patch -p1 -i $PORT_SRC/curses-kbd-debug-print.patch
patch -p1 -i "$PORT_SRC/m4-quote.patch"
patch -p1 -i "$PORT_SRC/linuxkbd-bounds.patch"
patch -p1 -i "$PORT_SRC/config-no-rpath.patch"
patch -p1 -i "$PORT_SRC/ltconfig-musl.patch"
patch -p1 -i "$PORT_SRC/curses-resize.patch"

export CFLAGS="$CFLAGS -Wno-implicit-function-declaration -Wno-implicit-int \
	-Wno-int-conversion -Wno-incompatible-pointer-types \
	-Wno-return-mismatch -Wno-declaration-missing-parameter-type"

ac_cv_lib_gpm_Gpm_Repeat=no CC="$CC $LDFLAGS" \
./configure --prefix=/usr \
            --libdir=/usr/lib \
            --mandir=/usr/share/man \
            --infodir=/usr/share/info \
            --disable-static \
            --with-ncurses \
            --with-slang-driver=no \
            --with-x11-driver=no \
            --without-x
make
make DESTDIR=$PKG install
readelf -d $PKG/usr/lib/libaa.so.1 | grep -q 'NEEDED.*\[libncursesw\?\.so'

rm -f $PKG/usr/share/info/dir

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/aalib, 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 aalib-1.4rc5-1.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/aalib, and runs the triggers its paths call for.

Contents

Installed programs: aafire, aainfo, aalib-config, aasavefont, aatest.

Installed libraries: libaa.so.

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

Short descriptions

aafire aalib example programs

Notes

After the install, build.sh reads the dynamic section of libaa.so.1 and fails unless it names libncurses.so or libncursesw.so as needed. configure finds ncurses by probing, and a probe that misses still produces a library, one with no curses driver, which every consumer would then receive; the check stops the build there instead.

curses-resize.patch is what lets a curses program follow a terminal resize: kdos-bb calls aa_resize() at the start of each scene and takes the new size there.