Skip to content

main/postmarketos-base: install mesa-dri-gallium only if needed

Minecrell requested to merge mesa-optional into master

At the moment almost all device packages force installation of the Mesa drivers, even when they are not used by any application (for example on a minimal headless installation with "none" or "console" UI). Omitting mesa-dri-gallium from such installations saves about ~150 MiB of disk space (469 MiB -> 317 MiB rootfs for minimal installation on arrow-db410c).

The "classic" drivers have been removed from Mesa so only one mesa-dri- package exists now: mesa-dri-gallium contains all Mesa drivers, llvmpipe, freedreno, lima, panfrost, Intel (iris/crocus), ... This means we can easily create an install_if package in postmarketos-base that installs that driver package only if needed (= only if another package requires the "mesa" package).

Strictly speaking the install_if could be restricted further since mesa-dri-gallium is only needed by "mesa-egl", "mesa-gbm" and "mesa-gl" but not e.g. the Vulkan drivers. Having three postmarketos-base subpackages (one install_if for each of them) seems a bit overengineered, though. "mesa" is a common dependency of all three of them, so using install_if="... mesa" should be good enough.

NOTE: This MR does not include the changes required in all the device packages (removing the mesa-dri-gallium depends there). Those changes should be generated with the following commands shortly before merge (to avoid conflicts and to ensure all new device packages are updated as well):

$ sed -Ei -e '/^\s*mesa-dri-gallium\s*$/d' -e 's/"mesa-dri-gallium /"/g' -e 's/ mesa-dri-gallium"/"/g' -e 's/ mesa-dri-gallium / /g' -e '/depends="mesa-dri-gallium"/d' device/*/*/APKBUILD
$ pmbootstrap pkgrel_bump $(git ls-files -m device | cut -d/ -f3)

Merge request reports