This article will cover building in clean chroots or jails with pac-build.
Packages built in clean chroots will prevent unwanted dependencies which may be automatically included in the build if the build system detects an installed package on your system. It also allows to build against packages in certain repositories. So packages build in a chroot that only consist of the core packages, can be pushed to the stable repositories, while a chroot that has testing enable would build and link against those packages.
# nano /etc/pacman.conf
[devel] Include /etc/pacman.d/mirrorlist
You can proceed to sync and install pac-build
# pacman -Syu pac-build
Depending on which filesystem is being used. Setup can be a little different. pac-build can be configured to use zfs snapshots for the base, while ufs will create a clean base each time a package is built.
Profiles can be used to create multiple zfs subvolumes to easilly switch between building for different arches and repositories. To make things easy, it's recommended to use
to keep track of profiles. For example, if we wanted to create a profile to build for i686, the following could be done. i686 Can be replaced with any profile name.
Firstly we create
# cp /etc/pacman.conf /etc/pacman.conf.i686
The naming should reflect what that profile is for such as
If running on x86_64,
/etc/pacman.conf.i686 should have the Architecture set to i686 instead of auto.
[...] Architecture = i686 [...]
After the file has been configured,
/etc/pac-build.conf should be configured to use these files.
[...] # pacman.conf by build profile: pacman_conf_i686=/etc/pacman.conf.i686 [...]
The naming convention in the file for specifying should be
[...] pacman_conf_<profile>=/etc/pacman.conf.<profile> [...]
To use the profile the
-a option should be used.
# pac-build -a <profile> update
Or alternatively you can set the profile to use by default
[...] # default_profile: The default build profile default_profile=i686 [...]
Configuring zfs Usage
pac-build will need to be configured to use zfs by default. This can be set in
/etc/pac-build.conf by toggling the zfs to 1.
# nano /etc/pac-build.conf
# ZFS settings # to enable ZFS by default, set this to 1 opt_zfs=1
This will cause pac-build to default to zfs usage each run. Although the default subvolume might need to be changed to reflect your zfs setup. Different profiles can be used and named accordingly
# nano /etc/pac-build.conf
# subvol_$build_profile: # The name of the subvolume to maintain with pac-build # When set to INVALID ZFS support will be disabled. # 'pac-init' will initialize the pool with mountpoint=legacy # Example: zpool/build_base subvol_x86_64=tank/build_base_64 #subvol_i686=zpool/build_base_32
Before any building can be started. The base must first be created after configuration. Once configuration is complete you can use pac-build to create the subvolumes
# pac-build init
Also remember to specify the profile if not using it by default.
# pac-build -a i686 init
Updating ZFS base
To keep the base updated the follow command must be ran for pac-build to sync and update the zfs volume.
# pac-build update
If you're using an alternative profile, where i686 is the profile name.
# pac-build -a i686 update
Removing ZFS base
In the event you need to delete the ZFS base for any reason.
# pac-build remove
Removing a specified profile.
# pac-build -a i686 remove
Configuring ABS location
pac-build needs to know the location of the ABS tree before it can build the packages.
# abstree: Path to the ABS git clone abstree=/var/abs
Building a Package
# makepkg -S
After the creation of the source tarball, you can have pac-build build this package in a clean chroot by providing the repo it's in and the package name.
# pac-build <repo> <package>
# pac-build core openrc
If you don't have a default profile, you can specify the profile to use for the build.
# pac-build -a i686 core openrc
Cleaning ZFS pools
# pac-build -k <repo> <package>
# pac-build -a i686 -k <repo> <package>
You can get a complete list of all create subvolumes with.
# zfs list
Entering the ZFS base
Occasionally you will need to enter the ZFS base to merge and tidy op dot pac.new files.
with a default profile:
# pac-build enter
With an alternative profile:
# pac-build -a i686 enter