Fix cmake script, step 1: Turn cmake.sh into actual cmake

The build/cmake.sh file in the upstream source is probably an artifact from old autoconf days and does not really reflect common practice of using Cmake. This should be fixed, including proper dependency checking (missing miniupnpc and liblua5.2 are currently only reported during compilation, not configuration), and post-install scripts.