1 Other Releases
liquibyte edited this page 2026-11-19 16:23:32 -06:00

Other Releases

How one project gets a package for each release of Debian, Devuan and Ubuntu: where the releases come from, sysroots for C programs, build environments for C++ programs, and when they are made again.

Building for other releases

A program built on this system takes this system's C library, and a newer C library's programs don't start on an older release. So for each release ticked on the Package page, Debwright builds the program again against that release's own files, and makes a package of its own for it.

Where the releases come from

Nothing about a release is written into Debwright. The distributions and their releases come from the tables of the distro-info-data package in /usr/share/distro-info, which apt keeps up to date: a release that comes out shows up after an upgrade. Where each distribution's packages are downloaded from, and the keys they are checked with, is in ~/.config/debwright/distributions, written with Debian's, Ubuntu's and Devuan's the first time Debwright starts. Add a section there for another distribution that has a table:

[devuan]
name = Devuan
mirror = http://deb.devuan.org/merged
archive = http://archive.devuan.org/merged
keyring = /usr/share/keyrings/devuan-archive-keyring.gpg
ended-keyring = /usr/share/keyrings/devuan-removed-keys.gpg
keyring-package = devuan-keyring
suffix = devuan

A distribution's packages can only be checked when its keyring is installed: ubuntu-keyring for Ubuntu, for example. The Problems list says so when it is missing.

What a build for a release does

  1. The release's sysroot: a folder that holds the release's libc6-dev and the project's build dependencies, unpacked as they would be installed. The first time, apt (run as you, with settings of its own) downloads the release's package list and those packages, checked with the distribution's keys, and Debwright unpacks them. That needs the network: about 10 MB for the list, and tens of MB for a program with a few libraries. The sysroot is in ~/.cache/debwright/sysroots, and every project uses it after that.
  2. Build and install with your commands, pointed at the sysroot: CC is cc --sysroot=..., pkg-config reads the sysroot's files, and CMake gets a toolchain file. A Makefile that uses $(CC) and pkg-config needs no change. DEBWRIGHT_RELEASE, DEBWRIGHT_SUFFIX and DEBWRIGHT_SYSROOT tell your commands which release they build for.
  3. The libraries the programs need are worked out from the release's own files: Debwright reads each program's needs itself and the release's symbols files say which package has each library, and from which version. A program that needs a function the release's libraries don't have stops the build, with its name and version: it would not start there.
  4. Every package the Dependencies page names (Depends, Pre-Depends, Recommends) must be in the release, in a version that fits.
  5. The package's version gets the release's suffix: 1.4+devuan5, 1.4+deb12, 1.4+ubuntu24.04. A newer release's suffix sorts higher, so a user who upgrades the system gets the newer package too. An older .deb is only removed for the same release.

This system's own release is built against this system, as usual, with its suffix. A build of a header or a pkg-config module the sysroot lacks fails: add its development package to Build dependencies. An error that comes from the release's older headers needs a change in the code.

C++ programs: build environments

A sysroot keeps this system's compiler, which is fine for C. A C++ program also takes the compiler's C++ headers and runtime (libstdc++), and this system's are newer than an older release has. So a C++ program is built in a build environment: a whole small system of the release, with its own compiler, made by mmdebstrap with build-essential and the build dependencies. It is made once, the first time (a few hundred MB, so it needs the network), and kept as a tarball in ~/.cache/debwright/buildenvs.

Each build unpacks it in a user namespace (you are its root there, with no root rights on your system), copies your source in, and runs your build and install commands in it, with $ROOT set. The package's files and the release's symbols files are copied out, and the unpacked system is removed. It needs mmdebstrap and subordinate IDs, as Test Install does. A build environment is made again on the same terms as a sysroot.

When a sysroot is made again

A stamp in the sysroot says when it was made and what it holds. It is made again when the stamp is missing (the folder was deleted, or a download was stopped: it is made in a .partial folder and only renamed when complete), when a project needs a development package it doesn't hold yet (it then holds all it had and the new one), and when it is a week old, with the release's newest packages; apt's kept downloads make that quick. Preferences lists what each release has downloaded, with Rebuild and Remove.