💾 Archived View for lofi.haiku-os.org › docs › develop › packages › Bootstrapping.gmi captured on 2023-12-28 at 15:23:36. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-28)
-=-=-=-=-=-=-
Even a very basic Haiku requires a set of third-party packages (ICU, zlib,…), a Haiku sufficiently complete to build software even more (binutils, gcc, make,…). So whenever something fundamental in Haiku (the architecture ABI, the ABI of libroot) changes in a binary incompatible way, or when Haiku is ported to a new architecture, it is necessary to bootstrap Haiku and a basic set of required third-party packages. This document describes how this process works.
.
1. Configure the Haiku build with all usual parameters, but add the "--bootstrap" option with its three parameters, the paths to the checked out haikuporter *script* (eg. "../haikuporter/haikuporter"), haikuports.cross, and haikuports repositories folders:
.../configure ... --bootstrap path/to/haikuporter path/to/haikuports.cross path/to/haikuports
It is important that you build outside the tree, as otherwise the build will fail!
2. Build a bootstrap Haiku image:
jam -q @bootstrap-raw
3. Boot the bootstrap Haiku (e.g. in a virtual machine), edit the file “/boot/home/haikuports/haikuports.config” – entering your email address in the “PACKAGER” field – and finally open a Terminal and build the third-party packages:
cd haikuports haikuporter --do-bootstrap
In the “packages” subdirectory the built packages are collected. This is the initial set of packages for the HaikuPorts packages repository, plus the source packages the Haiku build system put in your generated directory under “objects/haiku/<arch>/packaging/repositories/HaikuPorts-sources-build/packages” (ignore the “rigged” source packages). With these packages a HaikuPorts package repository can be built and in turn a regular Haiku can be built using it. Further packages can then be built on the regular Haiku.
Further hints:
Building the bootstrap Haiku image is in principle quite similar to building a regular Haiku image, save for the following differences:
Obviously the last two points are the juicy parts. Building a bootstrap third-party package – unless it is a pure data package – requires certain parts of Haiku; usually the headers, libroot and other libraries, and the glue code. For some Haiku libraries we do already need certain third-party packages. So there’s a bit of ping pong going on:
The rigged source packages (and regular source packages) are built via "haikuporter" from the regular haikuports repository checkout. haikuports contains build recipes for a lot of software. Which source packages should be built is determined by the build system by checking what packages are needed for the target build profile used by the bootstrap process. This defaults to “minimum-raw”, but it can be changed by setting the jam variable “HAIKU_BOOTSTRAP_SOURCES_PROFILE” (i.e. "jam -sHAIKU_BOOTSTRAP_SOURCES_PROFILE=@release-raw -q @bootstrap-raw" will include source packages for all packages needed by release image).
For Haikuporter to use source or “rigged” packages instead of requesting packages from a remote url (essential during bootstrap when patch, git, curl, etc are unavailable), haikuporter works on an empty haikuports repository with the following layout:
After "haikuporter" is given this directory structure, it will parse the source or “rigged” packages, and allow you to build them internally replacing the SOURCE_URI with "pkg:input-source-packages/"
This process is generally automated during the generation of the bootstrap image, but manual setup may be needed if the bootstrap image is non-functional on your target platform.
When preparing a new Haiku architecture port for the bootstrap build the following things need to be considered:
If the Haiku architecture port doesn’t support a working userland yet, the process obviously cannot go further than building the bootstrap Haiku image.