libreoffice 01 windows version compilation

Posted by Lodar on Sat, 22 Jan 2022 14:48:28 +0100

01 basic information

At present, libreoffice is the mainstream open source version of office. Its predecessor is openoffice.
Official website: https://zh-cn.libreoffice.org/
wiki: https://wiki.documentfoundation.org/
Compilation instructions for windows version: https://wiki.documentfoundation.org/Development/BuildingOnWindows
Release version download address: https://www.libreoffice.org/download/download/

About class diagram documentation: https://docs.libreoffice.org/sw/html/annotated.html
For example, by searching SwFrame on the page, you can get the following detailed class diagram and class relationship:

An ancient Chinese introduction to OpenOffice:

An old document about uno: https://wiki.openoffice.org/wiki/UNO_registery_and_Bootstrapping

How to configure this IDE: https://wiki.documentfoundation.org/Development/IDE

Internationalization technology of libreoffice

https://www.cnblogs.com/linux-wang/p/9001368.html

02 libreoffice compilation method of win version

Refer to the official website: Building LibreOffice on Windows using Cygwin and MSVC: tips and tricks

02.01 vs2019 and necessary components

vs2019 Community Edition, professional edition and enterprise edition are available. Just install the following necessary components.

MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.2x)
C++ core features
Windows 10 SDK (10.0.xxxxx.x)
Windows Universal C Runtime
C++ ATL for v142 build tools (x86 & x64)
.NET Framework 4.x.x SDK
C++ Clang Compiler for Windows (9.0.0)

It is recommended to install English language support.

02.02 installing jdk

https://adoptopenjdk.net/archive.html

windows 64 bit:
https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10.1/OpenJDK11U-jdk_x64_windows_hotspot_11.0.7_10.zip

windwos32 bit:
https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.7%2B10.1/OpenJDK11U-jdk_x86-32_windows_hotspot_11.0.7_10.zip

02.03 installing cygwin 64 bit version

Download and install setup-x86_64.exe

Note: libreoffice version 7.0.4.2 may not compile. It is recommended to compile with libreoffice version 7.1 source code. libreoffice7. Version 0.4.2 can only be compiled by using the old version of cygwin before 20210329.

Libgpg error may occur when compiling libreoffice for cygwin64 bit version after March 29. Refer to:
https://wiki.documentfoundation.org/Development/msvc-x86_64

Refer to the post on libreoffice Chinese Forum: Has it been compiled on win10

Start the cmd window with administrator privileges and run setup-x86_64.exe

Note: administrator privileges, cmd window, not PowerShell

Installation path:`D:\cygwin64`
setup-x86_64.exe -P autoconf -P automake -P bison -P cabextract -P doxygen -P flex -P gcc-g++ ^
  -P gettext-devel -P git -P gnupg -P gperf -P make -P mintty ^
  -P nasm -P openssh -P openssl -P patch -P perl -P python -P python3 ^
  -P pkg-config -P rsync -P unzip -P vim -P wget -P zip -P perl-Archive-Zip ^
  -P perl-Font-TTF -P perl-IO-String

It is recommended to keep the downloaded cygwin installation package locally during installation. After successful installation and compilation, save the local cygwin installation package. In case of need.

02.04 specify update dependent directory

When libreoffice is compiled, many dependent files will be downloaded. You need to specify a dependent storage directory.
The test is in the Libo core buildtools directory at the same level of the code.

e:\git\libreoffice\libo-core-buildtools # Folder for storing dependent packages
e:\git\libreoffice\libo-core # Directory for storing libreoffice source code
e:\cygwin64  # cygwin installation directory

02.05 git configuration

The following configuration items are set in both windows and cygwin

:: Set not to convert line breaks
git config --global core.safecrlf false
git config --global core.autocrlf false
::Set not to ignore case
git config --global core.ignorecase false
::set up HTTP The warehouse does not need to enter the account password every time
git config --global credential.helper store

:: Download code
git clone --recursive https://gerrit.libreoffice.org/core.git libo-core
:: Switch to the current stable branch libreoffice-7-1-3
git checkout -b b7.1.3 origin/libreoffice-7-1-3

02.06 installing ant and junit

mkdir -p /cygdrive/e/libreoffice/libo-core-buildtools
cd /cygdrive/e/cygdrive/e/libreoffice/libo-core-buildtools
wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.9.5-bin.tar.bz2
tar -xjvf apache-ant-1.9.5-bin.tar.bz2
wget http://downloads.sourceforge.net/project/junit/junit/4.10/junit-4.10.jar

02.07 installing GNU make

mkdir -p /opt/lo/bin
cd /opt/lo/bin
wget http://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
mv make-4.2.1-msvc.exe make.exe

02.08 setting environment variable VSDEVCMD

VSDEVCMD=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat

02.08 generate engineering documents

cd /cygdrive/e/git/libreoffice/libo-core
mkdir buildx64 && cd buildx64
/cygdrive/e/git/libreoffice/libo-core/autogen.sh --with-external-tar=/cygdrive/e/git/libreoffice/libo-core-buildtools/lo-externalsrc \
--with-junit=/cygdrive/e/git/libreoffice/libo-core-buildtools/junit-4.10.jar \
--with-jdk-home=/cygdrive/d/install/Java/jdk-16.0.1 \
--with-ant-home=/cygdrive/d/install/eclipse/apache-ant-1.10.10 \
--with-visual-studio=2019 \
--disable-dependency-tracking \
--enable-pch \
--disable-ccache \
--without-ucrt-dir \
--with-lang=zh-CN \
--enable-symbols \
--host=x86_64-pc-cygwin \
--enable-debug \
--with-distro=LibreOfficeWin64

02.09 compilation

:: cd /cygdrive/e/git/libreoffice/libo-core/buildx64
/opt/lo/bin/make build-nocheck gb_COLOR=1

02.10 generate vs engineering documents

:: cd /cygdrive/e/git/libreoffice/libo-core/buildx64
/opt/lo/bin/make vs2019-ide-integration
:: set up Executable soffice_exe by vs2019 Default startup entry for

03 about the internationalization of libreoffice

The internationalization of libreoffice uses the gettext toolset.

gettext is the name of a set of toolsets. This tool set contains a set of tools such as xgettext/msginit/msgfmt for creating templates (POTS), creating PO files and compiling MO files.

reference resources: About switching between Chinese and English operating system po and mo introduction
https://www.cnblogs.com/linux-wang/p/9001368.html

example:
For example: we found a pop-up string

xxxx yyyy zzzzz

For the above content in simplified Chinese, go to the translation \ source \ zh CN directory of the source code,
Chinese string found in yyyy is in translations \ source \ zh cn \ desktop \ messages po

Then find the directly dependent string
//Direct dependencies in code
desktop\inc\strings.hrc

If you want to modify the string content of other languages, you can go to the corresponding translation \ source \ xxx. xxx is the language directory of interest.

04 about libreoffice multi process startup

libreoffice 7.0.4 uses PipeIpcThread to avoid multiple startup, but PipeIpcThread has been cancelled in 7.1.

libreoffice supports one process per application. The details are as follows:

::If specified word,excel,ppt You can open multiple processes by using the environment variable
:: open word
soffice.exe -env:UserInstallation="file:///C:/TEMP/tempOffice1" -writer
:: open excel
soffice.exe -env:UserInstallation="file:///C:/TEMP/tempOffice2" -calc
:: open ppt
soffice.exe -env:UserInstallation="file:///C:/TEMP/tempOffice3" -impress

In this way, each application has a window. Generally, the - env:UserInstallation parameter is the same and will be put into a process to run.

Topics: C++ libreoffice