berkeleydb Patches

Edward Peterlin

01/07/02, Revised 01/12/02, 1/25/02

Problem

The problem with this one is simple: the berkeleydb module failed to build on OS X.

Background

The berkeleydb module is designed to be an encapsulation of the berkeley db library for use with OpenOffice. From what I recall, this is because OOo used some type of system level database which wasn't available on OS X and the berkeleydb database was used instead. This was the path used in the linux port, and the initial OS X port also proceeded down this route. Unfortunately I now forget the link to the page from which I gleaned this information. Perhaps I can insert it in the future or someone can help to remind me where it is.

The berkeleydb module is actually built a bit differently from other modules in OOo I've seen thus far. Within the CVS distribution is a tar.gz file, db-3.2.9.tar.gz, containing a specific distribution. When the module is built, this file is unzipped and untarred into a directory named build. Then, the configure script for berkeleydb is run followed by its regular makefile. Before the scripts are run, however, a file named db-3.2.9.patch included in the OOo distribution is applied to the contents of the tar file. This file cna therefore allow for OOo specific patches to be inserted into the released berkeleydb code.

Source of the Build Failures

The source of the build failures was not actually in the berkeleydb code itself, but rather in the configure and the libtool scripts which accompanied the distribution. First, the libtool script was unaware of darwin/OS X and didn't contain the appropriate -dynamiclib command line options and extensions for building shared libraries. Second, the configure script was unaware of the appropriate path that pointed to the JDK JNI includes in a standard OS X distribution. The configure script assumed a standard jdk installation and didn't include searches in the JavaVM framework included with OS X.

While I had spent a week trying to fix libtool myself, I actually had found that the fink project had already updated libtool to function for darwin. I incorporated the changes from the fink porting page into libmain.sh and ltconfig. I manually fixed the configure shell scripts myself. This, however, temporarily introduces a limitation in the build system that will only work on machines identifying themselves as running "darwin5.2". Thankfully 10.1.2 fulfills this :)

The Patches

The patches can be downloaded from:

To apply the patch:

  1. cd /your/OOo/distribution
  2. source MacosxEnv.Set
  3. setenv CVSROOT :pserver:anoncvs@anoncvs.openoffice.org:/cvs
  4. cvs login
  5. rm -rf berkeleydb
  6. cvs co -rOO638C berkeleydb
  7. cd berkeleydb
  8. patch -p0 < /path/to/downloaded/berkeleydb.010702.diff
  9. patch -p0 < /path/to/downloaded/berkeleydb.010802.diff

The patch applied in step 8 should patch both the makefile.rc and the db-3.2.9.patch files. The patch applied in step 9 should patch the makefile.rc file only.