meson/megadriver: support various lib suffixes
While I'm touching meson.build
I also included a bunch of unrelated trivial changes, but the last commit is the only one that produces a behaviour change.
Related to !32328 (closed)
/cc @jturney to make sure I'm not accidentally breaking your fix 5d310015