Make a shared NIR library to reduce size on disk
Motivation: On-disk size is important for Chrome OS where we ship a system that fits in 2GB, and for installers such as Debian that want to fit on small USB sticks. A release build of Mesa for me right now has ~13MB of libnir.a, and most of that gets copied into each of
iris_dri.so (a Chrome OS example). On my general-purpose x86 desktop supporting GL, and Vulkan for Intel, Lavapipe, and Radeon, and maybe also clover's separate driver builds, the space cost is even higher.
Mesa has historically avoided using shared libraries for reducing on-disk size because we've supported a Mesa libGL loading drivers from different Mesa versions, and having Mesa use shared libraries would make it harder to mix-and-match your drivers from different builds. We also wanted to make it clear that our SO interfaces were not ABI.
However, the plan going forward for mix-and-match of GL that might get actually shipped is to have libglvnd in front of two whole copies of different versions of Mesa (!10557 (merged)), which is much more maintainable anyway. And, even if we did want to mix-and-match builds with the same version of Mesa without libglvnd, we could just have the shared libs in an a configurable subdir in the libdir so you could have two copies of Mesa in parallel (with just one of them presumably being the libGL). We can make the "not ABI" thing clear by not including a major verson on our lib in our per-build subdir.
As a side effect, this should also be a boon to developers by reducing their link time every rebuild.
Another possible effect is being able to LTO subsets of Mesa even if the whole thing doesn't work with LTO, which may prove to be a big win for things like small helper functions in NIR.
@ajax as someone likely interested and with relevant input on this.