Circular dependecy with MESA breaks unattended build

Description:

This package has a circular dependency with mesa as seen below:

$ paru --sync libglvnd
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: mesa will be installed before its libglvnd dependency

That's problematic since libglvnd is slated as a dependency for building MESA, this leads to extra/mesa being installed when building mesa-git.

Because of this unattended install script fails to build MESA in a clean chroot environment due to conflicts (as --noconfirm selects the default action being N). See this truncated example:

$ paru --query --info mesa
error: package 'mesa' was not found

$ paru --query --info mesa-git
error: package 'mesa-git' was not found

$ paru --noconfirm --sync aur/mesa-git
:: Inner conflicts found:
    mesa: mesa-git (mesa)  mesa-git (mesa-libgl)  
    mesa-git: mesa (mesa-libgl)  

:: Conflicting packages will have to be confirmed manually
error: can not install conflicting packages with --noconfirm

This problem isn't isolated to unattended scripts. Ultimately any clean environment gets forced to install extra/mesa when building MESA:

$ paru --sync aur/mesa-git
:: Inner conflicts found:
    mesa: mesa-git (mesa)  mesa-git (mesa-libgl)  
    mesa-git: mesa (mesa-libgl)  

:: Conflicting packages will have to be confirmed manually

Repo (41)                       Old Version  New Version                                Make Only
(...)
extra/mesa                                   1:23.3.5-1                                 No
(...)

:: mesa-git and mesa are in conflict. Remove mesa? [y/N] 

The above dependency circle can also be confirmed by inspecting what caused mesa to be installed:

$ paru --query --info mesa | grep 'Required'
Required By     : libglvnd

For clarification, this issue isn't isolated to AUR (I mentioned it as it's the easiest to reproduce), see build dependencies for any MESA package: extra/mesa, aur/mesa-git, aur/mesa-amdonly-gaming-git, Frogging-Family/mesa-git:

depends=('libdrm' 'libxxf86vm' 'libxdamage' 'libxshmfence' 'libelf' 'libomxil-bellagio' 'libunwind' 'libglvnd' 'wayland' 'lm_sensors' 'vulkan-icd-loader' 'zstd' 'expat' 'gcc-libs' 'libxfixes' 'libx11' 'systemd-libs' 'libxext' 'libxcb' 'glibc' 'zlib' )

Additional info:

  • package version(s): 1.7.0-1
  • config and/or log files: N/A
  • link to upstream bug report, if any: N/A

Workaround

$ paru --sync libglvnd
$ paru --remove --nodeps --nodeps mesa
$ paru --noconfirm --sync aur/mesa-git

Resolution

Could we mark mesa as a optional dependency for libglvnd to allow build systems to cleanly create MESA from source without failing due to dependency cycles?

Edited by Grabben D