Files
ElyOffice/scripts/apply-lo-patches.sh
T
ZacharyZhang-NYandClaude Opus 5.5 c96d39a342 LOK runs on Windows and Linux; packaging stages engines (W-01, K-01)
The kernel is the merged library on every platform; Windows and
Linux find it beside the app in libreoffice/program. All three run
unipoll: macOS through GCD, Linux by answering one request per poll,
Windows through a message-only window on the loop's thread (LOK's
own main thread had deadlocked Calc loads). Patch 0043 flushes
callbacks inline everywhere, so a request sees its result; 0042 stops
MSVC's Boost auto-link. Linux paints with cairo, BGRA; the start-up
check now paints red text and finds red in byte two on every
platform, since getTileMode does not see Skia.

ely-lok on Windows: 180 of 189 pass; on Linux 187. The rest are
listed after 0.1.3 (spelling, Calc dark tiles, show layers and
fields, a11y selection). Tests build file URLs portably and accept
CRLF where Windows writes it.

packaging/stage.sh lays out an app with its engines for Windows and
Linux; licenses.sh finds each licence on all three. ElyMark finds its
page beside the app.

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

51 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Usage: apply-lo-patches.sh <lo-src> — applies the missing patches.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
src=${1:?usage: apply-lo-patches.sh <lo-src>}
patches=("$root"/patches/libreoffice/*.patch)
files=$(sed -n 's|^+++ b/||p' "${patches[@]}" | sort -u)
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
# Whether $src is HEAD plus the first $1 patches.
holds() {
local n=$1 base=$work/base f i
rm -rf "$base"
mkdir -p "$base"
git -C "$base" init -q
# LF, as every tree here; Windows defaults convert.
git -C "$base" config core.autocrlf false
for f in $files; do
if git -C "$src" cat-file -e "HEAD:$f" 2>/dev/null; then
mkdir -p "$base/$(dirname "$f")"
git -C "$src" show "HEAD:$f" >"$base/$f"
fi
done
for ((i = 0; i < n; i++)); do
git -C "$base" apply "${patches[$i]}" 2>/dev/null || return 1
done
for f in $files; do
if [ -e "$base/$f" ]; then
cmp -s "$base/$f" "$src/$f" || return 1
elif [ -e "$src/$f" ]; then
return 1
fi
done
}
n=${#patches[@]}
while [ "$n" -ge 0 ] && ! holds "$n"; do
n=$((n - 1))
done
if [ "$n" -lt 0 ]; then
echo "apply-lo-patches.sh: $src matches no prefix of the patch series" >&2
exit 1
fi
echo "apply-lo-patches.sh: $n of ${#patches[@]} patches already in $src"
for ((i = n; i < ${#patches[@]}; i++)); do
git -C "$src" apply "${patches[$i]}"
echo "apply-lo-patches.sh: applied ${patches[$i]##*/}"
done