History

Gbuild was started in OOo times (like 2009) as a need to refresh the build system.

Tools

External tools

All external tools are checked against in the ./configure script and you should have a look if you want an exhaustive list.

Prerequisites for building are handled for various OS flavors. Links are available on the main Development page.

Gbuild relies on GNU Make to work

Bash is required, although most shell scripts are POSIX-compliant (called by /bin/sh).

Perl and Python are also used during the build process

Build internal tools (self-built)

gcc-wrapper is a binary provided to redirect external modules builds requiring gcc under Windows or macOS to be redirected to our default compilers (resp. MSVC and g++ in Obj-C mode)

python helpers for gdb

concat-deps removes duplicate dependencies

some more scripts used for packaging, cleaning, platform specific stuff (see $SRCDIR/solenv/bin)

Middleware tools

Some come from external libs (xsltproc), others come from history (transex3).

All those are not part of a compiler.

l10n tools

transex

cfgex

rsc (module)

idlc

climaker

xrmex

windows setup tools

makecab.exe

msidb.exe

msiinfo.exe

msimsp.exe

msitran.exe

Work In Progress by MatM (talk) 2013-05-18T23:42:52 (UTC) : TO BE CONTINUED

Architecture

Gbuild is stored in ./solenv/gbuild

Because we have more than 200 modules to build for a full product, we want to avoid duplicating work. We want because it is a Good Thing™, and also because a change in a workflow in a module is likely to be spread in all similar behaviors. So far:

Work In Progress by MatM (talk) 2013-05-08T22:56:17 (UTC) : include list of gbuild classes with quick summary.

In (), you have the di/trigram used during make to identify module output during the build

Conventions & principles

If classes have a trigram, this shows they are "public", meaning they are called from modules make directly, not through the gbuild engine.

functions and vars are gb_<CLASS>_

gb_<CLASS>_<CLASS> is the constructor

If a function or a var contains __ (double underscores), then it is a private item (internal only)

All functions working with lists end with an s. They all have a matching non-plural function that wraps the real call.

*_get_target functions give paths to files (often from a local list). The functions are defined in TargetLocations.mk

gbuild

Initialize many variables, transclude some vars from configure into gb_ ones.

AllLangHelp (ALH)

Uses HelpTarget Helper to get all help files at the right places when building a module

TODO: Find how ALH is called

AllLangPackage

Handles creation of a bunch of packages with content dependent on language. The package files are placed into $(INSTDIR).

As of 2013-05-11, templates and autotext are concerned (in $SRCDIR/extras)

AllLangResTarget (SRT, SRS, RES)

Handles two kinds of resources: icons and template files with l10n.

Templates are src files that contain only macros that are then used from other src files, but these macros contain translatable strings. Because the processing of src files is done in two phases: 1/ localization and 2/ merging, templates must be translated independently from the src files that include them. Special care must be taken to ensure that the right file (i.e., the localized one) is included; in order to do that, the templates in the source tree are called foo_tmpl.src, but the localization phase produces foo.src, and these names (i.e., without the _tmpl suffix) must be placed in #include statements in other src files.

SrsTarget class (SRS)

Class which defines the public targets to call all the Srs* classes ones

What gbuild.mk does when it is included in the makefile

It includes $(GBUILDDIR)/Output.mk for the output helper functions (announce, error ...)

It includes $(GBUILDDIR)/BuildDirs.mk to setup the variables WORKDIR, OUTDIR, REPODIR

It set up some global variables: gb_PRODUCT, gb_DEBUGLEVEL, gb_ENABLE_PCH, gb_FULLDEPS

It includes $(GBUILDDIR)/Helper.mk for the global registries and misc. helper functions

It includes $(GBUILDDIR)/TargetLocations.mk for the functions that return the filesystem paths for targets

It sets up the global registries

It reads all the Repository.mk files in the repository root (from gb_REPOS). This:

sets up the name for the repository (for example: SRCDIR)

sets up the group a library or executable belongs to

It then reads the platform specific part from $(GBUILDDIR)/platform. This:

sets up the layer a library/executable belongs to by the group of the library

sets up the filename of the libraries and executables by the group of the library (on windows, this is the lib-file)

sets up the dll filename of the library (windows only)

sets up the rpaths for the layers (solaris and linux only - and macOS in its own special way)

It then reads the RepositoryFixes.mk files in the repository root (from gb_REPOS). This is to keep compatibility with some unwarranted creativity in naming libraries. For example the default filenames created for the platform can be overwritten here.

It then collects all the libraries that are known from the registries. Linking is only allowed against known libraries.

It then sets up the global defines for C/C++ compilation

It then reads $(GBUILDDIR)/Deliver.mk for the copy to OUTDIR commands and the collecting of filenames for the deliver.log

It then reads all the specific classes with the build rules for the targets: ComponentTarget, AllLangResTarget, LinkTarget, ....

To get a value for key $(KEY) from a registry $(REGISTRY) the following form is used:

$(patsubst $(KEY):%,%,$(filter $(KEY):%,$(REGISTRY)))

Keys can contain everything but whitespace and colon and must be escaped with $(subst) otherwise. Values can contain everything but whitespace and must be escaped $(subst) otherwise. Example escaping functions:

Please note that all contributions to The Document Foundation Wiki are considered to be released under the Creative Commons Attribution-ShareAlike 3.0 Unported License, unless otherwise specified. This does not include the source code of LibreOffice, which is licensed under the GNU Lesser General Public License (LGPLv3). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy (see Project:Copyrights for details). LibreOffice was based on OpenOffice.org.If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.