diff options
author | kcgen <kcgen@users.noreply.github.com> | 2021-12-27 18:03:50 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2021-12-27 19:36:40 +0300 |
commit | 506d1b4f914f3e5ebf2d1c1fc7534ed7d794876c (patch) | |
tree | 76a1c6fe11bce942e88aeb5d853ca470d2182867 /scripts | |
parent | 65c7d697897dff6ec76a08cc72c8b71eda26f520 (diff) |
Add a script to fetch the libffi subproject via GIT/SSH API
This lets us work around the frequent https-based cloning outages
for the libffi subproject.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/fetch-libffi-subproject.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/fetch-libffi-subproject.sh b/scripts/fetch-libffi-subproject.sh new file mode 100755 index 000000000..0b4f58521 --- /dev/null +++ b/scripts/fetch-libffi-subproject.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2021-2021 kcgen <kcgen@users.noreply.github.com> + +# This script exists only to easily fetch the libffi subproject +# because the repository's HTTPS interface used by the glib wrap +# is frequently down. +# +# Ref: https://gitlab.freedesktop.org/gstreamer/meson-ports/libffi/-/issues/8 +# +set -euo pipefail + +repo_root="$(git rev-parse --show-toplevel)" + +subproject_branch="meson" +subproject_dir="$repo_root/subprojects/libffi" +subproject_repo="git@gitlab.freedesktop.org:gstreamer/meson-ports/libffi.git" +fallback_tarball="https://github.com/dosbox-staging/dosbox-staging/files/7780837/libffi.tar.xz.zip" + +if [[ ! -d "$subproject_dir" ]]; then + GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no -o LogLevel=ERROR" \ + git clone --depth 1 --branch "$subproject_branch" "$subproject_repo" "$subproject_dir" || \ + curl -L "$fallback_tarball" | xz -dc | tar -x -C "$repo_root/subprojects/" +else + echo "subproject_dir already exists, skipping clone" +fi |