OK… I really want to express my thanks for your response.
I have a script at the moment that builds a chroot installs yay in it, creates a user inside it and then runs yay as that user to install the packages in the chroot.
One of the packages takes ages to build, so I’m going to put this aside and go to bed, and check on it tomorrow.
I think I understand what you mean, something like this?:
ls /build/mypackage/PKGBUILD
cd /build
git clone https://aur.archlinux.org/gcc11
buildpkg -p gcc11
sudo chrootbuild -cp mypackage -i /var/cache/manjaro-tools/pkg/stable/x86_64/gcc.tar.zst
edit:
Adding a link to the new issue I opened: Issues with Building mod-openvino for Audacity on Manjaro - Need Help with chroot Setup