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

159.5. go-pmtiles-1.31.2

Create, inspect and serve PMTiles map archives

Version 1.31.2, release 1
Shelf gis — GIS, maps, projections, GPS, navigation and location
Phase 41_system (System), 581 of 1047 in build order
Licence BSD-3-Clause
Homepage https://github.com/protomaps/go-pmtiles
Build time 0.9 SBU
Installed size 61.9 MiB in 2 files
Recipe ports/core/gis/go-pmtiles/kpkgbuild

About

go-pmtiles is the reference tool for PMTiles, a single-file archive format for map tiles. It installs one program, pmtiles, whose subcommands include ones that inspect an archive (show, verify), read a tile out of it (tile), convert an MBTiles database into one (convert), cut a region or a range of zoom levels out of a larger one (extract), and serve the tiles over HTTP (serve). KDOS carries it for what it does with a file already on the disk; extract against a hosted planet archive is its network use, and not why it is here.

The build is the plain Go shape of writing-ports.md, with every switch canonical.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/gis.txt:

One file per map, and pmtiles show reads it off the disk. extract against the hosted planet is the network verb and is not why this is here.

Sources

Dependencies

Depends on: go.

Required by: no port names it.

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 go-pmtiles'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/gis/go-pmtiles.

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/gis/go-pmtiles
echo '022386795fae441dd35927e4061daaed8cda7e21ba0a2e2253c8fd0d85bc482f  go-pmtiles-1.31.2.tar.gz' | sha256sum -c -
echo 'c6e0df86d3520b561d24c2b0c13ea8a39e1a8d4e941d652e36b313e3c3dd5db3  go-pmtiles-vendor-1.31.2.tar.xz' | 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/go-pmtiles
SRC=$SRC_ROOT/go-pmtiles-1.31.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf go-pmtiles-1.31.2.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:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CGO_ENABLED=0
mkdir -p out
go build -mod=vendor -ldflags "-s -w" -o out/pmtiles .
install -Dm755 out/pmtiles $PKG/usr/bin/pmtiles

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/go-pmtiles, 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 go-pmtiles-1.31.2-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/go-pmtiles, and runs the triggers its paths call for.

Contents

Installed programs: pmtiles.

Installed directories: /usr/share/licenses/go-pmtiles.

Notes

The Go modules are not downloaded at build time. ports/fetch runs go mod vendor against the release and packs the module vendor/ tree into go-pmtiles-vendor-<version>.tar.xz, whose sha256 = line in the recipe holds it like any other source; build.sh unpacks it into the source tree and builds with -mod=vendor (see Vendoring).

The program is built as out/pmtiles, not pmtiles, because the source tree has a pmtiles/ package directory, and go build -o pmtiles would write the binary inside it.