Deduplicate some build configuration code (dotnet/coreclr#27636)
* Deduplicate some build configuration code
While working on another PR, noticed that currently it requires
updating two places to add a new platform/compiler/architecture
configuration. This PR tries to consolidate the code.
Changes:
* replace `read_array` custom function with a simple `grep -v` call.
* remove `$__PortableLinux` from build-test.sh, as it is unused.
* move argument parsing and few common functions in `build.sh` and
`build-test.sh` in `_build-commons.sh` and sourced it.
* combine the long case-esac block and sort cases alphabetically.
* add missing `hyphen-less|hyphened)` variants.
* sort `CPUName` and `OSName` list.
* changed `__CommonMSBuildArgs` from array to string in
`build-test.sh`, as it is in `build.sh`.
* sort local argument names in build/build-test alphabetically at
declaration site.
* merge `locate_llvm_exec` and `locate_gcc_exec` into a single
`locate_toolchain_exec` cmake function.
* this enables overriding individual llvm tool via `CLR_<TOOLNAME>`
environment variable, as it was supported by `locate_gcc_exec`
today.
* Merge dotnet/master to fix/deduplicate-configs
* Merge conflict
* Move __CrossBuild check back to build.sh
Commit migrated from https://github.com/dotnet/coreclr/commit/
a15413fd520f7f25273b92d1087b5f7964801dba