You removed a bunch of newlines here and nearby - I assume that wasn't intentional?
Yes, that was my mistake. Thanks for pointing it out. Fixed.
There's no need to use dash anymore, the amount of shell script run is minimal.
Switched back to bash.
I think the "cd"s here are superfluous given the ninja -C %BUILD_DIR% etc.
You're right. Those were needed when it was building with autoconf. Not anymore. Removed.
Only remembered that just after sending my email: When using b_pch=true (which saves a lot of time on mingw) ccache won't cache much (IIRC just the pch files themselves) unless you do something like export CCACHE_SLOPPINESS=pch_defines,time_macros
Added CCACHE_SLOPPINESS and CCACHE_SLOPPINESS variables.