Building 32-bit packages on a 64-bit system
Build 32-bit packages in a 64-bit environment
This example uses mkarchroot to create the chroot environment. First, create /opt/arch32 or another directory of your choice. The next steps is to copy your existing pacman.conf and makepkg.conf file to /opt/arch32 or your chosen directory. In the following tutorial, substitute /opt/arch32 with your chosen directory if you decide to use a different directory.
Edit your /opt/arch32/pacman.conf
Change Architecture = auto to Architecture = i686
You will also need to comment out any multi-lib repos.
Change CARCH="x86_64" to CARCH="i686" CHOST="x86_64-unknown-linux-gnu" to CHOST="i686-unknown-linux-gnu". CFLAGS="-march=x86_64 -mtune=generic -O2 -pipe" to CFLAGS="-march=i686 -mtune=generic -O2 -pipe" . CXXFLAGS="-march=x86_64 -mtune=generic -O2 -pipe" to CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe" .
After the changes have been made, you will need to create another directory, I created /aur as mine.
sudo mkarchroot -C /opt/arch32/pacman.conf -M /opt/arch32/makepkg.conf <chrootdir>/root base base-devel sudo
If you create the /aur directory like mine you would run
sudo mkarchroot -C /opt/arch32/pacman.conf -M /opt/arch32/makepkg.conf /aur/root base base-devel sudo
You will need to edit /aur/copy/etc/pacman.d/mirrorlist and select which mirrors to use.
Now you can use makechrootpkg to build i686 packages like this:
# makechrootpkg -r /aur/