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

49.2. sqlite-3530400

Self-contained, serverless, transactional SQL database engine

Version 3530400, release 1
Shelf database — Database engines, embedded key-value stores, database servers, clients and full-text indexes
Phase 30_foundation (Build Foundation), 31 of 127 in build order
Licence blessing
Homepage https://www.sqlite.org/
Build time 1.7 SBU
Installed size 6.9 MiB in 9 files
Recipe ports/core/database/sqlite/kpkgbuild

About

SQLite is an SQL database engine in a library: a database is one file, opened directly by the program that uses it, with no server. A great deal of the tree stores its data this way: python3’s sqlite3 module, util-linux, GnuPG, nss, both Qt bases, WebKitGTK, gdal and the map programs, and the container stack behind the boxes, where podman and buildah are built with it. The port builds upstream’s amalgamation tarball, whose library is one large sqlite3.c, and turns on at compile time the optional features listed below.

The sqlite3 shell that ships beside the library embeds its own copy of sqlite3.c rather than linking libsqlite3.so, so the options below reach both.

Sources

Dependencies

Depends on: zlib, readline, ncurses.

Required by (71): aircrack-ng, aria2, atuin, avidemux, buildah, calibre, crawl-tiles, darktable, ddnet, diamond, dino, doxygen, fastfetch, filezilla, font-manager, freeciv, fwupd, gdal, gnupg, horizon-eda, hostapd, iamb, kdos-runner, kget, kodi, libaccounts-glib, libgpod, libreoffice, libsoup3, libspatialite, libstoragemgmt, lnav, luanti, maddy, mgba, minidlna, mosquitto, mpd, mumble, newsboat, nfs-utils, nodejs, nss, opencpn, podman, profanity, proj, python3, qgis, qt5-qtbase, qt5-qttools, qt6-qtbase, qt6-qttools, ripgrep-all, skopeo, sleuthkit, sqlitebrowser, stella, strawberry, supertuxkart, taskwarrior, tenacity, termusic, usql, util-linux, viking, vtk, warzone2100, webkitgtk, webkitgtk6, zeal.

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/30_foundation/phase.env && kpkg install sqlite'

What kpkg does

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

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/database/sqlite
echo '0e9483900e92cd5de8fd48d16bf9200145a61f7fd5be542a5ac81d8a9516eb9c  sqlite-3530400.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/sqlite
SRC=$SRC_ROOT/sqlite-3530400
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf sqlite-3530400.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:

export CPPFLAGS="$CPPFLAGS \
	-DSQLITE_ENABLE_COLUMN_METADATA=1 \
	-DSQLITE_ENABLE_UNLOCK_NOTIFY \
	-DSQLITE_ENABLE_DBSTAT_VTAB=1 \
	-DSQLITE_ENABLE_FTS3_TOKENIZER=1 \
	-DSQLITE_ENABLE_FTS3_PARENTHESIS \
	-DSQLITE_SECURE_DELETE \
	-DSQLITE_ENABLE_STMTVTAB \
	-DSQLITE_MAX_VARIABLE_NUMBER=250000 \
	-DSQLITE_MAX_EXPR_DEPTH=10000 \
	-DSQLITE_ENABLE_MATH_FUNCTIONS \
	-DSQLITE_ENABLE_RTREE=1 \
	-DSQLITE_ENABLE_GEOPOLY=1"
./configure --prefix=/usr \
	--enable-fts3 \
	--enable-fts4 \
	--enable-fts5 \
	--session \
	--dbpage \
	--enable-readline \
	--soname=legacy \
	--disable-rpath
make
make DESTDIR=$PKG install

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/sqlite, 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 sqlite-3530400-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/sqlite, and runs the triggers its paths call for.

Contents

Installed programs: sqlite3.

Installed libraries: libsqlite3.a, libsqlite3.so.

Short descriptions

sqlite3 A command line interface for SQLite version 3
sqlite3.pc SQL database engine