2014-04-01 12:13:59 +02:00
## The XBPS source packages collection
2012-12-23 11:18:30 +01:00
2014-04-01 11:29:21 +02:00
This repository contains the XBPS source packages collection to build binary packages
2014-03-22 13:09:30 +01:00
for the Void Linux distribution.
2012-12-23 11:18:30 +01:00
2014-11-22 17:19:25 +01:00
The included `xbps-src` script will fetch and compile the sources, and install its
files into a `fake destdir` to generate XBPS binary packages that can be installed
2015-06-04 11:38:49 +02:00
or queried through the `xbps-install(1)` and `xbps-query(1)` utilities, respectively.
2012-12-23 11:18:30 +01:00
2020-07-08 21:40:46 +02:00
See [Contributing ](./CONTRIBUTING.md ) for a general overview of how to contribute and the
[Manual ](./Manual.md ) for details of how to create source packages.
2019-11-03 00:39:39 +01:00
2020-03-22 05:13:31 +01:00
### Table of Contents
- [Requirements ](#requirements )
2020-03-26 03:19:20 +01:00
- [Quick start ](#quick-start )
2020-03-22 05:13:31 +01:00
- [chroot methods ](#chroot-methods )
- [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 )
2015-05-02 05:24:11 +02:00
### Requirements
2019-06-22 10:40:35 +02:00
- GNU bash
2020-01-05 09:44:14 +01:00
- xbps >= 0.56
2021-02-22 21:24:47 +01:00
- git(1) - unless configured to not, see etc/defaults.conf
- common POSIX utilities included by default in almost all UNIX systems
2019-06-22 10:40:35 +02:00
- curl(1) - required by `xbps-src update-check`
2021-02-22 21:24:47 +01:00
For bootstrapping additionally:
2019-06-22 10:40:35 +02:00
- flock(1) - util-linux
2020-01-05 09:44:14 +01:00
- bsdtar or GNU tar (in that order of preference)
- install(1) - GNU coreutils
- objcopy(1), objdump(1), strip(1): binutils
2015-05-02 05:24:11 +02:00
2021-08-10 20:46:25 +02:00
`xbps-src` requires [a utility to chroot ](#chroot-methods ) and bind mount existing directories
2015-04-14 08:14:07 +02:00
into a `masterdir` that is used as its main `chroot` directory. `xbps-src` supports
2021-08-10 20:46:25 +02:00
multiple utilities to accomplish this task.
2015-04-14 08:14:07 +02:00
2020-02-06 08:33:03 +01:00
> NOTE: `xbps-src` does not allow building as root anymore. Use one of the chroot
2021-08-10 20:46:25 +02:00
methods.
2015-04-14 08:14:07 +02:00
2020-03-26 03:19:20 +01:00
< a name = "quick-start" > < / a >
### Quick start
Clone the `void-packages` git repository and install the bootstrap packages:
```
2021-11-04 00:42:48 +01:00
$ git clone https://github.com/void-linux/void-packages.git
2020-03-26 03:19:20 +01:00
$ cd void-packages
$ ./xbps-src binary-bootstrap
```
Build a package by specifying the `pkg` target and the package name:
```
$ ./xbps-src pkg < package_name >
```
Use `./xbps-src -h` to list all available targets and options.
To build packages marked as 'restricted', modify `etc/conf` :
```
$ echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
```
Once built, the package will be available in `hostdir/binpkgs` or an appropriate subdirectory (e.g. `hostdir/binpkgs/nonfree` ). To install the package:
```
# xbps-install --repository hostdir/binpkgs <package_name>
```
Alternatively, packages can be installed with the `xi` utility, from the `xtools` package. `xi` takes the repository of the current working directory into account.
```
2023-12-05 17:54:03 +01:00
$ xi < package_name >
2020-03-26 03:19:20 +01:00
```
2020-03-22 05:13:31 +01:00
< a name = "chroot-methods" > < / a >
2020-02-06 08:33:03 +01:00
### chroot methods
#### xbps-uunshare(1) (default)
2015-04-14 08:14:07 +02:00
2021-08-10 20:46:25 +02:00
XBPS utility that uses `user_namespaces(7)` (part of xbps, default without `-t` flag).
2015-06-28 11:01:36 +02:00
This utility requires these Linux kernel options:
2015-04-14 08:14:07 +02:00
- CONFIG\_NAMESPACES
- CONFIG\_IPC\_NS
- CONFIG\_UTS\_NS
- CONFIG\_USER\_NS
2015-04-14 08:38:07 +02:00
This is the default method, and if your system does not support any of the required kernel
options it will fail with `EINVAL (Invalid argument)` .
2015-06-04 11:38:49 +02:00
#### xbps-uchroot(1)
2015-04-14 08:14:07 +02:00
2021-08-10 20:46:25 +02:00
XBPS utility that uses `namespaces` and must be `setgid` (part of xbps).
> NOTE: This is the only method that implements functionality of `xbps-src -t`, therefore the
flag ignores the choice made in configuration files and enables `xbps-uchroot` .
2015-06-28 11:01:36 +02:00
This utility requires these Linux kernel options:
2015-04-14 08:14:07 +02:00
- CONFIG\_NAMESPACES
- CONFIG\_IPC\_NS
- CONFIG\_PID\_NS
- CONFIG\_UTS\_NS
2015-06-04 11:38:49 +02:00
Your user must be added to a special group to be able to use `xbps-uchroot(1)` and the
2015-04-14 08:14:07 +02:00
executable must be `setgid` :
2015-04-14 08:23:07 +02:00
# chown root:< group > xbps-uchroot
# chmod 4750 xbps-uchroot
2015-04-14 08:40:19 +02:00
# usermod -a -G < group > < user >
2015-04-14 08:23:07 +02:00
> NOTE: by default in void you shouldn't do this manually, your user must be a member of
the `xbuilder` group.
2014-11-22 17:19:25 +01:00
2015-04-14 08:32:02 +02:00
To enable it:
$ cd void-packages
$ echo XBPS_CHROOT_CMD=uchroot >> etc/conf
2015-06-28 11:01:36 +02:00
If for some reason it's erroring out as `ERROR clone (Operation not permitted)` , check that
2015-06-04 11:38:49 +02:00
your user is a member of the required `group` and that `xbps-uchroot(1)` utility has the
2015-04-14 08:38:07 +02:00
proper permissions and owner/group as explained above.
2021-08-10 20:46:25 +02:00
#### bwrap(1)
bubblewrap, sandboxing tool for unprivileged users that uses
user namespaces or setuid.
See < https: / / github . com / containers / bubblewrap > .
#### ethereal
Destroys host system it runs on. Only useful for one-shot containers, i.e docker (used with CI).
2020-03-22 05:13:31 +01:00
< a name = "install-bootstrap" > < / a >
2014-11-22 17:19:25 +01:00
### Install the bootstrap packages
2020-05-11 05:48:45 +02:00
There is a set of packages that makes up the initial build container, called the `bootstrap` .
These packages are installed into the `masterdir` in order to create the container.
The primary and recommended way to set up this container is using the `binary-bootstrap`
command. This will use pre-existing binary packages, either from remote `xbps` repositories
or from your local repository.
There is also the `bootstrap` command, which will build all necessary `bootstrap` packages from
scratch. This is usually not recommended, since those packages are built using your host system's
toolchain and are neither fully featured nor reproducible (your host system may influence the
build) and thus should only be used as a stage 0 for bootstrapping new Void systems.
If you still choose to use `bootstrap` , use the resulting stage 0 container to rebuild all
`bootstrap` packages again, then use `binary-bootstrap` (stage 1) and rebuild the `bootstrap`
packages once more (to gain stage 2, and then use `binary-bootstrap` again). Once you've done
that, you will have a `bootstrap` set equivalent to using `binary-bootstrap` in the first place.
Also keep in mind that a full source `bootstrap` is time consuming and will require having an
assortment of utilities installed in your host system, such as `binutils` , `gcc` , `perl` ,
`texinfo` and others.
2014-11-22 17:19:25 +01:00
2014-09-06 12:37:09 +02:00
### Configuration
2015-06-28 11:01:36 +02:00
The `etc/defaults.conf` file contains the possible settings that can be overridden
2014-07-01 10:40:33 +02:00
through the `etc/conf` configuration file for the `xbps-src` utility; if that file
2020-05-08 16:09:48 +02:00
does not exist, will try to read configuration settings from `$XDG_CONFIG_HOME/xbps-src.conf` , `~/.config/xbps-src.conf` , `~/.xbps-src.conf` .
2014-03-22 19:49:59 +01:00
2014-05-16 10:21:50 +02:00
If you want to customize default `CFLAGS` , `CXXFLAGS` and `LDFLAGS` , don't override
2015-03-04 15:42:40 +01:00
those defined in `etc/defaults.conf` , set them on `etc/conf` instead i.e:
2014-05-16 10:21:50 +02:00
2015-03-04 15:42:40 +01:00
$ echo 'XBPS_CFLAGS="your flags here"' >> etc/conf
$ echo 'XBPS_LDFLAGS="your flags here"' >> etc/conf
2014-05-16 10:21:50 +02:00
2015-04-06 16:35:20 +02:00
Native and cross compiler/linker flags are set per architecture in `common/build-profiles`
and `common/cross-profiles` respectively. Ideally those settings are good enough by default,
and there's no need to set your own unless you know what you are doing.
2016-04-27 20:16:59 +02:00
#### Virtual packages
The `etc/defaults.virtual` file contains the default replacements for virtual packages,
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.
2020-03-22 05:13:31 +01:00
< a name = "directory-hierarchy" > < / a >
2015-07-12 10:05:39 +02:00
### Directory hierarchy
2014-11-22 17:19:25 +01:00
2015-07-12 10:05:39 +02:00
The following directory hierarchy is used with a default configuration file:
2014-11-22 17:19:25 +01:00
2014-11-22 17:47:24 +01:00
/void-packages
2014-11-22 17:19:25 +01:00
|- common
|- etc
|- srcpkgs
| |- xbps
| |- template
|
|- hostdir
| |- binpkgs ...
2019-06-17 14:37:16 +02:00
| |- ccache ...
2014-11-22 17:19:25 +01:00
| |- distcc-< arch > ...
| |- repocache ...
| |- sources ...
|
|- masterdir
| |- builddir -> ...
| |- destdir -> ...
| |- host -> bind mounted from < hostdir >
| |- void-packages -> bind mounted from < void-packages >
The description of these directories is as follows:
- `masterdir` : master directory to be used as rootfs to build/install packages.
- `builddir` : to unpack package source tarballs and where packages are built.
- `destdir` : to install packages, aka **fake destdir** .
2015-07-12 10:05:39 +02:00
- `hostdir/ccache` : to store ccache data if the `XBPS_CCACHE` option is enabled.
2014-11-22 17:19:25 +01:00
- `hostdir/distcc-<arch>` : to store distcc data if the `XBPS_DISTCC` option is enabled.
2014-11-22 17:47:24 +01:00
- `hostdir/repocache` : to store binary packages from remote repositories.
- `hostdir/sources` : to store package sources.
2014-11-22 17:19:25 +01:00
- `hostdir/binpkgs` : local repository to store generated binary packages.
2020-03-22 05:13:31 +01:00
< a name = "building-packages" > < / a >
2014-11-22 17:19:25 +01:00
### Building packages
The simplest form of building package is accomplished by running the `pkg` target in `xbps-src` :
```
$ cd void-packages
$ ./xbps-src pkg < pkgname >
```
2014-11-22 17:27:09 +01:00
When the package and its required dependencies are built, the binary packages will be created
2020-04-30 22:18:11 +02:00
and registered in the default local repository at `hostdir/binpkgs` ; the path to this local repository can be added to
2015-01-12 23:42:48 +01:00
any xbps configuration file (see xbps.d(5)) or by explicitly appending them via cmdline, i.e:
2014-11-22 17:27:09 +01:00
2015-04-06 16:35:20 +02:00
$ xbps-install --repository=hostdir/binpkgs ...
$ xbps-query --repository=hostdir/binpkgs ...
2015-01-12 23:42:48 +01:00
2014-11-22 17:19:25 +01:00
By default **xbps-src** will try to resolve package dependencies in this order:
2018-10-18 22:13:01 +02:00
- If a dependency exists in the local repository, use it (`hostdir/binpkgs`).
- If a dependency exists in a remote repository, use it.
- If a dependency exists in a source package, use it.
2014-11-22 17:19:25 +01:00
It is possible to avoid using remote repositories completely by using the `-N` flag.
2015-01-13 00:16:41 +01:00
> The default local repository may contain multiple *sub-repositories*: `debug`, `multilib`, etc.
2014-11-22 17:27:09 +01:00
2020-03-22 05:13:31 +01:00
< a name = "build-options" > < / a >
2015-01-22 07:40:25 +01:00
### Package build options
The supported build options for a source package can be shown with `xbps-src show-options` :
$ ./xbps-src show-options foo
Build options can be enabled with the `-o` flag of `xbps-src` :
$ ./xbps-src -o option,option1 pkg foo
Build options can be disabled by prefixing them with `~` :
$ ./xbps-src -o ~option,~option1 pkg foo
Both ways can be used together to enable and/or disable multiple options
at the same time with `xbps-src` :
$ ./xbps-src -o option,~option1,~option2 pkg foo
2015-06-04 11:38:49 +02:00
The build options can also be shown for binary packages via `xbps-query(1)` :
2015-01-22 07:40:25 +01:00
$ xbps-query -R --property=build-options foo
> NOTE: if you build a package with a custom option, and that package is available
in an official void repository, an update will ignore those options. Put that package
2015-06-04 11:38:49 +02:00
on `hold` mode via `xbps-pkgdb(1)` , i.e `xbps-pkgdb -m hold foo` to ignore updates
2015-01-22 07:40:25 +01:00
with `xbps-install -u` . Once the package is on `hold` , the only way to update it
2015-06-28 11:01:36 +02:00
is by declaring it explicitly: `xbps-install -u foo` .
2015-01-22 07:40:25 +01:00
Permanent global package build options can be set via `XBPS_PKG_OPTIONS` variable in the
`etc/conf` configuration file. Per package build options can be set via
`XBPS_PKG_OPTIONS_<pkgname>` .
> NOTE: if `pkgname` contains `dashes`, those should be replaced by `underscores`
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.
2020-04-30 22:18:11 +02:00
< a name = "sharing-and-signing" > < / a >
2015-01-12 23:50:01 +01:00
### Sharing and signing your local repositories
To share a local repository remotely it's mandatory to sign it and the binary packages
2015-06-04 11:38:49 +02:00
stored on it. This is accomplished with the `xbps-rindex(1)` utility.
2015-01-12 23:50:01 +01:00
2015-06-04 11:38:49 +02:00
First a RSA key must be created with `openssl(1)` or `ssh-keygen(1)` :
2015-01-12 23:50:01 +01:00
$ openssl genrsa -des3 -out privkey.pem 4096
or
2018-10-23 00:09:08 +02:00
$ ssh-keygen -t rsa -b 4096 -m PEM -f privkey.pem
2015-01-12 23:50:01 +01:00
2015-01-13 00:16:41 +01:00
> Only RSA keys in PEM format are currently accepted by xbps.
2015-01-12 23:50:01 +01:00
2015-07-12 10:05:39 +02:00
Once the RSA private key is ready you can use it to initialize the repository metadata:
2015-01-12 23:50:01 +01:00
2015-01-13 00:03:01 +01:00
$ xbps-rindex --sign --signedby "I'm Groot" --privkey privkey.pem $PWD/hostdir/binpkgs
2015-07-12 10:05:39 +02:00
And then make a signature per package:
$ xbps-rindex --sign-pkg --privkey privkey.pem $PWD/hostdir/binpkgs/*.xbps
2015-01-13 00:16:41 +01:00
> If --privkey is unset, it defaults to `~/.ssh/id_rsa`.
2015-01-12 23:50:01 +01:00
If the RSA key was protected with a passphrase you'll have to type it, or alternatively set
it via the `XBPS_PASSPHRASE` environment variable.
2023-02-20 19:38:47 +01:00
Once the binary packages have been signed, check if the repository contains the appropriate `hex fingerprint` :
2015-01-12 23:50:01 +01:00
2015-07-12 10:05:39 +02:00
$ xbps-query --repository=hostdir/binpkgs -vL
2015-01-12 23:50:01 +01:00
...
2015-07-12 10:05:39 +02:00
Each time a binary package is created, a package signature must be created with `--sign-pkg` .
2015-01-13 00:16:41 +01:00
> It is not possible to sign a repository with multiple RSA keys.
2023-11-18 05:19:16 +01:00
If packages in `hostdir/binpkgs` are signed, the key in `.plist` format (as imported by xbps) can be placed
in `etc/repo-keys/` to prevent xbps-src from prompting to import that key.
2020-03-22 05:13:31 +01:00
< a name = "rebuilding" > < / a >
2014-11-22 17:19:25 +01:00
### Rebuilding and overwriting existing local packages
2021-08-18 01:05:00 +02:00
Packages are overwritten on every build to make getting package with changed build options easy.
2023-02-20 19:38:47 +01:00
To make xbps-src skip build and preserve first package build with given version and revision,
2021-08-18 01:05:00 +02:00
same as in official void repository, set `XBPS_PRESERVE_PKGS=yes` in `etc/conf` file.
2014-11-22 17:19:25 +01:00
2021-08-18 01:05:00 +02:00
Reinstalling a package in your target `rootdir` can be easily done too:
2014-11-22 17:19:25 +01:00
2021-08-18 01:05:00 +02:00
$ xbps-install --repository=/path/to/local/repo -yf xbps-0.25_1
2014-11-22 17:19:25 +01:00
2021-08-18 01:05:00 +02:00
Using `-f` flag twice will overwrite configuration files.
2014-11-22 17:19:25 +01:00
> Please note that the `package expression` must be properly defined to explicitly pick up
the package from the desired repository.
2020-03-22 05:13:31 +01:00
< a name = "distcc" > < / a >
2014-11-22 17:19:25 +01:00
### Enabling distcc for distributed compilation
2023-10-02 09:10:51 +02:00
Setup the workers (machines that will compile the code):
2014-11-22 17:19:25 +01:00
# xbps-install -Sy distcc
2015-07-30 11:59:50 +02:00
Modify the configuration to allow your local network machines to use distcc (e.g. `192.168.2.0/24` ):
# echo "192.168.2.0/24" >> /etc/distcc/clients.allow
2014-11-22 17:19:25 +01:00
Enable and start the `distccd` service:
# ln -s /etc/sv/distccd /var/service
2015-07-30 11:59:50 +02:00
Install distcc on the host (machine that executes xbps-src) as well.
2023-10-02 09:10:51 +02:00
Unless you want to use the host as worker from other machines, there is no need
2015-07-30 11:59:50 +02:00
to modify the configuration.
On the host you can now enable distcc in the `void-packages/etc/conf` file:
2014-11-22 17:19:25 +01:00
XBPS_DISTCC=yes
2015-07-30 11:59:50 +02:00
XBPS_DISTCC_HOSTS="localhost/2 --localslots_cpp=24 192.168.2.101/9 192.168.2.102/2"
XBPS_MAKEJOBS=16
The example values assume a localhost CPU with 4 cores of which at most 2 are used for compiler jobs.
The number of slots for preprocessor jobs is set to 24 in order to have enough preprocessed data for other CPUs to compile.
2023-10-02 09:10:51 +02:00
The worker 192.168.2.101 has a CPU with 8 cores and the /9 for the number of jobs is a saturating choice.
The worker 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.
2015-07-30 11:59:50 +02:00
The XBPS_MAKEJOBS setting is increased to 16 to account for the possible parallelism (2 + 9 + 2 + some slack).
2014-11-22 17:19:25 +01:00
2020-03-22 05:13:31 +01:00
< a name = "distfiles-mirrors" > < / a >
2015-09-20 08:21:14 +02:00
### Distfiles mirror(s)
In etc/conf you may optionally define a mirror or a list of mirrors to search for distfiles.
$ echo 'XBPS_DISTFILES_MIRROR="ftp://192.168.100.5/gentoo/distfiles"' >> etc/conf
If more than one mirror is to be searched, you can either specify multiple URLs separated
with blanks, or add to the variable like this
2020-05-19 07:17:45 +02:00
$ echo 'XBPS_DISTFILES_MIRROR+=" https://sources.voidlinux.org/"' >> etc/conf
2015-09-20 08:21:14 +02:00
Make sure to put the blank after the first double quote in this case.
The mirrors are searched in order for the distfiles to build a package until the
checksum of the downloaded file matches the one specified in the template.
Ultimately, if no mirror carries the distfile, or in case all downloads failed the
checksum verification, the original download location is used.
2020-11-07 22:50:11 +01:00
If you use `uchroot` for your XBPS_CHROOT_CMD, you may also specify a local path
2015-09-20 08:21:14 +02:00
using the `file://` prefix or simply an absolute path on your build host (e.g. /mnt/distfiles).
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.
2020-03-22 05:13:31 +01:00
< a name = "cross-compiling" > < / a >
2014-11-22 17:47:24 +01:00
### Cross compiling packages for a target architecture
2014-11-22 17:19:25 +01:00
2015-05-02 05:57:40 +02:00
Currently `xbps-src` can cross build packages for some target architectures with a cross compiler.
The supported target is shown with `./xbps-src -h` .
2014-11-22 17:19:25 +01:00
If a source package has been adapted to be **cross buildable** `xbps-src` will automatically build the binary package(s) with a simple command:
$ ./xbps-src -a < target > pkg < pkgname >
2014-11-22 17:47:24 +01:00
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** .
2014-11-22 17:19:25 +01:00
2020-03-22 05:13:31 +01:00
< a name = "foreign" > < / a >
2015-06-28 11:01:36 +02:00
### Using xbps-src in a foreign Linux distribution
2014-11-22 17:19:25 +01:00
2015-06-28 11:01:36 +02:00
xbps-src can be used in any recent Linux distribution matching the CPU architecture.
2014-11-22 17:19:25 +01:00
2015-06-28 11:01:36 +02:00
To use xbps-src in your Linux distribution use the following instructions. Let's start downloading the xbps static binaries:
2014-11-22 17:19:25 +01:00
2022-05-24 04:08:02 +02:00
$ wget http://repo-default.voidlinux.org/static/xbps-static-latest.< arch > -musl.tar.xz
2014-11-22 17:19:25 +01:00
$ mkdir ~/XBPS
2021-01-23 16:20:41 +01:00
$ tar xvf xbps-static-latest.< arch > -musl.tar.xz -C ~/XBPS
2015-06-03 18:43:01 +02:00
$ export PATH=~/XBPS/usr/bin:$PATH
2015-04-14 08:14:07 +02:00
2021-08-10 20:46:25 +02:00
If `xbps-uunshare` does not work because of lack of `user_namespaces(7)` support,
try other [chroot methods ](#chroot-methods ).
2014-11-22 17:19:25 +01:00
Clone the `void-packages` git repository:
2021-11-04 00:42:48 +01:00
$ git clone https://github.com/void-linux/void-packages.git
2014-11-22 17:19:25 +01:00
and `xbps-src` should be fully functional; just start the `bootstrap` process, i.e:
$ ./xbps-src binary-bootstrap
The default masterdir is created in the current working directory, i.e `void-packages/masterdir` .
2020-03-22 05:13:31 +01:00
< a name = "remaking-masterdir" > < / a >
2014-11-22 17:19:25 +01:00
### 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):
$ ./xbps-src zap
$ ./xbps-src binary-bootstrap
2020-03-22 05:13:31 +01:00
< a name = "updating-masterdir" > < / a >
2014-11-22 17:19:25 +01:00
### 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
2020-03-22 05:13:31 +01:00
< a name = "building-32bit" > < / a >
2015-02-08 18:19:43 +01:00
### Building 32bit packages on x86_64
2014-11-22 17:19:25 +01:00
2015-02-08 18:16:27 +01:00
Two ways are available to build 32bit packages on x86\_64:
2014-11-22 17:19:25 +01:00
2021-10-26 20:18:14 +02:00
- native mode with a 32bit masterdir (recommended, used in official repository)
- cross compilation mode to i686 [target ](#cross-compiling )
2015-02-08 18:16:27 +01:00
2021-10-26 20:18:14 +02:00
The canonical mode (native) needs a new x86 `masterdir` :
2015-02-08 18:16:27 +01:00
$ ./xbps-src -m masterdir-x86 binary-bootstrap i686
2014-11-22 17:19:25 +01:00
$ ./xbps-src -m masterdir-x86 ...
2020-03-22 05:13:31 +01:00
< a name = "building-for-musl" > < / a >
2015-01-18 12:54:37 +01:00
### Building packages natively for the musl C library
2014-11-22 17:19:25 +01:00
2020-09-25 21:27:48 +02:00
Canonical way of building packages for same architecture but different C library is through dedicated masterdir.
To build for x86_64-musl on glibc x86_64 system, prepare a new masterdir with the musl packages:
2014-11-22 17:19:25 +01:00
$ ./xbps-src -m masterdir-x86_64-musl binary-bootstrap x86_64-musl
2020-09-25 21:27:48 +02:00
Your new masterdir is now ready to build packages natively for the musl C library:
2014-11-22 17:19:25 +01:00
2020-09-25 21:27:48 +02:00
$ ./xbps-src -m masterdir-x86_64-musl pkg ...
2014-11-22 17:19:25 +01:00
2020-03-22 05:13:31 +01:00
< a name = "building-base-system" > < / a >
2015-04-14 11:46:59 +02:00
### Building void base-system from scratch
To rebuild all packages in `base-system` for your native architecture:
$ ./xbps-src -N pkg base-system
It's also possible to cross compile everything from scratch:
$ ./xbps-src -a < target > -N pkg base-system
Once the build has finished, you can specify the path to the local repository to `void-mklive` , i.e:
# cd void-mklive
# make
# ./mklive.sh ... -r /path/to/hostdir/binpkgs