Files
ElyOffice/packaging/stage.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

80 lines
2.8 KiB
Bash

#!/usr/bin/env bash
# Stages an app with its engines. Usage: stage.sh <slug> <dir>
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
slug=${1:?app slug, such as ely-doc}
out=${2:?the folder to fill}
case $(uname) in
MINGW* | MSYS*) exe=.exe ;;
Linux) exe= ;;
*)
echo "stage.sh: Windows or Linux only" >&2
exit 1
;;
esac
grep -q "^$slug " "$root/packaging/apps.tsv" || {
echo "stage.sh: unknown app $slug" >&2
exit 1
}
uses() { grep -q "^$1" "$root/apps/$slug/Cargo.toml"; }
need() { # path, what to run
[ -e "$1" ] || {
echo "stage.sh: no $1; run $2" >&2
exit 1
}
}
build() { cargo build --manifest-path "$root/Cargo.toml" --release "$@"; }
rm -rf "$out"
mkdir -p "$out"
build -p "$slug"
cp "$root/target/release/$slug$exe" "$out/"
if uses ely-lok; then
lo=${ELY_LO_DIR:-$root/engines/lo-src/instdir}
need "$lo/program" scripts/build-libreoffice.sh
build -p ely-lok --bin ely-lok-worker
cp "$root/target/release/ely-lok-worker$exe" "$out/"
# The kernel in LibreOffice's layout, beside the app.
mkdir "$out/libreoffice"
cp -R "$lo/program" "$lo/share" "$lo/presets" "$out/libreoffice/"
cp "$lo/LICENSE.html" "$lo/NOTICE" "$lo/CREDITS.fodt" "$out/libreoffice/"
# Merged-library builds leave text placeholders.
while IFS= read -r stub; do
if [ "$(cat "$stub")" = "invalid - merged lib" ]; then
rm "$stub"
fi
done < <(find "$out/libreoffice/program" -type f -size -64c)
if [ -n "$exe" ]; then
# The kernel needs the VC++ runtime; it ships beside it.
crt=$(ls -d "/c/Program Files/Microsoft Visual Studio/2022/"*/VC/Redist/MSVC/*/x64/Microsoft.VC143.CRT | tail -n 1)
need "$crt" "the Visual Studio 2022 C++ tools"
cp "$crt"/*.dll "$out/libreoffice/program/"
fi
fi
if uses ely-pdf-engine; then
tessdata=${ELY_TESSDATA:-$root/engines/tessdata}
need "$tessdata/eng.traineddata" scripts/fetch-tessdata.sh
build -p ely-pdf-engine --bin ely-pdf-worker
cp "$root/target/release/ely-pdf-worker$exe" "$out/"
mkdir "$out/tessdata"
cp "$tessdata"/{eng,chi_sim,chi_tra}.traineddata "$out/tessdata/"
fi
if [ "$slug" = ely-tree ] || [ "$slug" = ely-mark ]; then
need "$root/engines/git" "scripts/build-git.sh and scripts/fetch-git-lfs.sh"
cp -R "$root/engines/git" "$out/git"
fi
if uses ely-web-content; then
cef=${ELY_CEF:-$root/engines/cef}
need "$cef/icudtl.dat" scripts/fetch-cef.sh
# CEF's runtime sits beside the app, as cef-dll-sys has it.
find "$cef" -maxdepth 1 -type f \( -name '*.dll' -o -name '*.so' -o -name '*.so.*' -o -name '*.pak' \
-o -name '*.bin' -o -name '*.dat' -o -name '*.json' -o -name chrome-sandbox \) -exec cp {} "$out/" \;
cp -R "$cef/locales" "$out/"
content=$root/engines/content/$slug
need "$content/index.html" "its scripts/build-*-content.sh"
cp -R "$content" "$out/content"
fi
"$root/packaging/licenses.sh" "$slug" "$out/licenses"
echo "$out"