Files
ElyOffice/scripts/build-libreoffice.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

141 lines
3.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the pinned LibreOffice with Ely's LOK patches.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
src=$root/engines/lo-src
pin=$(awk '$1 == "fetch" && $2 == "libreoffice-core" { print $4 }' "$root/scripts/fetch-references.sh")
options=(
--enable-bogus-pkg-config
--enable-mergelibs
--enable-release-build
--without-java
--without-junit
--without-help
--disable-odk
--disable-online-update
--disable-extension-integration
--disable-scripting-beanshell
--disable-scripting-javascript
--disable-firebird-sdbc
--disable-postgresql-sdbc
--disable-ext-nlpsolver
--disable-ext-wiki-publisher
--disable-report-builder
--disable-sdremote
--disable-sdremote-bluetooth
--disable-poppler
--disable-lotuswordpro
--disable-gpgmepp
--disable-cups
--disable-evolution2
--with-galleries=no
--with-lang=
--with-theme=colibre
--with-fonts
--disable-python
--disable-coinmp
--disable-lpsolve
--without-doxygen
--with-myspell-dicts
)
case $(uname) in
Darwin)
app=$src/instdir/LibreOffice.app/Contents/Resources
jobs=$(sysctl -n hw.ncpu)
;;
Linux)
# Collabora's LOKit set: headless, bundled libraries.
options+=(
--disable-gui
--disable-dbus
--disable-gio
--disable-dconf
--disable-randr
--disable-gstreamer-1-0
--without-system-cairo
--without-system-fontconfig
--without-system-freetype
--without-system-graphite
--without-system-harfbuzz
--without-system-openssl
--without-system-libpng
--without-system-libxml
--without-system-jpeg
--without-system-expat
--without-system-curl
--without-system-icu
--without-system-nss
--without-system-zlib
)
app=$src/instdir/share
jobs=$(nproc)
;;
CYGWIN*)
# Unix-only switches; configure refuses them here.
kept=()
for option in "${options[@]}"; do
case $option in
--enable-bogus-pkg-config | --disable-cups | --disable-evolution2 | --disable-python) ;;
*) kept+=("$option") ;;
esac
done
options=("${kept[@]}" --with-visual-studio=2022 --disable-ccache --disable-cli --without-dotnet)
# Cygwin's own make, never Git Bash's; MSYSTEM misleads the build.
unset MSYSTEM MSYSTEM_PREFIX MINGW_PREFIX MSYSTEM_CHOST MSYSTEM_CARCH
PATH=/opt/lo/bin:$PATH
app=$src/instdir/share
jobs=$(nproc)
;;
*)
echo "build-libreoffice.sh: no build for $(uname)" >&2
exit 1
;;
esac
if [ ! -d "$src/.git" ]; then
git init -q "$src"
git -C "$src" remote add origin https://github.com/LibreOffice/core.git
git -C "$src" fetch -q --depth 1 origin "$pin"
git -C "$src" checkout -q FETCH_HEAD
fi
# The bundled spelling dictionaries (DOC-12).
git -C "$src" config submodule.dictionaries.url https://github.com/LibreOffice/dictionaries.git
git -C "$src" submodule update -q --init --depth 1 dictionaries
[ "$(git -C "$src" rev-parse HEAD)" = "$pin" ] || {
echo "build-libreoffice.sh: $src is not at $pin" >&2
exit 1
}
"$root/scripts/apply-lo-patches.sh" "$src"
if [ "$(uname)" = Darwin ]; then
for tool in make gnu-sed bison flex gettext; do
prefix=$(brew --prefix "$tool")
PATH=$prefix/libexec/gnubin:$prefix/bin:$PATH
done
export PATH PKG_CONFIG_LIBDIR=/var/empty PKG_CONFIG_PATH=
fi
cd "$src"
if [ ! -f config_host.mk ] || ! printf '%s\n' "${options[@]}" | cmp -s - autogen.lastrun; then
./autogen.sh "${options[@]}"
fi
make -j"$jobs"
# Bundled dictionaries: English only; each one slows LOK start (PERF-01).
keep=(dict-en)
extensions=$app/extensions
for dict in "$extensions"/dict-*; do
name=$(basename "$dict")
if [[ " ${keep[*]} " != *" $name "* ]]; then
rm -rf "$dict"
fi
done
echo "build-libreoffice.sh: dictionaries kept: $(ls "$extensions" | tr '\n' ' ')"
# Ely's kernel defaults: Excel A1 formulas.
cp "$root/packaging/libreoffice/ely.xcd" "$app/registry/"
if [ "$(uname)" = Darwin ]; then
"$root/scripts/inert-lo.sh" "$src/instdir/LibreOffice.app"
fi