#import "util/get_source.script" get_source; str targetName #option; str toolchainPrefix #option; int processorCount #option; void Start() { str rootDirectory = PathGetDefaultPrefix() + "/root"; if processorCount == 0 processorCount = SystemGetProcessorCount(); get_source.Get("https://archive.mesa3d.org/mesa-20.1.8.tar.xz", "mesa-20.1.8", "df21351494f7caaec5a3ccc16f14f15512e98d2ecde178bba1d134edc899b961"); assert FileWriteAll("bin/meson_cross.txt", "[binaries]\nc = '%toolchainPrefix%-gcc'\ncpp = '%toolchainPrefix%-g++'\nar = '%toolchainPrefix%-ar'\nstrip = '%toolchainPrefix%-strip'\n" + "[properties]\nsys_root = '%rootDirectory%'\nc_args = ['-D_POSIX_SOURCE']\ncpp_args = ['-D_POSIX_SOURCE']\n" + "[host_machine]\nsystem = 'essence'\ncpu_family = '%targetName%'\ncpu = 'generic'\nendian = 'little'\n"); assert FileCopy("ports/mesa/changes/include_c11_threads_posix.h", "bin/source/include/c11/threads_posix.h"); assert FileCopy("ports/mesa/changes/src_util_detect_os.h", "bin/source/src/util/detect_os.h"); assert FileCopy("ports/mesa/changes/src_util_u_thread.h", "bin/source/src/util/u_thread.h"); assert FileCopy("ports/mesa/changes/src_util_anon_file.c", "bin/source/src/util/anon_file.c"); assert FileCopy("ports/mesa/changes/src_util_os_misc.c", "bin/source/src/util/os_misc.c"); assert FileCopy("ports/mesa/changes/meson.build", "bin/source/meson.build"); assert FileCopy("ports/mesa/changes/src_gallium_targets_osmesa_meson.build", "bin/source/src/gallium/targets/osmesa/meson.build"); assert SystemShellExecuteWithWorkingDirectory("bin/source", "meson ../build-mesa --cross-file ../meson_cross.txt " + "-Dosmesa=gallium -Ddefault_library=static -Dllvm=false"); assert SystemShellExecuteWithWorkingDirectory("bin/source", "ninja -C ../build-mesa -j %processorCount%"); assert FileCopy("bin/build-mesa/subprojects/expat-2.2.5/libexpat.a", "root/Applications/POSIX/lib/libexpat.a"); assert FileCopy("bin/build-mesa/subprojects/zlib-1.2.11/libz.a", "root/Applications/POSIX/lib/libz.a"); assert FileCopy("bin/build-mesa/src/gallium/targets/osmesa/libOSMesa.a", "root/Applications/POSIX/lib/libOSMesa.a"); assert SystemShellExecute("cp -r bin/source/include/GL root/Applications/POSIX/include"); assert SystemShellExecute("cp -r bin/source/include/KHR root/Applications/POSIX/include"); assert FileCopy("bin/source/docs/license.html", "bin/Mesa License.html"); PathDeleteRecursively("bin/source"); PathDeleteRecursively("bin/build-mesa"); }