Add patches needed to compile clang (on MAC).
Restructuring and cleaning of the script.