Just got home from work - trying out your code. I ran into a problem with meson. I think I had to specify a directory. Basically I just made a build directory in mesa. Otherwise I get “ERROR: Must specify at least one directory name.”
There’s probably a more elegant way to do it, but this is what I did for now. It’s installing as I type.
git clone https://gitlab.freedesktop.org/mesa/mesa.git
cd mesa
mkdir build
meson --prefix=/usr/ -Dbuildtype=release -Ddri-drivers= -Dgallium-drivers=kmsro,lima,swrast -Dosmesa=none -Dplatforms=x11,drm,surfaceless
sudo ninja -C build/ install