Update all build scripts to be less hacky, and drop support for EOL 4.7