• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.git-hooks/H03-Mar-2022-576413

.github/H03-Mar-2022-139

.vscode/H03-Mar-2022-208208

UnoControls/H03-Mar-2022-5,9493,170

accessibility/H03-Mar-2022-33,18021,403

android/H03-May-2022-22,63316,163

animations/H03-Mar-2022-2,3801,719

apple_remote/H03-Mar-2022-2,1051,523

avmedia/H03-Mar-2022-8,6725,757

basctl/H03-Mar-2022-38,60129,471

basegfx/H03-Mar-2022-31,35621,974

basic/H03-Mar-2022-73,60156,966

bean/H03-Mar-2022-5,8523,425

bin/H07-May-2022-20,23615,532

binaryurp/H03-Mar-2022-5,6934,234

bridges/H03-Mar-2022-52,04138,794

canvas/H03-Mar-2022-40,84425,345

chart2/H03-Mar-2022-195,311148,574

cli_ure/H03-May-2022-13,2789,972

codemaker/H03-Mar-2022-12,27410,420

comphelper/H03-Mar-2022-31,68422,226

compilerplugins/H03-May-2022-96,28280,346

config_host/H03-Mar-2022-1,069785

configmgr/H03-Mar-2022-15,53912,088

connectivity/H03-Mar-2022-170,150122,099

cppcanvas/H03-Mar-2022-11,5587,582

cppu/H03-Mar-2022-19,52915,898

cppuhelper/H03-Mar-2022-17,53913,996

cpputools/H03-Mar-2022-769547

cui/H03-Mar-2022-171,016146,039

dbaccess/H03-Mar-2022-184,835137,468

desktop/H03-May-2022-68,39349,244

distro-configs/H03-Mar-2022-706626

drawinglayer/H03-Mar-2022-48,09733,723

editeng/H03-Mar-2022-80,52262,037

embeddedobj/H03-Mar-2022-21,86414,982

embedserv/H03-Mar-2022-9,6506,690

emfio/H03-Mar-2022-9,7947,918

eventattacher/H03-Mar-2022-942645

extensions/H03-Mar-2022-112,04783,243

external/H03-Mar-2022-75,71558,751

extras/H03-Mar-2022-355,851349,492

filter/H03-Mar-2022-160,878129,551

forms/H03-Mar-2022-64,93343,422

formula/H03-Mar-2022-13,78311,713

fpicker/H03-Mar-2022-22,54615,801

framework/H03-Mar-2022-103,43067,570

helpcompiler/H03-Mar-2022-2,7002,039

helpcontent2/H03-May-2022-344,706267,750

hwpfilter/H03-Mar-2022-22,15216,931

i18nlangtag/H03-Mar-2022-7,9626,389

i18npool/H03-Mar-2022-490,258475,739

i18nutil/H03-Mar-2022-6,0165,219

icon-themes/H03-Mar-2022-2,8692,200

idl/H03-Mar-2022-5,1193,864

idlc/H03-Mar-2022-14,32710,949

include/H03-Mar-2022-372,760194,861

instsetoo_native/H03-Mar-2022-7,3886,562

io/H03-Mar-2022-9,0666,434

ios/H03-May-2022-1,3861,227

javaunohelper/H03-Mar-2022-4,8783,625

jurt/H03-Mar-2022-1,175779

jvmaccess/H03-Mar-2022-1,041599

jvmfwk/H03-May-2022-8,5835,762

l10ntools/H03-Mar-2022-8,1526,073

librelogo/H03-Mar-2022-2,6742,296

libreofficekit/H03-May-2022-10,8528,329

lingucomponent/H03-Mar-2022-5,3013,581

linguistic/H03-Mar-2022-14,92810,816

lotuswordpro/H03-Mar-2022-78,44843,233

m4/H03-Mar-2022-1,4441,310

nlpsolver/H03-Mar-2022-4,6662,715

o3tl/H03-Mar-2022-2,9502,187

odk/H03-May-2022-101,11162,821

offapi/H03-Mar-2022-332,886259,516

officecfg/H03-Mar-2022-104,40398,020

onlineupdate/H03-Mar-2022-18,14613,091

oovbaapi/H03-Mar-2022-39,36534,232

oox/H03-Mar-2022-128,892102,129

opencl/H03-Mar-2022-2,7352,050

osx/H03-Mar-2022-2,4772,468

package/H03-Mar-2022-38,80327,682

pch/H03-Mar-2022-213104

postprocess/H03-Mar-2022-2,5932,109

pyuno/H03-Mar-2022-11,7678,072

qadevOOo/H03-Mar-2022-203,478109,913

readlicense_oo/H03-Mar-2022-24,97724,730

registry/H03-Mar-2022-9,9347,216

remotebridges/H03-Mar-2022-215109

reportbuilder/H03-Mar-2022-24,29716,630

reportdesign/H03-Mar-2022-59,41145,073

ridljar/H03-Mar-2022-26,27915,373

sal/H03-Mar-2022-226,718195,232

salhelper/H03-Mar-2022-2,0501,165

sax/H03-Mar-2022-13,44110,402

sc/H03-Mar-2022-2,905,3392,684,795

scaddins/H03-Mar-2022-12,5369,267

sccomp/H03-Mar-2022-2,8891,986

schema/H03-Mar-2022-5138

scp2/H03-Mar-2022-19,82816,412

scripting/H03-Mar-2022-29,13319,591

sd/H03-Mar-2022-512,830425,941

sdext/H03-Mar-2022-142,644126,773

setup_native/H03-Mar-2022-6,8394,501

sfx2/H03-Mar-2022-196,868156,962

shell/H03-Mar-2022-20,45912,719

slideshow/H03-May-2022-62,16537,221

smoketest/H03-Mar-2022-3,1812,249

solenv/H03-Mar-2022-95,73868,773

soltools/H03-Mar-2022-8,2136,320

sot/H03-Mar-2022-13,57810,356

starmath/H03-Mar-2022-58,16445,287

stoc/H03-Mar-2022-31,15023,761

store/H03-Mar-2022-8,4155,130

svgio/H03-Mar-2022-17,86812,665

svl/H03-May-2022-52,82340,640

svtools/H03-Mar-2022-69,59153,251

svx/H03-Mar-2022-381,962292,764

sw/H03-Mar-2022-1,237,306985,366

swext/H03-Mar-2022-7,3935,566

sysui/H03-Mar-2022-6,9045,877

test/H03-Mar-2022-19,94714,704

testtools/H03-Mar-2022-16,28812,885

toolkit/H03-Mar-2022-67,04649,089

tools/H03-Mar-2022-24,93219,471

ucb/H03-Mar-2022-99,71367,805

ucbhelper/H03-Mar-2022-9,2536,141

udkapi/H03-Mar-2022-30,75324,059

uitest/H03-May-2022-4,1672,934

unodevtools/H03-Mar-2022-5,3994,365

unoidl/H03-Mar-2022-11,94010,908

unoil/H03-Mar-2022-224127

unotest/H03-Mar-2022-2,4101,497

unotools/H03-Mar-2022-29,39022,430

unoxml/H03-Mar-2022-19,81613,917

ure/H03-Mar-2022-1,9781,374

uui/H03-Mar-2022-9,7377,252

vbahelper/H03-Mar-2022-14,34210,300

vcl/H03-May-2022-650,456514,478

wasm-qt/H03-Mar-2022-827445

winaccessibility/H03-Mar-2022-24,48316,459

wizards/H03-Mar-2022-126,730106,259

writerfilter/H03-Mar-2022-89,49773,283

writerperfect/H03-Mar-2022-28,44523,583

xmerge/H03-Mar-2022-20,1258,804

xmlhelp/H03-Mar-2022-10,0237,163

xmloff/H03-Mar-2022-186,544139,063

xmlreader/H03-Mar-2022-1,161973

xmlscript/H03-Mar-2022-11,4489,123

xmlsecurity/H03-Mar-2022-50,96737,166

.buckconfigH A D03-Mar-2022223 1410

.buckversionH A D03-Mar-202241 21

.clang-formatH A D03-Mar-20221.5 KiB4948

.editorconfigH A D03-Mar-2022449 2620

.git-blame-ignore-revsH A D03-Mar-20221.7 KiB4342

.gitattributesH A D03-Mar-202277 65

.gitignoreH A D03-Mar-20222.9 KiB186162

.gitmodulesH A D03-Mar-2022241 1312

.gitpod.dockerfileH A D03-Mar-2022813 1411

.gitpod.ymlH A D03-Mar-2022114 75

.gitreviewH A D03-Mar-2022117 86

BUCKH A D03-Mar-20221.4 KiB6961

COPYINGH A D03-Mar-202234.3 KiB675553

COPYING.LGPLH A D03-Mar-20227.5 KiB166128

COPYING.MPLH A D03-Mar-202216.3 KiB374293

ChangeLogH A D03-Mar-2022147.5 MiB2,807,0191,609,731

ChangeLog-helpcontent2H A D03-Mar-20224.8 MiB93,75153,585

Library_merged.mkH A D03-Mar-20221,013 4727

Makefile.fetchH A D03-Mar-20229.9 KiB238193

Makefile.gbuildH A D03-Mar-20223 KiB5839

Makefile.inH A D03-May-202218.6 KiB497340

README.SolarisH A D03-Mar-20221.1 KiB3822

README.crossH A D03-Mar-20229.5 KiB251194

README.mdH A D03-Mar-20226.1 KiB12999

README.wasmH A D03-Mar-202210.7 KiB261174

Repository.mkH A D03-May-202227.2 KiB1,1881,071

RepositoryExternal.mkH A D03-May-202286.9 KiB4,2773,016

RepositoryFixes.mkH A D03-Mar-20224.8 KiB10556

RepositoryModule_build.mkH A D03-Mar-20221.5 KiB9885

RepositoryModule_host.mkH A D03-Mar-20224.4 KiB198168

TEMPLATE.SOURCECODE.HEADERH A D03-Mar-20225.9 KiB171135

aclocal.m4H A D03-Mar-202268.7 KiB1,9011,714

antivirusDetection.vbsH A D03-Mar-20221.1 KiB2520

autogen.shH A D03-Mar-202210.6 KiB333267

config.guessH A D03-Mar-202247.8 KiB1,6881,475

config.subH A D03-Mar-202233.3 KiB1,8521,675

config_host.mk.inH A D03-Mar-202229.1 KiB717712

config_host_lang.mk.inH A D03-Mar-2022263 97

configureH A D03-May-20221.4 MiB45,29537,709

configure.acH A D03-Mar-2022502.7 KiB14,47113,128

download.lstH A D03-Mar-202220.4 KiB272270

gH A D03-Mar-20229.3 KiB395333

hardened_runtime.xcent.inH A D03-Mar-20221.1 KiB2417

install-shH A D03-Mar-202213.7 KiB528351

install_deps.shH A D03-Mar-20221.8 KiB5328

lo.xcentH A D03-Mar-2022963 3028

logerritH A D03-Mar-202210.2 KiB278261

sanitize-ubsan-excludelistH A D03-Mar-202243 32

setup.cfgH A D03-Mar-202236 32

sources.verH A D03-Mar-202223 21

README.Solaris

1Instructions to compile LO on Solaris with gcc
2
3Disclaimer
4----------
5This is still work in progress
6Compiling LO on Solaris with gcc is a work done by Lanedo ( www.lanedo.com )
7Any inquiry could be sent to office-solaris@lanedo.com
8
9
10Prerequisites
11-------------
12
13A working Oracle Solaris 11 installation
14
15
16Installing Dependencies
17-----------------------
18
19sudo -s
20
21pkg install git make gcc-45 autoconf autogen automake-110 gnu-m4
22
23pkg install pkg:/system/header@0.5.11-0.175.0.0.0.2.1
24pkg install pkg:/developer/gperf@3.0.3-0.175.0.0.0.2.537
25pkg install pkg:/developer/parser/bison@2.3-0.175.0.0.0.2.537
26pkg install pkg:/developer/lexer/flex@2.5.35-0.175.0.0.0.2.537
27pkg install pkg:/developer/documentation-tool/doxygen@1.5.7.1-0.175.0.0.0.2.537
28
29
30Compiling
31---------
32
33CC="gcc" CXX="g++" ./autogen.sh --with-num-cpus=2 --with-max-jobs=4 --without-junit --disable-mozilla --with-system-curl --without-help --disable-cups --without-java --with-system-cairo --with-lang= --enable-gio --disable-gnome-vfs --disable-gstreamer --without-fonts --with-system-dicts --disable-mozilla --without-system-mozilla --disable-xmlsec --with-system-openssl
34
35gmake
36
37
38

README.cross

1Cross-compiling LibreOffice
2***************************
3
4Cross-compilation works, to various degree, to the following
5platforms: iOS, Android, and Raspbian.
6
7Note that this document has not been updated very often, and not
8everything here necessarily is true any more.
9
10
11General
12-------
13
14In GNU Autoconf terminology, "build" is the platform on which you are
15running a build of some software and "host" is the platform on which
16the software you are building will run. Only in the specific case of
17building compilers and other programming tools is the term "target"
18used to indicate the platform for which the tools your are building
19will produce code. As LibreOffice is not a compiler, the "target" term
20should not be used in the context of cross-compilation.
21
22(For a case where all three of "build", "host" and "target" are
23different: consider a gcc cross-compiler running on Windows, producing
24code for Android, where the cross-compiler itself was built on
25Linux. (This is a real case.) An interesting tidbit is that such
26configurations are called "Canadian Cross".)
27
28Even though the LibreOffice build mechanism is highly unorthodox, the
29configure script takes the normal --build and --host options like any
30GNU Autoconf -based configure script. To cross-compile, you basically
31need just to specify a suitable --host option and things should work
32out nicely. In practice, many details need to be handled. See examples
33below.
34
35Note that in the case of LibreOffice, it is uncommon to run the
36configure script directly. Normally one uses the autogen.sh script.
37The autogen.sh script reads command-line options from file called
38autogen.input if it exists. The typical way of working is to keep
39the configure parameters in that file and edit it as needed.
40
41
42What is so hard, then?
43----------------------
44
45Despite the fact that the configure script takes normal --build and
46--host options, that is just the beginning. It was necessary to
47separate tests for "host" and "build" platforms in the configure
48script. See the git log for details. And the reasonably "standard"
49configure.in is just the top level; when we get down to the actual
50makefilery used to build the bits of LibreOffice, it gets much worse.
51
52
53iOS
54***
55
56iOS is the operating system on Apple's mobile devices. Clearly for a
57device like the iPad it would not be acceptable to run a normal
58LibreOffice application with overlapping windows and mouse-oriented
59GUI widgets.
60
61It makes sense to use only a part of LibreOffice's code for iOS. Lots
62of the GUI-oriented code should be left out. iOS apps that want to use
63the applicable LibreOffice code will handle all their GUI in a
64platform-dependent manner. How well it will be possible to do such a
65split remains to be seen.
66
67Obviously we want it to be possible to eventually distribute apps
68using LibreOffice code through the App Store. Technically, one
69important special aspect of iOS is that apps in the App Store are not
70allowed to load own dynamic libraries. (System libraries are used in
71the form of dynamic libraries, just like on macOS, of which iOS is
72a variant.)
73
74Thus all the libraries in LibreOffice that normally are shared
75libraries (DLLs on Windows, shared objects (.so) on Linux, dynamic
76libraries on macOS (.dylib)) must be built as static archives
77instead. This has some interesting consequences for how UNO is
78implemented and used.
79
80An iOS app is a "bundle" that contains a single executable. In an app
81using LibreOffice code, that executable then contains the necessary
82LibreOffice libraries and UNO components statically linked.
83
84The Apple tool-chain for iOS cross-building is available only for OS
85X. In order to be able to run and debug an app on an actual device
86(and not just the iOS Simulator) you need to be registered in the iOS
87Developer Program.
88
89Here is an autogen.input for iOS (device) using Xcode 4.6, on macOS 10.8:
90
91--build=i386-apple-darwin10.7.0
92--host=arm-apple-darwin10
93--enable-dbgutil
94--enable-debug
95--enable-werror
96
97For the iOS Simulator, but note that building for the simulator is
98broken at the moment (July 2014):
99
100--build=i386-apple-darwin10.7.0
101--host=arm-apple-darwin10
102--enable-ios-simulator
103--enable-dbgutil
104--enable-debug
105--enable-werror
106
107You will have to install autoconf and automake yourself before running
108autogen.sh. They are no longer included in Xcode 4.3 and later (not
109even in the add-on "command line tools").
110
111The -mmacosx-version-min=10.7 is necessary when building for the iOS
112simulator to avoid clang replacing simple calls to fprintf with calls
113to fwrite$UNIX2003 which Xcode then warns that doesn't exist on iOS.
114
115
116Android
117*******
118
119From a technical point of view the core Android OS (the kernel) is
120Linux, but everything else is different. Unlike iOS, an Android app
121can use shared objects just fine, so that aspect of UNO doesn't need
122special handling. Except that there is a silly low limit in the
123Android dynamic linker on the number of libraries you can dlopen. This
124is a limitation in user-level (but system-provided and not really
125replaceable) code, not the kernel.
126
127Thus, just like for iOS, also for Android the LibreOffice libraries
128and UNO components are built as static archives. For Android, those
129static archives, and any app-specific native code, are linked into one
130single app-specific shared library, called liblo-native-code.so.
131
132For the GUI, the same holds as said above for iOS. The GUI layer needs
133to be platform-specific, written in Java.
134
135Android cross-compilation work has been done mainly on Linux (openSUSE
136in particular). Earlier also cross-compiling from macOS was tried. The
137Android cross-compilation tool-chain (the "Native Development Kit", or
138NDK) is available for Linux, macOS and Windows, but trying to
139cross-compile LibreOffice from Windows will probably drive you insane.
140
141You will also need the Android SDK as full "make" also builds a couple
142of Android apps where the upper layer is written in Java.
143
144Use the "android" tool from the SDK to install the SDK Tools, SDK
145Platform Tools, the API 15 SDK Platform and the Android Support
146Library. If you want to run the Android apps in the emulator, you of
147course need an appropriate system image for that.
148
149Here is an autogen.input for Android on ARM when cross-compiling
150from Linux:
151
152--enable-dbgutil
153--enable-werror
154--with-distro=LibreOfficeAndroid
155--with-android-sdk=/path/to/android/sdk
156--with-android-ndk=/path/to/android/sdk/ndk/version
157
158And here is an (quite old) autogen.input for Android on X86:
159
160--with-android-ndk=/opt/libreoffice/android-ndk-r8b
161--with-android-ndk-toolchain-version=4.6
162--with-android-sdk=/opt/libreoffice/android-sdk-linux
163--build=i586-suse-linux
164--enable-ccache
165--with-distro=LibreOfficeAndroidX86
166
167A LibreOffice app for Android is being developed progress in the
168android/source directory.
169
170To run the app, do "make install" followed by either "make run" or
171starting it from Android itself. You most likely want to have an "adb logcat"
172running in another window. To debug, run "make debugrun".
173
174NB: If you happen to upgrade to Android SDK Tools 23, and the build (using
175'make verbose=t android') fails for you with:
176
177       [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
178       [dx] java.io.FileNotFoundException: /local/libreoffice/android-sdk-linux/tools/support/annotations.jar (no such file or directory)
179
180you need to copy the annotations.jar from an older sdk; like
181
182wget 'http://dl-ssl.google.com/android/repository/tools_r22.6.2-linux.zip'
183unzip tools_r22.6.2-linux.zip
184cp tools/support/annotations.jar <android-sdk-linux>/tools/support/
185
186Raspbian
187********
188
189In theory, this should work also for another Linux, it does not need to be Raspbian.
190But this cross-compilation work is tested from Debian and openSUSE to Raspbian.
191
192You will need headers, pkg-config files and libraries from a Raspbian
193system to build against. Available at
194https://dev-www.libreoffice.org/extern/ . Look for the latest
195raspbian-root-*.tar.gz . For instance:
196
197$ wget https://dev-www.libreoffice.org/extern/raspbian-root-20140120.tar.gz
198$ mkdir raspbian-root
199$ cd raspbian-root
200$ tar -xf raspbian-root-20140120.tar.gz
201
202You can build cross-compiler yourself or get the executables here:
203$ git clone git://github.com/raspberrypi/tools
204
205tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian is known to work.
206
207Then create pkg-config wrapper, something like:
208$ cat > pkg-config-wrapper-host << _EOF
209#!/bin/sh
210
211if [ "$CROSS_COMPILING" = TRUE ]; then
212   SYSROOT=$HOME/lo/raspbian-root
213   export PKG_CONFIG_PATH=${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${SYSROOT}/usr/share/pkgconfig
214   export PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/pkgconfig
215   export PKG_CONFIG_SYSROOT_DIR=${SYSROOT}
216fi
217
218exec pkg-config "\$@"
219_EOF
220$ chmod +x pkg-config-wrapper-host
221
222This does not work with pkg-config 0.23. 0.26 is known to work.
223
224And you are ready to build with autogen.input similar to:
225
226PKG_CONFIG=<path-to-pkg-config-wrapper-host>
227CC=<path-to-arm-linux-gnueabihf-gcc> --sysroot=<path-to-raspbian_rootfs>
228CXX=<path-to-arm-linux-gnueabihf-g++> --sysroot=<path-to-raspbian_rootfs>
229--build=x86_64-unknown-linux-gnu
230--host=arm-unknown-linux-gnueabihf
231--disable-sdk
232--enable-python=system
233PYTHON_CFLAGS=-I<path-to-raspbian_rootfs>/usr/include/python2.7
234PYTHON_LIBS=-lpython2.7
235--with-java
236JAVAINC=-I<path-to-raspbian_rootfs>/usr/lib/jvm/java-6-openjdk-armhf/include
237--with-system-cairo
238--with-system-cppunit
239--with-system-icu
240--with-system-neon
241--with-system-nss
242--with-system-openldap
243--with-system-openssl
244--with-system-redland
245
246Finally, when you are ready to run the binaries in Raspbian,
247you may need to get more system libraries, who knows.
248$ sudo apt-get install libreoffice # or similar
249That installs libreoffice too, which you don't need because you have
250just built one, but I don't know how to avoid it easily.
251

README.md

1# LibreOffice
2[![Coverity Scan Build Status](https://scan.coverity.com/projects/211/badge.svg)](https://scan.coverity.com/projects/211) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/307/badge)](https://bestpractices.coreinfrastructure.org/projects/307) [![Translation status](https://weblate.documentfoundation.org/widgets/libo_ui-master/-/svg-badge.svg)](https://weblate.documentfoundation.org/engage/libo_ui-master/?utm_source=widget)
3
4<img align="right" width="150" height="200" src="https://opensource.org/files/OSIApproved.png">
5
6LibreOffice is an integrated office suite based on copyleft licenses
7and compatible with most document formats and standards. Libreoffice
8is backed by The Document Foundation, which represents a large
9independent community of enterprises, developers and other volunteers
10moved by the common goal of bringing to the market the best software
11for personal productivity. LibreOffice is open source, and free to
12download, use and distribute.
13
14A quick overview of the LibreOffice code structure.
15
16## Overview
17
18You can develop for LibreOffice in one of two ways, one
19recommended and one much less so. First the somewhat less recommended
20way: it is possible to use the SDK to develop an extension,
21for which you can read the API docs [here](https://api.libreoffice.org/)
22and [here](https://wiki.openoffice.org/wiki/Documentation/DevGuide).
23This re-uses the (extremely generic) UNO APIs that are also used by
24macro scripting in StarBasic.
25
26The best way to add a generally useful feature to LibreOffice
27is to work on the code base however. Overall this way makes it easier
28to compile and build your code, it avoids any arbitrary limitations of
29our scripting APIs, and in general is far more simple and intuitive -
30if you are a reasonably able C++ programmer.
31
32## The Build Chain and Runtime Baselines
33
34These are the current minimal operating system and compiler versions to
35run and compile LibreOffice, also used by the TDF builds:
36
37* Windows:
38    * Runtime: Windows 7
39    * Build: Cygwin + Visual Studio 2019 version 16.5
40* macOS:
41    * Runtime: 10.10
42    * Build: 10.14.4 + Xcode 11.3
43* Linux:
44    * Runtime: RHEL 7 or CentOS 7
45    * Build: either GCC 7.0.0; or Clang 5.0.2 with libstdc++ 7.3.0
46* iOS (only for LibreOfficeKit):
47    * Runtime: 11.4 (only support for newer i devices == 64 bit)
48    * Build: Xcode 9.3 and iPhone SDK 11.4
49* Android:
50    * Build: NDK r19c and SDK 22.6.2
51* Emscripten / WASM:
52    * Runtime: a browser with SharedMemory support (threads + atomics)
53    * Build: Qt 5.15 with Qt supported Emscripten 1.39.8
54    * See README.wasm
55
56If you want to use Clang with the LibreOffice compiler plugins, the minimal
57version of Clang is 5.0.2. Since Xcode doesn't provide the compiler plugin
58headers, you have to compile your own Clang to use them on macOS.
59
60You can find the TDF configure switches in the `distro-configs/` directory.
61
62To setup your initial build environment on Windows and macOS, we provide
63the LibreOffice Development Environment
64([LODE](https://wiki.documentfoundation.org/Development/lode)) scripts.
65
66For more information see the build instructions for your platform in the
67[TDF wiki](https://wiki.documentfoundation.org/Development).
68
69## The Important Bits of Code
70
71Each module should have a `README.md` file inside it which has some
72degree of documentation for that module; patches are most welcome to
73improve those. We have those turned into a web page here:
74
75<https://docs.libreoffice.org/>
76
77However, there are two hundred modules, many of them of only
78peripheral interest for a specialist audience. So - where is the
79good stuff, the code that is most useful. Here is a quick overview of
80the most important ones:
81
82Module    | Description
83----------|-------------------------------------------------
84[sal/](sal)             | this provides a simple System Abstraction Layer
85[tools/](tools)         | this provides basic internal types: `Rectangle`, `Color` etc.
86[vcl/](vcl)             | this is the widget toolkit library and one rendering abstraction
87[framework/](framework) | UNO framework, responsible for building toolbars, menus, status bars, and the chrome around the document using widgets from VCL, and XML descriptions from `/uiconfig/` files
88[sfx2/](sfx2)           | legacy core framework used by Writer/Calc/Draw: document model / load/save / signals for actions etc.
89[svx/](svx)             | drawing model related helper code, including much of Draw/Impress
90
91Then applications
92
93Module    | Description
94----------|-------------------------------------------------
95[desktop/](desktop)  | this is where the `main()` for the application lives, init / bootstrap. the name dates back to an ancient StarOffice that also drew a desktop
96[sw/](sw/)           | Writer
97[sc/](sc/)           | Calc
98[sd/](sd/)           | Draw / Impress
99
100There are several other libraries that are helpful from a graphical perspective:
101
102Module    | Description
103----------|-------------------------------------------------
104[basegfx/](basegfx)  | algorithms and data-types for graphics as used in the canvas
105[canvas/](canvas)   | new (UNO) canvas rendering model with various backends
106[cppcanvas/](cppcanvas) | C++ helper classes for using the UNO canvas
107[drawinglayer/](drawinglayer) | View code to render drawable objects and break them down into primitives we can render more easily.
108
109## Rules for #include Directives (C/C++)
110
111Use the `"..."` form if and only if the included file is found next to the
112including file. Otherwise, use the `<...>` form. (For further details, see the
113mail [Re: C[++]: Normalizing include syntax ("" vs
114<>)](https://lists.freedesktop.org/archives/libreoffice/2017-November/078778.html).)
115
116The UNO API include files should consistently use double quotes, for the
117benefit of external users of this API.
118
119`loplugin:includeform (compilerplugins/clang/includeform.cxx)` enforces these rules.
120
121
122## Finding Out More
123
124Beyond this, you can read the `README.md` files, send us patches, ask
125on the mailing list libreoffice@lists.freedesktop.org (no subscription
126required) or poke people on IRC `#libreoffice-dev` on irc.libera.chat -
127we're a friendly and generally helpful mob. We know the code can be
128hard to get into at first, and so there are no silly questions.
129

README.wasm

1= Status =
2
3$ make
4$ emrun --serve_after_close instdir/program/ui-previewer.html
5
6The ui-previewer "binary" will "crash" with memory alignment problems.
7
8You can run the WASM mandelbrot Qt example, if you copy its HTML
9and the qtloader.js from the Qt's example folder after build with:
10
11$ emrun --serve_after_close workdir/LinkTarget/Executable/mandelbrot.html
12
13REMINDER: always start new tabs in the browser, reload might fail / cache!
14
15
16= Setup for the LO WASM build (with Qt) =
17
18We're using Qt 5.15 with the officially supported emscripten v1.39.8.
19But there are several potential problems with threads and exceptions, so this will likely
20change later to a newer emscripten.
21
22Qt WASM is not yet used with LO, just if you're wondering!
23
24 ++ See below under Docker build for another build option ++
25
26== Setup emscripten ==
27
28https://emscripten.org/docs/getting_started/index.html
29
30git clone https://github.com/emscripten-core/emsdk.git
31./emsdk install 1.39.8
32./emsdk activate --embedded 1.39.8
33
34Example bashrc scriptlet:
35
36EMSDK_ENV=$HOME/Development/libreoffice/git_emsdk/emsdk_env.sh
37[ -f "$EMSDK_ENV" ] && \. "$EMSDK_ENV" 1>/dev/null 2>&1
38
39
40== Setup Qt ==
41
42https://doc.qt.io/qt-5/wasm.html
43
44I originally build the Qt 5.15 branch, but probably better to build a tag like v5.15.2.
45
46So:
47
48git clone https://github.com/qt/qt5.git
49cd qt5
50git checkout v5.15.2
51./init-repository
52./configure -xplatform wasm-emscripten -feature-thread -compile-examples -prefix $PWD/qtbase
53make -j<CORES> module-qtbase module-qtdeclarative
54
55Building with examples will break with some of them, but at that point Qt already works.
56
57At some point Qt configure failed for me with:
58"Checking for target architecture... Project ERROR: target architecture detection binary not found."
59
60What seems to have fixed this was to run "emsdk activate 1.39.8" again.
61
62Current Qt fails to start the demo webserver: https://bugreports.qt.io/browse/QTCREATORBUG-24072
63Use "emrun --serve_after_close" to run Qt WASM demos
64
65Enabling multi-thread support in Firefox is a bit of work with older versions:
66- https://bugzilla.mozilla.org/show_bug.cgi?id=1477743#c7
67- https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
68- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer
69
70
71== Setup LO ==
72
73autogen.sh is patched to use emconfigure. That basically sets various environment vars,
74especially EMMAKEN_JUST_CONFIGURE, which will create the correct output file names, checked by
75configure (a.out).
76
77There's a distro config for WASM (work in progress), that gets your
78defaults right (and currently disables a ton of 3rd party stuff which
79is not essential).
80
81Recommended configure setup is thusly:
82
83# grab defaults
84--with-distro=LibreOfficeWASM32
85
86# local config
87QT5DIR=/dir/of/git_qt5/qtbase
88
89# if you want to use ccache on both sides of the build
90--with-build-platform-configure-options=--enable-ccache
91--enable-ccache
92
93
94== Using Docker to cross-build with emscripten ==
95
96If you prefer a controlled environment (sadly emsdk install/activate
97is _not_ stable over time, as e.g. nodejs versions evolve), that is
98easy to replicate across different machines - consider the docker
99images we're providing.
100
101Config/setup file see
102https://git.libreoffice.org/lode/+/ccb36979563635b51215477455953252c99ec013
103
104Run
105
106 docker-compose build
107
108in the lode/docker dir to get the container prepared. Run
109
110 PARALLELISM=4 BUILD_OPTIONS= BUILD_TARGET=build docker-compose run --rm -e PARALLELISM -e BUILD_TARGET -e BUILD_OPTIONS builder
111
112to perform an actual srcdir != builddir build; the container mounts
113checked-out git repo and output dir via docker-compose.yml (so make
114sure the path names there match your setup):
115
116The lode setup expects, inside the lode/docker subdir, the following directories:
117
118- core (git checkout)
119- workdir (the output dir - gets written into)
120- cache (ccache tree)
121- tarballs (external project tarballs gets written and cached there)
122
123
124= Ideas for an UNO bridge implementation =
125
126My post to Discord #emscripten: "I'm looking for a way to do an abstract call
127from one WASM C++ object to another WASM C++ object, so like FFI / WebIDL,
128just within WASM. All my code is C++ and normally I have bridge code, with
129assembler to implement the function call /RTTI and exception semantics of the
130specified platform. Code is at
131https://cgit.freedesktop.org/libreoffice/core/tree/bridges/source/cpp_uno.
132I've read a bit about call_indirect and stuff, but I don't have yet a good
133idea, how I could implement this (and  there is an initial feature/wasm branch
134for the interested). I probably need some fixed lookup table, like on iOS,
135because AFAIK you can't dynamically generate code in WASM. So any pointers or
136ideas for an implementation? I can disassemble some minimalistic WASM example
137and read clang code for WASM_EmscriptenInvoke, but if there were some
138standalone code or documentation I'm missing, that would be nice to know."
139
140We basically would go the same way then the other backends. Write the bridge in
141C++, which is probably largely boilerplate code, but the function call in WAT
142(https://github.com/WebAssembly/wabt) based on the LLVM WASM calling
143conventions in WASM_EmscriptenInvoke. I didn't get a reply to that question for
144hours. Maybe I'll open an Emscripten issue, if we really have to implement
145this.
146
147WASM dynamic dispatch: https://fitzgeraldnick.com/2018/04/26/how-does-dynamic-dispatch-work-in-wasm.html
148
149
150= Workaround for eventual clang WASM compiler bug =
151
152sc/source/core/data/attarray.cxx:378:44: error: call to member function 'erase' is ambiguous
153                        aNewCondFormatData.erase(nIndex);
154                        ~~~~~~~~~~~~~~~~~~~^~~~~
155include/o3tl/sorted_vector.hxx:86:15: note: candidate function
156    size_type erase( const Value& x )
157              ^
158include/o3tl/sorted_vector.hxx:97:10: note: candidate function
159    void erase( size_t index )
160
161This is currently patched by using x.erase(x.begin() + nIndex).
162
163There shouldn't be an ambiguity, because of "[WebAssembly] Change size_t to `unsigned long`."
164(https://reviews.llvm.org/rGdf07a35912d78781ed6a62a7c032bfef5085a4f5#change-IrS9f6jH6PFq),
165from "Jul 23 2018" which pre-dates the emscripten tag 1.39.8 from 02/14/2020 by ~1.5y.
166
167
168= Tools for problem diagnosis =
169
170* nm -s should list the symbols in the archive, based on the index generated by ranlib.
171  If you get linking errors that archive has no index.
172
173
174= Emscripten filesystem access with threads =
175
176This is closed, but not really fixed IMHO: https://github.com/emscripten-core/emscripten/issues/3922
177
178
179= Dynamic libraries / modules in emscripten =
180
181There is a good summary in https://bugreports.qt.io/browse/QTBUG-63925
182
183Summary: you can't use modules and threads.
184
185This is mentioned at the end of: https://github.com/emscripten-core/emscripten/wiki/Linking
186The usage of MAIN_MODULE and SIDE_MODULE has other problems, a major one IMHO is symbol resolution at runtime only.
187So this works really more like plugins in the sense of symbol resolution without dependencies / rpath.
188
189There is some clang-level dynamic-linking in progress (WASM dlload). The following link is already a bit old,
190but I found it a god summary of problems to expect:
191https://iandouglasscott.com/2019/07/18/experimenting-with-webassembly-dynamic-linking-with-clang/
192
193
194= Mixed information, links, problems, TODO =
195
196More info on Qt WASM emscripten pthreads: https://wiki.qt.io/Qt_for_WebAssembly#Multithreading_Support
197
198WASM needs -pthread at compile, not just link time for atomics support. Alternatively you can provide
199-s USE_PTHREADS=1, but both don't seem to work reliable, so best provide both.
200https://github.com/emscripten-core/emscripten/issues/10370
201
202The output file must have the prefix .o, otherwise the WASM files will get a
203node.js shebang (!) and ranlib won't be able to index the library (link errors).
204
205Qt with threads has further memory limit. From Qt configure:
206Project MESSAGE: Setting PTHREAD_POOL_SIZE to 4
207Project MESSAGE: Setting TOTAL_MEMORY to 1GB
208
209You can actually allocate 4GB: https://bugzilla.mozilla.org/show_bug.cgi?id=1392234
210
211LO uses a nested event loop to run dialogs in general, but that won't work, because you can't drive
212the browser event loop. like VCL does with the system event loop in the various VCL backends.
213Changing this will need some major work (basically dropping Application::Execute).
214
215But with the know problems with exceptions and threads, this might change:
216- https://github.com/emscripten-core/emscripten/pull/11518
217- https://github.com/emscripten-core/emscripten/issues/11503
218- https://github.com/emscripten-core/emscripten/issues/11233
219- https://github.com/emscripten-core/emscripten/issues/12035
220
221We're also using emconfigure at the moment. Originally I patched emscripten, because it
222wouldn't create the correct a.out file for C++ configure tests. Later I found that
223the emconfigure sets EMMAKEN_JUST_CONFIGURE to work around the problem.
224
225ICU bug: https://github.com/emscripten-core/emscripten/issues/10129
226Alternative, probably: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Intl
227
228There is a wasm64, but that still uses 32bit pointers!
229
230Old outdated docs: https://wiki.documentfoundation.org/Development/Emscripten
231Reverted patch: https://cgit.freedesktop.org/libreoffice/core/commit/?id=0e21f6619c72f1e17a7b0a52b6317810973d8a3e
232
233Generally https://emscripten.org/docs/porting:
234- https://emscripten.org/docs/porting/guidelines/api_limitations.html#api-limitations
235- https://emscripten.org/docs/porting/files/file_systems_overview.html#file-system-overview
236- https://emscripten.org/docs/porting/pthreads.html
237- https://emscripten.org/docs/porting/emscripten-runtime-environment.html
238
239This will be interesting: https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-an-event-loop
240
241This didn't help much yet: https://github.com/emscripten-ports
242
243Emscripten supports standalone WASI binaries: https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone
244
245https://www.qt.io/qt-examples-for-webassembly
246http://qtandeverything.blogspot.com/2017/06/qt-for-web-assembly.html
247http://qtandeverything.blogspot.com/2020/
248https://emscripten.org/docs/api_reference/Filesystem-API.html
249https://discuss.python.org/t/add-a-webassembly-wasm-runtime/3957/12
250http://git.savannah.gnu.org/cgit/config.git
251https://webassembly.org/specs/
252https://developer.chrome.com/docs/native-client/
253https://emscripten.org/docs/getting_started/downloads.html
254https://github.com/openpgpjs/openpgpjs/blob/master/README.md#getting-started
255https://developer.mozilla.org/en-US/docs/WebAssembly/Using_the_JavaScript_API
256https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-intro.md
257https://www.ip6.li/de/security/x.509_kochbuch/openssl-fuer-webassembly-compilieren
258https://emscripten.org/docs/introducing_emscripten/about_emscripten.html#about-emscripten-porting-code
259https://emscripten.org/docs/compiling/Building-Projects.html
260
261