The build system of Apache OpenOffice has three main tasks:
- detecting the available tools like compilers and linkers and the installed libraries.
- compile source files, link libraries, process localization data, etc.
- creating installation sets
- create packages that install OpenOffice
These tasks are handled by five different components of the build system:
- The GNU autotools (http://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html, http://en.wikipedia.org/wiki/GNU_build_system) cover the configuration step. They are driven by main/configure.in.
- The main/solenv/bin/build.pl Perl script is responsible to build individual modules in the right order. It has multi-process but not multi-threading capabilities. It is driven by the <module>/prj/build.lst files.
- Most modules use dmake for building. There is typically one dmake makefile per directory which are triggered by build.pl.
- Some modules have been converted to GNU make. The main makefile, <module>/Makefile, is triggered by build.pl. Technically, there is a dmake wrapper, <module>/prj/makefile.mk, which is triggered by build.pl and which in turn triggers the GNU makefile.
- The main/solenv/bin/make_installer.pl Perl script creates installation sets. It is triggered by the dmake file in main/instsetoo_native.
Most parts of the build system have evolved rather than being designed. But there are some noteworthy ideas:
- Both dmake and gbuild makefiles in the modules do not use the usual mechanics of makefiles like declaring dependencies and recipies. The makefiles of AOO are mostly declarative by e.g. listing associating source files with libraries. The rules of how to compile and link those libraries is concentrated in main/solenv/inc for dmake modules and main/solenv/gbuild for gbuild modules.
- Splitting the source code into modules allows the developer to selectively build individual modules without invoking a complete build. This can save a lot of time, provided the developer builds the right modules.
The build system has more problems than can be listed here. Some of the more important ones are:
- There are too many different components of the build system, each with its own set of special rules and errors.
- All three of build.pl, dmake and gbuild bring their own dependency and multi-process or multi-threaded job management.
- The dmake and gbuild makefiles in main/solenv/ are poorly documented and hard to debug or maintain.
- build.pl supports a lot of features that are not used anymore. This results in a complexity of the Perl code that makes it hard to maintain.
- dmake is a variant of the make tool that is not maintained anymore. OpenOffice even has to compile the dmake executable because it is not available anywhere else. The dmake syntax is very different from standard make syntax.
- gbuild defines its own semi object oriented scripting language on top of GNU make macros. This language and its use in the main/solenv/gbuild files is mostly undocumented and with the special syntax rules of make files that don't allow indentation or naming of function parameters, the makefiles become mostly undreadable.
- Building OpenOffice is very slow on Windows. The effect is amplified by all parts of the build system being implemented on and therefore (possibly by accident) being designed for Linux and other Unix-like operating systems. The Windows file system is not as performant as on Linux and the cost of creating new processes is comparatively high. Both features are used extensively in the existing build system.
- A previous effort to analyze and improve the build system, resulting in the partially implemented gbuild: https://wiki.openoffice.org/wiki/Build_Environment_Effort
- Older documentation: http://www.openoffice.org/tools/build_env.html