README: Add table of contents.

This commit is contained in:
Alexis 2020-03-22 15:13:31 +11:00 committed by Juan RP
parent 5da336e4e9
commit b7931b437a

View file

@ -12,6 +12,28 @@ for a general overview of how to contribute and the
[Manual](https://github.com/void-linux/void-packages/blob/master/Manual.md)
for details of how to create source packages.
### Table of Contents
- [Requirements](#requirements)
- [chroot methods](#chroot-methods)
- [Quick setup in Void](#quick-setup)
- [Install the bootstrap packages](#install-bootstrap)
- [Configuration](#configuration)
- [Directory hierarchy](#directory-hierarchy)
- [Building packages](#building-packages)
- [Package build options](#build-options)
- [Sharing and signing your local repositories](#sharing-and-signing)
- [Rebuilding and overwriting existing local packages](#rebuilding)
- [Enabling distcc for distributed compilation](#distcc)
- [Distfiles mirrors](#distfiles-mirrors)
- [Cross compiling packages for a target architecture](#cross-compiling)
- [Using xbps-src in a foreign Linux distribution](#foreign)
- [Remaking the masterdir](#remaking-masterdir)
- [Keeping your masterdir uptodate](#updating-masterdir)
- [Building 32bit packages on x86_64](#building-32bit)
- [Building packages natively for the musl C library](#building-for-musl)
- [Building void base-system from scratch](#building-base-system)
### Requirements
- GNU bash
@ -36,6 +58,7 @@ multiple utilities to accomplish this task:
> NOTE: `xbps-src` does not allow building as root anymore. Use one of the chroot
methods shown above.
<a name="chroot-methods"></a>
### chroot methods
#### xbps-uunshare(1) (default)
@ -89,6 +112,7 @@ To enable it:
$ cd void-packages
$ echo XBPS_CHROOT_CMD=proot >> etc/conf
<a name="quick-setup"></a>
### Quick setup in Void
Clone the `void-packages` git repository, install the bootstrap packages:
@ -106,6 +130,7 @@ Type:
to see all available targets/options and start building any available package
in the `srcpkgs` directory.
<a name="install-bootstrap"></a>
### Install the bootstrap packages
The `bootstrap` packages are a set of packages required to build any available source package in a container. There are two methods to install the `bootstrap`:
@ -141,6 +166,7 @@ used as dependencies in the source packages tree.
If you want to customize those replacements, copy `etc/defaults.virtual` to `etc/virtual`
and edit it accordingly to your needs.
<a name="directory-hierarchy"></a>
### Directory hierarchy
The following directory hierarchy is used with a default configuration file:
@ -177,6 +203,7 @@ The description of these directories is as follows:
- `hostdir/sources`: to store package sources.
- `hostdir/binpkgs`: local repository to store generated binary packages.
<a name="building-packages"></a>
### Building packages
The simplest form of building package is accomplished by running the `pkg` target in `xbps-src`:
@ -203,6 +230,7 @@ It is possible to avoid using remote repositories completely by using the `-N` f
> The default local repository may contain multiple *sub-repositories*: `debug`, `multilib`, etc.
<a name="build-options"></a>
### Package build options
The supported build options for a source package can be shown with `xbps-src show-options`:
@ -242,6 +270,7 @@ i.e `XBPS_PKG_OPTIONS_xorg_server=opt`.
The list of supported package build options and its description is defined in the
`common/options.description` file or in the `template` file.
<a href="sharing-and-signing"></a>
### Sharing and signing your local repositories
To share a local repository remotely it's mandatory to sign it and the binary packages
@ -279,6 +308,7 @@ Each time a binary package is created, a package signature must be created with
> It is not possible to sign a repository with multiple RSA keys.
<a name="rebuilding"></a>
### Rebuilding and overwriting existing local packages
If for whatever reason a package has been built and it is available in your local repository
@ -294,6 +324,7 @@ Reinstalling this package in your target `rootdir` can be easily done too:
> Please note that the `package expression` must be properly defined to explicitly pick up
the package from the desired repository.
<a name="distcc"></a>
### Enabling distcc for distributed compilation
Setup the slaves (machines that will compile the code):
@ -324,6 +355,7 @@ The slave 192.168.2.101 has a CPU with 8 cores and the /9 for the number of jobs
The slave 192.168.2.102 is set to run at most 2 compile jobs to keep its load low, even if its CPU has 4 cores.
The XBPS_MAKEJOBS setting is increased to 16 to account for the possible parallelism (2 + 9 + 2 + some slack).
<a name="distfiles-mirrors"></a>
### Distfiles mirror(s)
In etc/conf you may optionally define a mirror or a list of mirrors to search for distfiles.
@ -348,6 +380,7 @@ using the `file://` prefix or simply an absolute path on your build host (e.g. /
Mirror locations specified this way are bind mounted inside the chroot environment
under $XBPS_MASTERDIR and searched for distfiles just the same as remote locations.
<a name="cross-compiling"></a>
### Cross compiling packages for a target architecture
Currently `xbps-src` can cross build packages for some target architectures with a cross compiler.
@ -359,6 +392,7 @@ If a source package has been adapted to be **cross buildable** `xbps-src` will a
If the build for whatever reason fails, might be a new build issue or simply because it hasn't been adapted to be **cross compiled**.
<a name="foreign"></a>
### Using xbps-src in a foreign Linux distribution
xbps-src can be used in any recent Linux distribution matching the CPU architecture.
@ -386,7 +420,7 @@ and `xbps-src` should be fully functional; just start the `bootstrap` process, i
The default masterdir is created in the current working directory, i.e `void-packages/masterdir`.
<a name="remaking-masterdir"></a>
### Remaking the masterdir
If for some reason you must update xbps-src and the `bootstrap-update` target is not enough, it's possible to recreate a masterdir with two simple commands (please note that `zap` keeps your `ccache/distcc/host` directories intact):
@ -394,12 +428,14 @@ If for some reason you must update xbps-src and the `bootstrap-update` target is
$ ./xbps-src zap
$ ./xbps-src binary-bootstrap
<a name="updating-masterdir"></a>
### Keeping your masterdir uptodate
Sometimes the bootstrap packages must be updated to the latest available version in repositories, this is accomplished with the `bootstrap-update` target:
$ ./xbps-src bootstrap-update
<a name="building-32bit"></a>
### Building 32bit packages on x86_64
Two ways are available to build 32bit packages on x86\_64:
@ -416,6 +452,7 @@ The second mode (native) needs a new x86 `masterdir`:
$ ./xbps-src -m masterdir-x86 binary-bootstrap i686
$ ./xbps-src -m masterdir-x86 ...
<a name="building-for-musl"></a>
### Building packages natively for the musl C library
A native build environment is required to be able to cross compile the bootstrap packages for the musl C library; this is accomplished by installing them via `binary-bootstrap`:
@ -437,6 +474,7 @@ Your new masterdir is now ready to build packages natively for the musl C librar
To see if the musl C dynamic linker is working as expected.
<a name="building-base-system"></a>
### Building void base-system from scratch
To rebuild all packages in `base-system` for your native architecture: