Ninja: Generate scripts for long custom command sequences

Ninja runs just one command line for every build statement, so the Ninja
generator needs to `&&`-chain multiple commands together into one long
string.  For long custom command sequences this can exceed the maximum
command-line length for the operating system.  In such cases, write the
commands out to a script instead, and then run the script from Ninja's
one command line.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #15612
7 files changed