Extract most functionality to a function.
Move run_cmake to common.py
Convert bootstrap script to use cmake