17ec681f3Smrg#!/bin/bash
27ec681f3Smrg
37ec681f3Smrgset -ex
47ec681f3Smrg
57ec681f3SmrgVKD3D_PROTON_VERSION="2.3.1"
67ec681f3SmrgVKD3D_PROTON_COMMIT="3ed3526332f53d7d35cf1b685fa8096b01f26ff0"
77ec681f3Smrg
87ec681f3SmrgVKD3D_PROTON_DST_DIR="/vkd3d-proton-tests"
97ec681f3SmrgVKD3D_PROTON_SRC_DIR="/vkd3d-proton-src"
107ec681f3SmrgVKD3D_PROTON_BUILD_DIR="/vkd3d-proton-$VKD3D_PROTON_VERSION"
117ec681f3Smrg
127ec681f3Smrgfunction build_arch {
137ec681f3Smrg  local arch="$1"
147ec681f3Smrg  shift
157ec681f3Smrg
167ec681f3Smrg  meson "$@"                               \
177ec681f3Smrg        -Denable_tests=true                \
187ec681f3Smrg        --buildtype release                \
197ec681f3Smrg        --prefix "$VKD3D_PROTON_BUILD_DIR" \
207ec681f3Smrg        --strip                            \
217ec681f3Smrg        --bindir "x${arch}"                \
227ec681f3Smrg        --libdir "x${arch}"                \
237ec681f3Smrg        "$VKD3D_PROTON_BUILD_DIR/build.${arch}"
247ec681f3Smrg
257ec681f3Smrg  ninja -C "$VKD3D_PROTON_BUILD_DIR/build.${arch}" install
267ec681f3Smrg
277ec681f3Smrg  install -D -m755 -t "${VKD3D_PROTON_DST_DIR}/x${arch}/bin" "$VKD3D_PROTON_BUILD_DIR/build.${arch}/tests/"*.exe
287ec681f3Smrg}
297ec681f3Smrg
307ec681f3Smrggit clone https://github.com/HansKristian-Work/vkd3d-proton.git --single-branch -b "v$VKD3D_PROTON_VERSION" --no-checkout "$VKD3D_PROTON_SRC_DIR"
317ec681f3Smrgpushd "$VKD3D_PROTON_SRC_DIR"
327ec681f3Smrggit checkout "$VKD3D_PROTON_COMMIT"
337ec681f3Smrggit submodule update --init --recursive
347ec681f3Smrggit submodule update --recursive
357ec681f3Smrgbuild_arch 64 --cross-file build-win64.txt
367ec681f3Smrgbuild_arch 86 --cross-file build-win32.txt
377ec681f3Smrgcp "setup_vkd3d_proton.sh" "$VKD3D_PROTON_BUILD_DIR/setup_vkd3d_proton.sh"
387ec681f3Smrgchmod +x "$VKD3D_PROTON_BUILD_DIR/setup_vkd3d_proton.sh"
397ec681f3Smrgpopd
407ec681f3Smrg
417ec681f3Smrg"$VKD3D_PROTON_BUILD_DIR"/setup_vkd3d_proton.sh install
427ec681f3Smrgrm -rf "$VKD3D_PROTON_BUILD_DIR"
437ec681f3Smrgrm -rf "$VKD3D_PROTON_SRC_DIR"
44