# Изменения упаковки LibreOffice в Редакто

Редакто включает официальную сборку LibreOffice Community 26.2.5
(сборка 26.2.5.2) как отдельную локальную среду преобразования документов.
Исходный код LibreOffice не изменяется.

При подготовке поставки Редакто выполняются только следующие действия:

- macOS: в `LibreOffice.app/Contents/Info.plist` добавляется
  `LSUIElement=true`, чтобы служебный процесс не показывал отдельный значок в
  Dock; точное изменение приведено в файле изменений
  `libreoffice-macos-lsui-element.patch`;
- macOS: удаляются сгенерированные каталоги `__pycache__` и файлы `.pyc`, после
  чего комплект подписывается подписью поставщика Редакто;
- Windows: официальная MSI-сборка административно распаковывается без
  изменения исполняемых файлов LibreOffice; из распакованного дерева
  удаляются исполняемые файлы для архитектуры ARM64, которые поставка для
  x64 не использует: заглушки запуска `pip` и `setuptools` встроенного Python
  (`t64-arm.exe`, `w64-arm.exe`, `cli-arm64.exe`, `gui-arm64.exe`);
  установщик Windows такие файлы не переносит, поэтому они не входят в
  поставку;
- Windows: библиотеки времени выполнения Visual C++ (`vcruntime140.dll`,
  `msvcp140.dll` и их спутники), которые официальная сборка LibreOffice несет
  в каталоге `System64` образа установки для установки в системный каталог,
  переносятся в каталог `program` рядом с `soffice.bin`, а их копия кладется
  рядом с ядром Редакто; каталоги `System` и `System64` из дерева удаляются.
  Так LibreOffice запускается и на системе без установленного
  распространяемого пакета Visual C++;
- обе платформы: из дерева удаляются части дистрибутива, которые не участвуют
  в единственном сценарии использования LibreOffice в Редакто — фоновом
  преобразовании документов в PDF (`soffice --headless --convert-to pdf`):
  справка, пакеты локализации интерфейса кроме русского (английский встроен),
  словари кроме русских и английских, расширения на Java (`nlpsolver`,
  `wiki-publisher`), галереи, шаблоны, мастера, автотекст, автозамена,
  определение языка, фильтр импорта PDF (`xpdfimport`), сведения о версии и
  файлы readme, а на Windows также оболочка проводника, файлы OpenCL/OpenGL и
  копия MSI, оставленная административной распаковкой; во втором ярусе
  сокращения дополнительно удаляются встроенный Python, jar-файлы Java (среда
  Java в поставку не входит), библиотеки Basic, темы значков кроме темы по
  умолчанию и на Windows каталог шрифтов образа установки. Исполняемые файлы,
  библиотеки, конфигурация и реестр настроек LibreOffice не изменяются;
  точный перечень удаленного описан правилами в
  `enterprise-runner/scripts/libreoffice-trim.mjs`, ярус и сводка удаления
  записаны в квитанции подготовки (`desktop/runtime/<платформа>.receipt.json`,
  поле `trim`);
- правила локального сетевого доступа и запуск отдельного процесса задаются
  кодом Редакто вне дерева LibreOffice.

Проприетарный код Редакто не является частью LibreOffice и взаимодействует с
ним через отдельный процесс. Исходные архивы, контрольные суммы и это описание
публикуются рядом по адресу, указанному на странице сторонних компонентов
Редакто.

## English

Redacto includes the official LibreOffice Community 26.2.5 build
(build 26.2.5.2) as a separate local document conversion runtime. LibreOffice
source code is not modified.

Redacto packaging only adds `LSUIElement=true` to
`LibreOffice.app/Contents/Info.plist` on macOS, removes generated Python bytecode,
re-signs the bundle, and administratively extracts the official MSI on Windows,
removing the ARM64 executables that the x64 build does not use (the `pip` and
`setuptools` launcher stubs of the bundled Python: `t64-arm.exe`,
`w64-arm.exe`, `cli-arm64.exe`, `gui-arm64.exe`); the Windows installer does
not carry such files. On Windows the Visual C++ runtime libraries
(`vcruntime140.dll`, `msvcp140.dll` and their companions), which the official
LibreOffice build carries in the `System64` folder of the installation image
for installation into the system folder, are moved into the `program` folder
next to `soffice.bin`, and a copy is placed next to the Redacto core; the
`System` and `System64` folders are removed from the tree. This way LibreOffice
starts on a system without the Visual C++ Redistributable installed.
The exact `Info.plist` change is provided in
`libreoffice-macos-lsui-element.patch`.

On both platforms Redacto packaging also removes the parts of the
distribution that take no part in the only way Redacto uses LibreOffice —
headless conversion of documents to PDF (`soffice --headless --convert-to
pdf`): help, UI language packs other than Russian (English is built in),
dictionaries other than Russian and English, Java extensions (`nlpsolver`,
`wiki-publisher`), galleries, templates, wizards, autotext, autocorrect,
language guessing, the PDF import filter (`xpdfimport`), version notes and
readme files; on Windows also the Explorer shell extension, OpenCL/OpenGL
files and the MSI copy left by the administrative extraction. The second
trimming tier additionally removes the bundled Python, Java jar files (no
Java runtime ships), Basic libraries, icon themes other than the default one
and, on Windows, the fonts folder of the installation image. LibreOffice
executables, libraries, configuration and the settings registry are not
modified; the exact rules live in
`enterprise-runner/scripts/libreoffice-trim.mjs`, and the tier with a removal
summary is recorded in the preparation receipt
(`desktop/runtime/<platform>.receipt.json`, field `trim`). Redacto networking
and process-launch rules live outside the LibreOffice tree.

Redacto proprietary code is not part of LibreOffice and communicates with it as
a separate process. The corresponding source archives, checksums, and this
description are published together at the location linked from Redacto's
third-party components page.
