Files
ppsspp/.github/checkout-submodules.sh
T
Henrik RydgårdandClaude Opus 5.5 4bdfb8604c CI: Only check out the FFmpeg libraries each build uses
FFmpeg has prebuilt libraries for every platform, 1.5 GB, and every job checked
all of it out, taking 2-3 minutes. checkout-submodules.sh fetches the other
submodules as before, and FFmpeg as a partial clone with a sparse checkout of
the given folders, plus the source headers since some builds have the ffmpeg
folder on the include path. A Linux x86-64 build gets 67 MB. Alpine, which
builds FFmpeg itself, gets the sources and none of the libraries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:47:22 +02:00

28 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Checks out the submodules like actions/checkout's "submodules: recursive" does, except that of
# FFmpeg, which holds prebuilt libraries for every platform (1.5 GB), only the given paths are
# fetched. They're sparse checkout patterns relative to ffmpeg/, like /linux/x86_64/. The source
# tree's headers always come along, since some builds have the ffmpeg folder on the include path.
#
# Run from the repository root, after a checkout without submodules:
# .github/checkout-submodules.sh /linux/x86_64/
set -e
# On Windows, keep Git Bash from turning the patterns into Windows paths on the way to git.exe.
export MSYS_NO_PATHCONV=1
export MSYS2_ARG_CONV_EXCL='*'
others=$(git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | awk '$2 != "ffmpeg" {print $2}')
git submodule update --init --recursive --depth 1 --jobs 8 -- $others
# A partial clone, so only the blobs the sparse checkout needs get downloaded.
sha=$(git rev-parse HEAD:ffmpeg)
url=$(git config -f .gitmodules submodule.ffmpeg.url)
git -C ffmpeg init -q
git -C ffmpeg remote add origin "$url"
git -C ffmpeg sparse-checkout set --no-cone '/*.h' '/lib*/**/*.h' "$@"
git -C ffmpeg fetch -q --depth 1 --filter=blob:none origin "$sha"
git -C ffmpeg checkout -q FETCH_HEAD
du -sh ffmpeg