Skip to content

Commit dd0e97c

Browse files
authored
Merge pull request #1 from jamesbannan/jamesbannan/macos-enchant-applespell-only
macOS: bundle only the enchant applespell backend
2 parents 6f43fd4 + 87064e7 commit dd0e97c

1 file changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/build-mac.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,22 @@ jobs:
170170
# the enchant backend plugins are dlopen-ed at runtime, so Mach-O
171171
# dependency analysis never sees them. Without this the shipped app
172172
# has an empty dictionary list (see issue #2705). We add libenchant
173-
# and its backends from Homebrew, keeping the lib/ + lib/enchant-2/
174-
# sibling layout that relocatable enchant-2 uses to find backends.
175-
# The macOS applespell backend is what exposes the OS dictionaries.
173+
# and the applespell backend from Homebrew, keeping the lib/ +
174+
# lib/enchant-2/ sibling layout that relocatable enchant-2 uses to
175+
# find backends. The applespell backend delegates to the macOS
176+
# system spell checker (NSSpellChecker), so it exposes the OS
177+
# dictionaries with no bundled dictionary data. The aspell backend
178+
# is deliberately NOT bundled: its word-list data is not shipped, so
179+
# on a clean Mac it would register zero dictionaries while dragging
180+
# in libaspell — dead weight with no benefit over applespell.
176181
# brew --prefix is arch-agnostic (/opt/homebrew or /usr/local).
177182
ENCHANT_PREFIX="$(brew --prefix enchant)"
178183
LIBENCHANT="$(ls "$ENCHANT_PREFIX"/lib/libenchant-2.*.dylib | head -n1)"
184+
APPLESPELL="$ENCHANT_PREFIX/lib/enchant-2/enchant_applespell.so"
185+
test -f "$APPLESPELL" \
186+
|| { echo "ERROR: enchant applespell backend not found at $APPLESPELL"; exit 1; }
179187
EXTRA+=(--add-binary "$LIBENCHANT:lib")
180-
for so in "$ENCHANT_PREFIX"/lib/enchant-2/*.so; do
181-
EXTRA+=(--add-binary "$so:lib/enchant-2")
182-
done
188+
EXTRA+=(--add-binary "$APPLESPELL:lib/enchant-2")
183189
# Runtime hook points pyenchant at the bundled libenchant (via
184190
# PYENCHANT_LIBRARY_PATH) before novelWriter lazily imports enchant.
185191
EXTRA+=(--runtime-hook setup/macos/pyinstaller_rthook_enchant.py)
@@ -235,12 +241,13 @@ jobs:
235241
test -n "$(find "$APP_FW/assets/icons" -name '*.icons' 2>/dev/null)" \
236242
|| { echo "ERROR: icon themes not bundled"; exit 1; }
237243
# Guard against silently shipping a spell checker with no backend
238-
# (the empty-dropdown regression from #2705). libenchant and at
239-
# least one enchant-2 backend plugin must be present.
244+
# (the empty-dropdown regression from #2705). libenchant and the
245+
# applespell backend (which exposes the OS dictionaries) must both
246+
# be present.
240247
test -n "$(ls "$APP_FW"/lib/libenchant-2.*.dylib 2>/dev/null)" \
241248
|| { echo "ERROR: libenchant not bundled"; exit 1; }
242-
test -n "$(find "$APP_FW/lib/enchant-2" -name '*.so' 2>/dev/null)" \
243-
|| { echo "ERROR: enchant backend plugins not bundled"; exit 1; }
249+
test -f "$APP_FW/lib/enchant-2/enchant_applespell.so" \
250+
|| { echo "ERROR: enchant applespell backend not bundled"; exit 1; }
244251
plutil -extract CFBundleIdentifier raw dist/novelWriter.app/Contents/Info.plist
245252
plutil -extract CFBundleShortVersionString raw dist/novelWriter.app/Contents/Info.plist
246253

0 commit comments

Comments
 (0)