The purpose of this guide is to help AUR users compile complex packages using an AUR helper in a clean(ish) environment and help to keep primary user facing systems free of clutter.
It is wise to read the Arch Wiki on building in a clean chroot. If this method does not work, or immolates the computer, follow the instructions on the aforementioned wiki page to properly build the package in a clean chroot.
Firstly, install devtools on the primary machine.
you@primary $ sudo pacman -S devtools
Make the directory in which the new chroot will be created.
you@primary $ mkdir -p $HOME/aur/chroot/proton-ge-custom/
Define the CHROOT environment variable to minimize typing in subsequent steps.
you@primary $ CHROOT=$HOME/aur/chroot/proton-ge-custom
mkarchroot
will create the root
directory in the proton-ge-custom directory.
root@primary # mkarchroot $CHROOT/root base base-devel vi vim nano sudo wget
(Mis)use arch-nspawn to 'log in' to the chroot.
arch-nspawn $CHROOT/root su -
Set a root passwd.
root@chroot # passwd
Uncomment the multilib repo in pacman.conf and then update the system.
root@chroot # pacman -Syyu
Create a user to build aur packages in the wheel group
root@chroot # useradd -m -G wheel aur
Set the AUR user's password.
root@chroot # passwd aur
Use visudo
command to grant wheel users the ability to sudo. You can learn to use vi and vim here and it's quite fun.
root@chroot # visudo
Alternatively nano can be used as well.
root@chroot # EDITOR=nano visudo
Switch to the new aur
user.
root@chroot # su - aur
Create the build directory for the package.
aur@chroot $ mkdir build && cd build
Copy the snapshot link for yay from the aur and wget the link
aur@chroot $ wget https://aur.archlinux.org/cgit/aur.git/snapshot/yay.tar.gz
Extract the yay.tar.gz
archive and make the yay package.
aur@chroot $ tar xf yay.tar.gz && cd yay && makepkg -si
Edit /etc/makepkg.conf
and set the -j option something closer to your CPU thread count to expedite compile times.
Use yay to build proton-ge-custom.
aur@chroot $ yay -S proton-ge-custom
Once this process is completed, exit the terminal.
The package can then be copied from of the $CHROOT/root/home/aur/.cache/yay/proton-ge-custom/
directory and installed with pacman -U
on the primary system. An example would be like so.
root@primary # pacman -U $CHROOT/root/home/aur/.cache/yay/proton-ge-custom/proton-ge-custom-2:GE.Proton9.20-1-x86_64.pkg.tar.zst
All dependencies like lib32-lzo
can be installed from the same folder using the same pacman -U
command.