// TODO Merge util/build.c into here. str options #option; str target #option; void Start() { SystemShellEnableLogging(false); assert PathCreateLeadingDirectories("bin/dependency_files"); assert PathCreateLeadingDirectories("bin/Logs"); assert PathCreateLeadingDirectories("bin/generated_code"); assert PathCreateLeadingDirectories("bin/cache"); assert PathCreateLeadingDirectories("bin/Object Files"); if SystemGetHostName() == "Cygwin" { PrintStdErrWarning("Building on Cygwin is not supported. Use the Windows Subsystem for Linux instead.\n"); assert false; } if SystemShellEvaluate("shasum -a 256 util/test.txt") != "2c5622dbbf2552e0e66424a302bde0918e09379afce47eef1a21ef0198990fed util/test.txt\n" { PrintStdErrWarning("--------------------------------------------------------------------\n"); PrintStdErrWarning(" The source has been corrupted!! \n"); PrintStdErrWarning(" Please check that you have disabled any automatic line-ending or \n"); PrintStdErrWarning(" encoding conversions in Git and archive extraction tools you use. \n"); PrintStdErrWarning("--------------------------------------------------------------------\n"); assert false; } if StringContains(PathGetDefaultPrefix(), " ") { PrintStdErrWarning("Error: The path to your essence directory, '%PathGetDefaultPrefix()%', contains spaces.\n"); assert false; } if !SystemShellExecute("which gcc > /dev/null") { PrintStdErrWarning("Error: GCC was not found.\n"); assert false; } if !SystemShellExecute("which nasm > /dev/null") { PrintStdErrWarning("Error: Nasm was not found.\n"); assert false; } if !SystemShellExecute("which make > /dev/null") { PrintStdErrWarning("Error: Make was not found.\n"); assert false; } if target == "" { target = "TARGET_X86_64"; } assert SystemShellExecute("gcc -o bin/build -g util/build.c -pthread -DPARALLEL_BUILD -D%target% " + "-Wall -Wextra -Wno-missing-field-initializers"); SystemShellExecute("bin/build %options%"); PrintStdErrHighlight("\n"); }