Patch scripts and add CMake build script.