diff options
Diffstat (limited to 'external')
| -rwxr-xr-x | external/build-llvm.sh | 38 | ||||
| -rwxr-xr-x | external/bump-glslang.sh | 30 |
2 files changed, 44 insertions, 24 deletions
diff --git a/external/build-llvm.sh b/external/build-llvm.sh index 95302a742..0575bf4bf 100755 --- a/external/build-llvm.sh +++ b/external/build-llvm.sh @@ -20,7 +20,7 @@ EOF # # Some helper functions # -msg(){ +msg() { printf "%s\n" "$1" >&2 } @@ -62,13 +62,35 @@ extra_arguments=() while [[ "$#" -gt 0 ]]; do case $1 in - -h | --help) help; exit ;; - --repo) repo=$2; shift;; - --branch) branch=$2; shift;; - --source-dir) source_dir=$2; shift;; - --config) config=$2; shift;; - --install-prefix) install_prefix=$2; shift;; - --) shift; extra_arguments+=("$@"); break;; + -h | --help) + help + exit + ;; + --repo) + repo=$2 + shift + ;; + --branch) + branch=$2 + shift + ;; + --source-dir) + source_dir=$2 + shift + ;; + --config) + config=$2 + shift + ;; + --install-prefix) + install_prefix=$2 + shift + ;; + --) + shift + extra_arguments+=("$@") + break + ;; *) msg "Unknown parameter passed: $1" help >&2 diff --git a/external/bump-glslang.sh b/external/bump-glslang.sh index b7d30e3a0..d3923cf0e 100755 --- a/external/bump-glslang.sh +++ b/external/bump-glslang.sh @@ -35,7 +35,7 @@ while [[ "$#" -gt 0 ]]; do shift done -if [ $help ]; then +if [ "$help" ]; then me=$(basename "$0") cat <<EOF $me: Update external/glslang and dependencies @@ -62,27 +62,24 @@ EOF exit fi -big_msg() -{ +big_msg() { echo echo "################################################################" echo "$1" echo "################################################################" } -require_bin() -{ - if ! command -v "$1" &> /dev/null - then - echo "This script needs $1, but it isn't in \$PATH" - missing_bin=1 +require_bin() { + if ! command -v "$1" &>/dev/null; then + echo "This script needs $1, but it isn't in \$PATH" + missing_bin=1 fi } require_bin "jq" require_bin "git" require_bin "python" require_bin "cmake" -if [ $missing_bin ]; then +if [ "$missing_bin" ]; then exit 1 fi @@ -100,13 +97,13 @@ if ! test -f "$glslang/.git"; then exit 1 fi -known_good_commit(){ +known_good_commit() { jq <"$glslang/known_good.json" \ ".commits | .[] | select(.name == \"$1\") | .commit" \ --raw-output } -bump_dep(){ +bump_dep() { commit=$(known_good_commit "$2") big_msg "Fetching $commit from origin in $1" git -C "$1" fetch origin "$commit" @@ -116,7 +113,7 @@ bump_dep(){ declare -A old_ref declare -A new_ref -merge_dep(){ +merge_dep() { name=$1 dir=$2 up=$3 @@ -180,14 +177,15 @@ rm -f "$spirv_tools_generated/*.{inc,h}" cp --target-directory "$spirv_tools_generated" "$build"/*.{inc,h} set +x -if [ $do_commit ]; then +if [ "$do_commit" ]; then big_msg "Committing changes" - msg=$(cat <<EOF + msg=$( + cat <<EOF external/glslang: ${old_ref["glslang"]} -> ${new_ref["glslang"]} external/spirv-tools: ${old_ref["spirv-tools"]} -> ${new_ref["spirv-tools"]}" EOF -) + ) git commit \ --message "$msg" \ |
