proposal: remove runtime dependency on LLVM for gallium drivers that don't actually use LLVM
I'm working on osk-sdl (keyboard for initramfs, used in postmarketOS), and we use mesa to provide hw accel for rendering. Mesa hardlinks all gallium drivers to save space, but unfortunately this means all gallium drivers "need" LLVM, even when they don't really use it (e.g. Iris, Lima, and most drivers..). In the initramfs, libLLVM-11.so is ~80MB (on aarch64).
Based on my understanding of how mesa dri works, all of core mesa is linked into the *_dri.so, so it should be possible to remove the LLVM runtime dependency for drivers that don't use LLVM by doing something like this in the mesa APKBUILD:
- in the
build
step in abuild: - build mesa with
-Dllvm=disabled
- save off *_dri.so that do not actually use LLVM (iris, lima, etnaviv, and so on)
- build mesa again with
-Dllvm=enabled
- copy in *_dri.so from step 2
- move to
packaging
step in abuild
Since mesa will still hardlink things, this should only result in a ~15MB increase in install size for mesa-dri-gallium, and it would allow me to copy *_dri.so to initramfs without having to include the large (and unneeded) libLLVM.so.
@ncopa you're the maintainer for the mesa package, so obviously I'm interested in whether this would be accepted before I do the work for it