(IMPORTANT) It is currently not possible to use a system version of `spidermonkey` due to the upstream bug https://bugzilla.mozilla.org/show_bug.cgi?id=1644600 preventing linking (our bundled version is patched already). As such, this revision has been taken out of review queues.
As mentioned in #5868, there is a problem with some (most) linux distro-provided `mozjs-*`/`js*`package (or whatever `spidermonkey` (any version) is packaged as on that system), in that it contains a copy of `icu` headers that don't match the version of `icu` installed on the system. This mismatch causes a linking issue in our build process.
This revision contains a possible solution, by telling `gcc` (and `clang`, as it follows enough of the same code path within `premake`) to look through the `mozjs-*` includes directory //after// the system standard directories. This means that `gcc`/`clang` will look for `icu` in the system standard location (and find it) before searching the `mozjs-*` location.
The //downside// to this solution is that it requires patching `premake5`, and the `pkgconfig` module for it we use. (Although if we agree that the principle is sound, we can submit a PR to the `premake` [[ https://github.com/premake/premake-core | project ]].)