I had been thinking about simplifying installing process of LibreOffice under Windows for a long time. During hackweek I had the opportunity to work on this problem and at the end of the week I could produce a proof-of-concept solution.
Currently LibreOffice Windows installer is rather complicated. It starts with the NSIS pre-installer which extracts MSI file, language MST files, readmes, setup.ini and setup.exe to a directory in the user’s file system. Desktop is the default. Then setup.exe starts. It also tries to find out the language to be used, installs the vcredist files, then starts the MSI installer (with a language transform, if necessary). MSI installer does the real installation.
It is not only overcomplicated but there are problems with NSIS:
- It does not know Unicode. Localized installers cannot be made for many languages.
- Help packs have localized installers and localized text is displayed correctly only when the system legacy code page setting matches to that language. For example Russian help pack installer displays garbage characters on English system.
- It extracts files to Desktop (per default). Users are confused, they don’t know, if they can remove those files or not.
- It has a cryptic bug which caused problems with Chinese installers (garbage characters) fdo#32335
In fact MSI alone is capable to install anything. In a few steps I created a multilingual single MSI installer for LibreOffice 3.4
- In solenv/bin/modules/installer/global.pm set $include_cab_in_msi from 0 to 1. This creates one big MSI file with the CAB included.
- Instead of installing vcredist_x86.exe separately, the necessary runtime files can be merged into the MSI. We definitely need MSVCRT, I’m not sure about ATL, and we don’t need MFC. So it helps in reducing the size of installer, if we don’t ship DLLs that are not used by LibreOffice. Merge modules should be copied to
external/msm90, they can be found at
c:\Program Files (x86)\Common Files\Merge Modules\in every Windows dev environment. Scp2 and installer creator perl scripts can handle merge modules (and after a while I found out how).
- The use of embedded language transforms is an undocumented feature of Windows Installer. A language transform is a transform that is located in a substorage of a Windows Installer package that is named after the LangId. The Summary Information Stream (Property: PID_TEMPLATE) includes a list of languages that are supported by the package. Windows Installer automatically selects the language that matches the language preference that is set for the operating system. Basically I followed the instructions on http://www.installsite.org/pages/en/msi/articles/embeddedlang/. The necessary VBScript files are part of Windows SDK, at least Microsoft mentions this in KB articles. I found them elsewhere on the net.
I uploaded the result to http://ftp.fsf.hu/LibreOffice/Multilang-MSI/.
The installer file, libreoffice34.msi starts in the default language of Windows. Any language can be forced, e.g. Hungarian with LCID 1038:
msiexec -i libreoffice34.msi TRANSFORMS=:1038
Note the colon before the number, that denotes internal transform.
- Test a lot, and possibly find out whether this method was not used on purpose before.
- Implement step 3. as part of the build.
- Do the same for helppack installers.
- Clean up the code (remove NSIS, possibly remove ulfconv, etc.)