From 77b6097881df05cbc8686241134b667e9353ab80 Mon Sep 17 00:00:00 2001 From: nakst <> Date: Mon, 31 Jan 2022 11:14:55 +0000 Subject: [PATCH] replace mesa sh with script --- ports/mesa/port.script | 40 +++++++++++++++++++++++++++++++++++++++ ports/mesa/port.sh | 43 ------------------------------------------ 2 files changed, 40 insertions(+), 43 deletions(-) create mode 100644 ports/mesa/port.script delete mode 100755 ports/mesa/port.sh diff --git a/ports/mesa/port.script b/ports/mesa/port.script new file mode 100644 index 0000000..cb3611b --- /dev/null +++ b/ports/mesa/port.script @@ -0,0 +1,40 @@ +#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"); +} diff --git a/ports/mesa/port.sh b/ports/mesa/port.sh deleted file mode 100755 index b3f3136..0000000 --- a/ports/mesa/port.sh +++ /dev/null @@ -1,43 +0,0 @@ -set -ex - -rm -rf bin/mesa -bin/script util/get_source.script checksum=df21351494f7caaec5a3ccc16f14f15512e98d2ecde178bba1d134edc899b961 directoryName=mesa-20.1.8 url=https://archive.mesa3d.org//mesa-20.1.8.tar.xz -mv bin/source bin/mesa - -echo "" > bin/meson_cross.txt -echo "[binaries]" >> bin/meson_cross.txt -echo "c = 'x86_64-essence-gcc'" >> bin/meson_cross.txt -echo "cpp = 'x86_64-essence-g++'" >> bin/meson_cross.txt -echo "ar = 'x86_64-essence-ar'" >> bin/meson_cross.txt -echo "strip = 'x86_64-essence-strip'" >> bin/meson_cross.txt -echo "[properties]" >> bin/meson_cross.txt -echo sys_root = \'$(realpath root)\' >> bin/meson_cross.txt -echo "c_args = ['-D_POSIX_SOURCE']" >> bin/meson_cross.txt -echo "cpp_args = ['-D_POSIX_SOURCE']" >> bin/meson_cross.txt -echo "[host_machine]" >> bin/meson_cross.txt -echo "system = 'essence'" >> bin/meson_cross.txt -echo "cpu_family = 'x86_64'" >> bin/meson_cross.txt -echo "cpu = 'generic'" >> bin/meson_cross.txt -echo "endian = 'little'" >> bin/meson_cross.txt - -cp ports/mesa/changes/include_c11_threads_posix.h bin/mesa/include/c11/threads_posix.h -cp ports/mesa/changes/src_util_detect_os.h bin/mesa/src/util/detect_os.h -cp ports/mesa/changes/src_util_u_thread.h bin/mesa/src/util/u_thread.h -cp ports/mesa/changes/src_util_anon_file.c bin/mesa/src/util/anon_file.c -cp ports/mesa/changes/src_util_os_misc.c bin/mesa/src/util/os_misc.c -cp ports/mesa/changes/meson.build bin/mesa/meson.build -cp ports/mesa/changes/src_gallium_targets_osmesa_meson.build bin/mesa/src/gallium/targets/osmesa/meson.build - -cd bin/mesa -meson ../build-mesa --cross-file ../meson_cross.txt -Dosmesa=gallium -Ddefault_library=static -Dllvm=false -ninja -C ../build-mesa -cd ../.. - -cp bin/build-mesa/subprojects/expat-2.2.5/libexpat.a root/Applications/POSIX/lib -cp bin/build-mesa/subprojects/zlib-1.2.11/libz.a root/Applications/POSIX/lib -cp bin/build-mesa/src/gallium/targets/osmesa/libOSMesa.a root/Applications/POSIX/lib -cp -r bin/mesa/include/GL root/Applications/POSIX/include -cp -r bin/mesa/include/KHR root/Applications/POSIX/include - -cp bin/mesa/docs/license.html bin/Mesa\ License.html -rm -r bin/mesa bin/build-mesa