-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathupdate.sh
executable file
·46 lines (41 loc) · 1.69 KB
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -euo pipefail
# TODO: ideally verify.sh runs this script with SPIRV_TOOLS_REV pinned,
# while update.sh updates this hash.
SPIRV_TOOLS_REV="1a0658f55aab97e1803ca46896596a04c395d50d"
echo '----------------------------------------------------------------------------------------------------'
echo 'update.sh: note: merging upstream is not an automatic process, you must update SPIRV_TOOLS_REV in this'
echo 'script to the latest upstream revision from https://github.com/KhronosGroup/SPIRV-Tools'
echo '----------------------------------------------------------------------------------------------------'
git remote add upstream https://github.com/KhronosGroup/SPIRV-Tools || true
git fetch upstream
git merge $SPIRV_TOOLS_REV --strategy ours
# `git clone --depth 1` but at a specific revision
git_clone_rev() {
repo=$1
rev=$2
dir=$3
rm -rf "$dir"
mkdir "$dir"
pushd "$dir"
git init -q
git fetch "$repo" "$rev" --depth 1
git checkout -q FETCH_HEAD
popd
}
git_clone_rev https://github.com/KhronosGroup/SPIRV-Tools $SPIRV_TOOLS_REV upstream
pushd upstream
python3 utils/git-sync-deps
mkdir -p build && pushd build
cmake ..
# enough to make sure headers are generated
make & sleep 20; kill $!
popd
echo '----------------------------------------------------------------------------------------------------'
echo 'update.sh: note: terminating the build early just to collect headers, do not worry about the failure'
echo '----------------------------------------------------------------------------------------------------'
rm -rf include-generated
mkdir -p include-generated
find build -name "*.inc" -exec cp -r '{}' ../include-generated/ \;
popd
rm -rf upstream