OpenOffice.org, frequently abbreviated to OO.o for the sake of typing, is the software I hack on a regular basis. Hacking on OO.o started out as my hobby activity at first, but it later became my full-time job, thanks to Novell. Besides the upstream version of OO.o, I also develop the go-oo version of OO.o, which has features and bug fixes that have not yet been incorporated upstream.
For the first-time hackers, the Hacking page is a good place to start, to get up-to-speed with the OO.o development. For other issues, go-oo.org page has information useful to the first time hackers as well as those who are somewhat experienced.
I have written the article entitled Hacking Calc – The First Step, which I targeted for first-time Calc hackers who are just testing the water. Though the article is not a comprehensive how-to guide on hacking Calc, it should give you a rough overview of Calc’s code structure.
General OOo hacking tips
These are some general OOo hacking tips that I have collected from our fellow developers.
Installing RPMs to an arbitrary location
For those who are developing on OO.o code base, it is frequently necessary to install more than one version of OO.o in parallel, but unfortunately the normal rpm installation always installs OO.o to the same default location. Luckily, OO.o’s rpms allow you to install it to an arbitrary location by simple use of --relocate switch. While you’re at it, you might also want to specify a custom location for the rpm database files with --dbpath swtich to avoid contaminating your system rpm database. So, the following command would do the trick:
rpm -i --dbpath <new install path>/.rpmdb \ --relocate <default installpath>=<new install path> \ openoffice.org-*.rpm
If the default install path is /opt/openoffice.org2.3, and you want to install it to, say, /home/foouser/ooo/install/ooo-2.3, then you would run
rpm -i --dbpath /home/foouser/ooo/install/ooo-2.3/.rpmdb \ --relocate /opt/openoffice.org2.3=/home/foouser/ooo/install/ooo-2.3 \ openoffice.org-*.rpm
and you will have an isolated OO.o installation in /home/foouser/ooo/install/ooo-2.3.
This process will be simplified by using the install script available in the upstream build, located in solver/680/unxlngi6.pro/bin/userscripts/install, which will perform all of this for you in just a single step plus relocate the user configuration directory to that directory.
Quickly create a runnable installation from the build
Let’s say you have just finished building a complete set of OOo source code. To quickly install it so that you can start hacking it is as follows:
export LOCALINSTALLDIR="/path/to/desired/location" cd <root source directory path>/instsetoo_native/util dmake openoffice_en-US PKGFORMAT=installed
and then run /path/to/desired/location/program/soffice.
Specifying user configuration directory at run-time
Sometimes it’s desirable to be able to run multiple soffice.bin process simultaneously, but under normal circumstances, when the second soffice.bin process is bound to the same configuration directory used by the first process, it will simply reuse the existing process.
To overwrite this behavior, you need to specify a different configuration directory for the second process. Luckily there is a command line option for this. To specify a non-default user configuration directory, use
soffice -env:UserInstallation=<file URL>
where the file URL points to the directory to be used as the configuration directory (e.g. file:///home/foouser/myconf-ooo).
Patch generation using git
Not everybody has commit access to the upstream CVS repository, in which case you can use git to locally manage revisions and generate patches.
To initialize git to version control, say, the sc module, change directory into the root of the source tree, and run
git init echo unxlng*.pro > sc/.gitignore git add sc git commit
Here, the .gitignore file should contain a list of patterns (one pattern per line) to determine what files will be ignored when adding files recursively. This is the content of my .gitignore file.
unxlngi6.pro unxlngi4.pro CVS *.orig *.rej *.~*~ *.vpj *.vpw applied_patches .svn
After that, you can commit locally to sc by
git commit -aWhen adding a new file, you need to explicitly add it by
git add <file to add>
then run git commit -a afterwards.
To generate a patch, just run
git diff --no-prefix
To remove the git tracking again, run
rm -rf .git
Many thanks to Jan Holesovsky – our in-house git wizard – for the tip.
Class diagram
I have accumulated quite a bit of OOo’s internal structure map over the course of many years’ of hacking OOo. That accumulated knowledge is now compiled into this single class diagram (.odg file). A pdf version of the same class diagram is available here.
