This replaces a bunch of duplicate logic to set up environment variables
and a few substitutions.
It does a little more than we were doing previously:
- searching for clang and setting up substitutions for it
- setting up some substitutions for target triples, which are potentially useful but not actually used
clangd has been happily using this for its tests for a while.