Files
ElyOffice/scripts/build-git.sh
T
ZacharyZhang-NYandClaude Opus 5.5 68b5af76e0 Windows and Linux build environments; check clean on both (E-01)
MuPDF builds with MSBuild on Windows (/MT, OpenSSL from vcpkg);
Git for Windows' MinGit stands in for the source build there. CEF
loads from where libcef lives and sets its API version first on
every platform. File identity on Windows compares volume and index.
The checkout and reference/ keep LF on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 03:53:56 -04:00

44 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the pinned Git, relocatable, into engines/git.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
src=$root/engines/git-src
out=$root/engines/git
jobs=$(sysctl -n hw.ncpu 2>/dev/null || nproc)
# Windows: Git for Windows' MinGit at the same version, checked.
case $(uname -s) in
MINGW* | MSYS*)
asset=MinGit-2.56.0-64-bit.zip
sum=064b440ff870ed5198527e8f3a92cdf5bd2fd0fedf5e718af95e3fdaddeff718
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
curl -fsSL -o "$work/$asset" "https://github.com/git-for-windows/git/releases/download/v2.56.0.windows.1/$asset"
got=$(shasum -a 256 "$work/$asset" | cut -d' ' -f1)
[ "$got" = "$sum" ] || {
echo "build-git.sh: $asset hash $got, want $sum" >&2
exit 1
}
rm -rf "$out"
unzip -q "$work/$asset" -d "$out"
"$out/cmd/git.exe" --version
exit 0
;;
esac
# reference/ stays read-only; the build runs in a copy.
mkdir -p "$src"
rsync -a --delete --exclude .git "$root/reference/git/" "$src/"
# Relocatable; built-ins are symlinks, so bundles copy one binary.
flags="prefix=$out RUNTIME_PREFIX=YesPlease INSTALL_SYMLINKS=YesPlease NO_GETTEXT=YesPlease NO_TCLTK=YesPlease NO_PERL=YesPlease NO_PYTHON=YesPlease"
# The bundles say macOS 14; Git must not need newer.
[ "$(uname)" = Darwin ] && export MACOSX_DEPLOYMENT_TARGET=14.0 && flags="$flags MACOSX_DEPLOYMENT_TARGET=14.0"
if [ "$(cat "$out/.flags" 2>/dev/null)" != "$flags" ]; then
rm -rf "$out"
fi
# shellcheck disable=SC2086
make -C "$src" $flags -j"$jobs" install
echo "$flags" >"$out/.flags"
"$out/bin/git" --version