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

126 lines
3.4 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
--enable-cairo-rgba
--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)
;;
*)
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