Jump to content

Development/Build System

From The Document Foundation Wiki

This page is about the build system workflow and using it. To learn about the build system in itself, see the gbuild page.

High level build overview

  1. make (in top level) possibly reruns ./autogen.sh (if any of configure dependencies changed) and calls make -f Makefile
  2. Makefile includes generated config_host.mk from configure step above
  3. TODO: describe gnu make process
  4. ooinstall creates installation set

Tools involved in build

  • concat-deps.c
  • TODO

Module dependencies

To generate this dependency graph, download the sources of LibreOffice. After autogen.sh has been run, from the root of the LibreOffice sources, you can run make dump-deps-png which will produce the following graphviz based syntax to stdout. This has the same effect as calling the Perl script SRCDIR=./ ./bin/module-deps.pl manually.

To generate a beautiful image, use an online tool like webgraphviz and copy the syntax starting with 'digraph' you obtained from stdout (remove the first lines that are not part of the syntax), paste them in the textarea of the tool and click 'Generate graph!'. Some other viewers are listed here.

Here's a miniature preview

Note: We removed some comments generated by the LibreOffice tool in order to display properly into this Wiki.

<graphviz>
digraph LibreOffice {
edge  [color="#31CEF0", len=0.4]
edge  [fontname=Arial, fontsize=10, fontcolor="#31CEF0"]
node  [fontname=Verdana, fontsize=10, height=0.02, width=0.02, shape=Mrecord, color="#BBBBBB"]
node  [fontname=Verdana, fontsize=10, height=0.02, width=0.02,shape=box,style=filled,color="#CCCCCC"]
UnoControls -> tools;
accessibility -> svtools;
animations -> comphelper;
avmedia -> sfx2;
avmedia -> vcl;
basctl -> svx;
basegfx -> cppuhelper;
basic -> svtools;
basic -> xmlscript;
binaryurp -> cppuhelper;
bridges -> jvmaccess;
canvas -> svtools;
chart2 -> svx;
comphelper -> ucbhelper;
comphelper -> i18nlangtag;
configmgr -> comphelper;
connectivity -> svtools;
connectivity -> comphelper;
cppcanvas -> canvas;
cppu -> salhelper;
cppuhelper -> unoidl;
cppuhelper -> xmlreader;
cui -> svx;
dbaccess -> svx;
desktop -> helpcompiler;
desktop -> svx;
desktop -> xmlscript;
drawinglayer -> cppcanvas;
dtrans -> tools;
editeng -> linguistic;
editeng -> sfx2;
embeddedobj -> svtools;
emfio -> drawinglayer;
emfio -> sax;
eventattacher -> comphelper;
extensions -> svx;
filter -> svx;
filter -> xmloff;
filter -> package;
forms -> svx;
formula -> sfx2;
fpicker -> svtools;
framework -> svtools;
helpcompiler -> comphelper;
hwpfilter -> unotools;
i18nlangtag -> sal;
i18npool -> i18nutil;
i18npool -> comphelper;
i18nutil -> unotools;
io -> cppuhelper;
javaunohelper -> sal;
javaunohelper -> jvmaccess;
jurt -> sal;
jvmaccess -> cppuhelper;
jvmfwk -> cppuhelper;
lingucomponent -> unotools;
lingucomponent -> linguistic;
linguistic -> xmloff;
lotuswordpro -> svx;
oox -> filter;
opencl -> tools;
package -> sax;
package -> unotools;
pyuno -> cppuhelper;
registry -> store;
remotebridges -> cppuhelper;
reportdesign -> dbaccess;
reportdesign -> formula;
salhelper -> sal;
sax -> tools;
sc -> formula;
sc -> vbahelper;
sc -> oox;
sc -> test;
scaddins -> unotools;
sccomp -> unotools;
scripting -> vbahelper;
sd -> oox;
sd -> xmlsecurity;
sdext -> sfx2;
sdext -> xmloff;
sfx2 -> drawinglayer;
sfx2 -> framework;
sfx2 -> sax;
sfx2 -> basic;
shell -> comphelper;
slideshow -> avmedia;
slideshow -> cppcanvas;
smoketest -> unotest;
sot -> unotools;
starmath -> oox;
stoc -> jvmaccess;
stoc -> i18nlangtag;
stoc -> jvmfwk;
store -> salhelper;
svgio -> drawinglayer;
svgio -> sax;
svl -> i18nutil;
svl -> jvmfwk;
svl -> sot;
svtools -> toolkit;
svx -> avmedia;
svx -> connectivity;
svx -> editeng;
sw -> oox;
sw -> vbahelper;
test -> unotest;
test -> drawinglayer;
test -> vcl;
toolkit -> vcl;
tools -> basegfx;
tools -> comphelper;
ucb -> sax;
ucb -> vcl;
ucbhelper -> cppuhelper;
unoidl -> registry;
unotest -> comphelper;
unotest -> basic;
unotools -> tools;
unoxml -> comphelper;
unoxml -> xmloff;
uui -> svx;
vbahelper -> filter;
vcl -> svl;
vcl -> opencl;
vcl -> jvmaccess;
writerfilter -> oox;
writerperfect -> test;
writerperfect -> svx;
xmlhelp -> helpcompiler;
xmlhelp -> vcl;
xmloff -> sax;
xmloff -> vcl;
xmlreader -> cppu;
xmlscript -> tools;
xmlsecurity -> svx;
xmlsecurity -> xmloff;
}
</graphviz>

Build diagnostic

There are some useful command-line options for debugging:

  • --just-print (-n)
  • --print-data-base (-p)
  • --debug

--just-print

This option is supposed to suppress all command execution.

--print-data-base

This executes the makefile, displaying commands as they are run by make, then it will dump its internal database.

--debug

This provides the most detailed information available without running the debugger. There are five native debugging options and two more added in patched make 3.82 version from dev-tools repository:

  1. basic is the least detailed information. When enabled, make prints each target that is found to be out-of-date and the status of update action;
  2. verbose set the basic option and includes additional information about which files were parsed, prerequisites that did not need to be rebuilt;
  3. implicit sets the basic and includes additional information about implicit rule searches for each target;
  4. jobs prints the details of subprocesses invoked by make;
  5. all all options and is default, when -d is used;
  6. makefile (m) includes updating any included files, such as lists of dependencies;
  7. call (c) expands all calls and shows their results; and
  8. eval (v) will tell you about all targets that are being updated and what recipes are run.

If the debugging option specified as --debug, basic debugging is used. If the debugging option is given as -d, all is used. To select other combinations of options, comma separated list --debug=options1,options2 is used, where the option can be one of the previous options (actually, make looks only at the first letter), i.e.

make --debug=c,v

FAQ

Q. Why the term "class" is used in gbuild context?
A. See Classes are composed from structural and behavioral constituents.
Q. How can I build one module from tail_build and honor the dependency?
A. Something like the following should work:
cd tail_build && make <absolute-path-to-workdir>/Module/<module-name>
Q. How to shorten the make call for specific targets?
A. Instead of:
make /home/david/libo/workdir/unxlngx6/CppunitTest/sw_macros_test.test
you can just say:
make CppunitTest_sw_macros_test
In other words, for all these classes
AllLangResTarget
AllLangZip
CliLibrary
CliNativeLibrary
CliUnoApi
Configuration
CppunitTest
CustomTarget
Dictionary
Executable 
Extension 
ExternalPackage 
ExternalProject 
Helper 
InstallModule 
InstallScript 
InternalUnoApi 
Jar 
JunitTest 
Library 
Package 
Pagein
PythonTest
Pyuno 
Rdb 
StaticLibrary 
UI 
UnoApi 
UnoApiMerge
UnpackedTarball
WinResTarget
Zip
you can just say:
make <class>_<target>
or even
make <class>
which builds the given class for all targets.
Q. What are the three letter codes that appear when I run make?
A. An (incomplete) list of codes are:
  • [CXX] - build C++ file
  • [C ] - build C file
  • [LNK] - linker
  • [OCX] - build Objective-C++ file
  • [CUT] - C/C++ unit test
  • [GPF] - gperf
This should hint at the rest of the abbreviations: https://opengrok.libreoffice.org/search?q=gb_Output_announce

Links