Files
VIctory-xmem/tools/patch.sh

20 lines
880 B
Bash
Executable File

#!/bin/bash
set -eu
source "$(dirname "$(readlink -f "$0")")/../env.sh"
name=${1:-}
dir=$root/deps/$name
patch=$root/patches/$name.patch
if [ -z "$name" ] || [ ! -f "$patch" ]; then echo "usage: patch.sh mesa|vkd3d|wine"; exit 1; fi
git -C "$dir" add -u
git -C "$dir" diff --ignore-submodules=dirty HEAD > "$patch"
rm -f "$root/patches/$name".*.patch
git -C "$dir" submodule -q foreach --recursive \
'git add -u; git diff --quiet --ignore-submodules=dirty HEAD || git diff --ignore-submodules=dirty HEAD > "'"$root/patches/$name"'.${displaypath##*/}.patch"'
if [ ! -f "$dir/.git/um-stamp" ]; then
echo "no stamp for deps/$name: run ./setup.sh $name first" >&2
exit 1
fi
patched "$dir" > "$dir/.git/um-patch"
stamp=$(cat "$dir/.git/um-stamp")
echo "${stamp%% *} $(cat "$root/patches/$name".patch "$root/patches/$name".*.patch 2>/dev/null | sha256sum)" > "$dir/.git/um-stamp"