Moved some global variables into a local scope in the build script.