Installing and Building OpenOffice OO638C for Darwin

Edward Peterlin

3/18/02, Revised 3/23/02

Contents

Introduction

OpenOffice on OS X has quite a way to go and still is not building. With aweseome strength, we've managed gotten the first full OS X build of OpenOffice OO638C completed. This build functions with X11 graphics and is truly a praiseworthy accomplishment. While the end result builds, further work is needed to get it compiling OS X native with the Aqua VCL as well as to clean up the changes so they can safely be integrated with the mainline code. Nevertheless, this build illustrates that it is possible to build on OS X and also provides the foundation for a pure Darwin port of OpenOffice. Due to the latter, I have labelled this process as building for Darwin.

Requirements

Preparing to Build

Because OS X does not ship by default with X11, there are a number of additional setup steps which need to be performed in addition to a regular build. These include installing X11 and an X server so you can actually use the end result of the OpenOffice build. If you are running Darwin and not OS X, chances are you do not need to undertake these steps.

There are a number of different ways to install both X11 and the X server. What are described here are the ones which were used for a successful build, but you should feel free to explore other alternatives if desired.

Installing Fink

The Fink package is an open source projects used to install other open source programs. Essentially it functions as a distribution system for both source and binaries. Fink was used to install X11 on an OS X 10.1.3 distribution.

The Fink homepage is http://fink.sourceforge.net and includes directions on how to install Fink.

Installing X11

X11 installation was done via Fink. As the build was tested via the XDarwin X server, this step simply installs the client and development portions of the X11 environment, derived from Xfree86.

  1. Open a new Terminal after Fink has been configured. Fink inserts new variables into your PATH in the shell initialization scripts that are run on startup.
  2. fink install xfree86-base

You may notice that fink fails from time to time in curl fetching the X11 source tars. If this occurs, keep attempting to install until it completes successfully. It does actually work, trust me :)

Installing XDarwin

After the X11 clients have been installed, you need to put an X server on your machine to actually use X application (yes, the concept of client and server in X seems reversed at times). If you are running Darwin, you may not need to do this step either. For an OS X X server, I chose to use XDarwin, a nice X client for OS X. Again, there are multiple ways of installing XDarwin, including through Fink, but I chose to use the package based systems from OSXGNU.org as Fink was experiencing difficulties with XDarwin.

  1. Download the XDarwin package.
  2. Unstuff and double click the XDarwin.x.pkg package to install XDarwin. XDarwin will install into the Applications folder

At this point you should be able to launch XDarwin and be fed into the twm window manager with a default X setup. If you want to change window managers at this point, feel free. I'm partial to fvwm2 and afterstep, but each U*ixhead has their own fav :)

Getting OpenOffice and External Sources

Once you have X properly installed, it's time to get the OpenOffice sources and other external sources. If you've built OpenOffice from previous sources and have applied other patches, you will need to start from scratch with a fresh CVS version of the sources.

To download the CVS distribution:

  1. Open a new Terminal (/Applications/Utilities/Terminal)
  2. mkdir /openoffice
  3. cd /openoffice
  4. setenv CVSROOT :pserver:anoncvs@anoncvs.openoffice.org:/cvs
  5. cvs login
  6. Enter the password anoncvs
  7. cvs co -rOO638C OpenOffice
  8. go get some coffee, or a beer, since it'll take a while to get it all

After you get the CVS distribution you will need to obtain some external sources not included in the OO638C CVS branch. The first set is the STLPort code. This is a compiler-agnostic STL implementation used with the OOo sources. To obtain the source:

  1. cd /openoffice
  2. mkdir stlport-4.0
  3. Launch Internet Explorer (or equivalent non M$FT browser)
  4. Download the contents of http://www.stlport.org/archive/STLport-4.0.tar.gz
  5. Move the extracted contents of the STLport-4.0 directory into /openoffice/stlport-4.0
  6. Back in the shell, cd /openoffice/stlport-4.0; ls and make sure ChangeLog and TODO appear in the listing. If you see STLport-4.0 as a directory, then simply mv STLport-4.0/* . to move the contents one directory lower.
  7. /openoffice/solenv/unxmacxp/bin/patch-STLport-4.0
  8. Enter /openoffice/stlport-4.0 as the directory when prompted
  9. cd /openoffice/stlport-4.0/src
  10. /usr/bin/make -f gcc-apple-macosx.mak
  11. go get some more coffee, or another beer, since it'll take a while to build

The next set of sources you will need is an opensource polygon clipper library gpc which isn't included with the distribution. The steps below download the appropriate library and extract its contents into /openoffice/external/gpc. The instructions below assume that you have configured Internet Explorer or your other default browser to download directly to your desktop.

  1. Go back to Internet Explorer (or your other favorite browser) and download ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc231.tar.Z
  2. Switch back to your terminal
  3. uncompress ~/Desktop/gpc231.tar.Z
  4. cd /openoffice/external/gpc
  5. tar xvf ~/Desktop/gpc231.tar
  6. mv gpc231/* .
  7. rmdir gpc231

After getting gpc you will need to get the dlcompat library for linking convienence. This is needed to properly build the patches for the Darwin port.

  1. Download the dlcompat package from the OSXGNU.org project.
  2. Uncompress it and double-click the .pkg file to install the library.

Applying Patches

At this point, we'll have a full OOo source distribution from the CVS repository with the required external sources. It's time to apply the patches!

  1. Download mega.patch (diffs between mainline OO638C code and buildable sources), mini.patch (adds two headers to solenv), berkeleydb.022802.diff (allows berkeleydb to build on 10.1.3), moz.022002.diff (comments out Mozilla builds in the makefiles), and connectivity.021202.diff (comments out Mozilla-specific address book drivers that don't build with latest Moz distributions anyway).
  2. Uncompress as necessary
  3. Open a new Terminal
  4. cd /openoffice
  5. patch -p1 < /path/to/downloaded/mega.patch
  6. patch -p1 < /path/to/downloaded/mini.patch
  7. cd /openoffice/berkeleydb
  8. patch -p0 < /path/to/downloaded/berkeleydb.022802.diff
  9. cd /openoffice/moz
  10. patch -p0 < /path/to/downloaded/moz.022002.diff
  11. cd /openoffice/connectivity
  12. patch -p0 < /path/to/downloaded/connectivity.021202.diff

Building OpenOffice

Now that we've got it all patched up, it's time to execute the build!

  1. Launch XDarwin (or your other X server). A connection to an X server is required for the build.
  2. Open up a new Terminal.
  3. setenv DISPLAY localhost:0
  4. cd /openoffice/config_office
  5. ./configure --with-x --with-stlport4-home=/openoffice/stlport-4.0
  6. Hit Enter/Return at the "Please enter Java home directory" prompt.
  7. Enter "n" and hit return at the "Directory does not exist. Do you want to create it?" prompt.
  8. cd /openoffice
  9. source MacosxEnv.Set
  10. ./bootstrap
  11. source MacosxEnv.Set (this is to rescan the PATH to locate zipdep and other executables built during the bootstrap phase)
  12. dmake
  13. Begin consuming those cases of beer. You'll be waiting about a day.

Assembling the Setup Executable

After all of OpenOffice is built, the next step is to construct the appropriate directory so we can run setup and install the binaries we've just built. From what I know, it's not possible to run them straight out of the build directory.

  1. Open up a Terminal if you closed the other one in the past couple of days.
  2. mkdir /ooo-setup
  3. cp /openoffice/instsetoo/unxmacxp.pro/01/normal/f* /ooo-setup/
  4. cp /openoffice/instsetoo/unxmacxp.pro/01/normal/setup.ins /ooo-setup/
  5. cp /openoffice/solver/638/unxmacxp.pro/lib/libstaticmxp.dylib /ooo-setup/
  6. cd /ooo-setup
  7. unzip f0\*
  8. cp -f /openoffice/setup2/unxmacxp.pro/bin/setup.app/Contents/MacOS/setup /ooo-setup/setup.bin
  9. ln -s libcppu.dylib.3.0.0 libcppu.dylib.3
  10. ln -s libsal.dylib.3.0.0 libsal.dylib.3
  11. ln -s libstore.dylib.3.0.0 libstore.dylib.3
  12. ln -s libreg.dylib.3.0.0 libreg.dylib.3

Installing OpenOffice Binaries

Now setup has all the necessary libraries and files it needs to run. The setup process will exhibit several failures, but does properly register the recognized components if it's run correctly.

  1. Open a new Terminal. Do not re-use an existing terminal that has been previously used to build OpenOffice.
  2. setenv DISPLAY localhost:0
  3. mkdir /ooo-install (this is where the final executables will live)
  4. cd /ooo-setup/
  5. setenv DYLD_LIBRARY_PATH /ooo-install/program:/ooo-install/program/filter
  6. sh setup
  7. When prompted for intallation directory, specify /ooo-install
  8. When prompted to "Please insert the disk...", specify /ooo-setup
  9. There will be errors that pop up for libraries and files containing the following: dbp, spa, psp, README, LICENSE. Hit the "Ignore" button in the error prompts to continue with the installation regardless.
  10. If you get dozens of "libfoo638mxp.dylib couldn't be registered", other than dbp, spa, and psp, then your DYLD_LIBRARY_PATH didn't match the installation directory. Delete ooo-install and run setup again

Once setup has exited, we need to move some files manually. Setup hasn't been fixed to work without a hitch on OS X/Darwin:

  1. cd /ooo-install/program/
  2. cp /ooo-setup/libstaticmxp.dylib .
  3. cp -f /openoffice/desktop/unxmacxp.pro/bin/soffice.app/Contents/MacOS/soffice soffice.bin
  4. cp /openoffice/solver/638/unxmacxp.pro/bin/iso63801.res resource/

Running OpenOffice Components

Now that it's all installed, it's time to start playing around! Only the sdraw, smath, and simpress components currently function properly. Other components currently seem to spin and suck up lots of kernel processing time and need to be debugged.

  1. Open a new Terminal.
  2. setenv DISPLAY localhost:0
  3. setenv DYLD_LIBRARY_PATH /ooo-install/program:/ooo-install/program/filter
  4. /ooo-install/program/smath (or scalc or sdraw or simpress)

sweb and swriter and smaster and soffice are broken. You'll probably need to kill -KILL them when they die (vos signal handler is busted?).

Evidence of The Way

Below are some screenshots which show that if you follow The Way described above, you will in fact see results. Click on the thumbnails to get larger copies of the screenshots. These were from a build on a TiBook 400 running XDarwin with the windowmaker window manager.

Setup running through its paces

Running scalc

Running sdraw

Running simpress

What More Needs to be Done?

This patch is just a first step towards getting a fully functional build. There are a number of things which still need to be addressed before we can claim absolute victory.

  1. Integration with Mainline Sources: This patch contains several places where code may need to be ifdefed MACOSX out or commented out in the build files. Currently the patches may break other ports. If someone is working on two different ports, this may be the ideal project to start off with after the first build is done :)
  2. Building with Aqua: Currently these build changes have only been tested with X11 based graphics. We need to check that the Aqua based build can still function and begin debugging and finalizing the Aqua VCL core.
  3. Debugging: There are a number of bugs that are evident in this build. swriter and sweb will not launch. swriter exhibits a bad memory access when accessing SwtDefaultAttrCond (I believe that's the name, but haven't looked in a week or so) in docnode.cxx. Debugging with full debug symbols requires oodles of memory, and I've personally been running into issues. Another bug is probably that when the bad access occurs, the program simly spins into an infinite loop sucking away kernel time. This may be due to an incorrect signal handler in the vos module. In any case, there are runtime issues which still need to be addressed for OS X.
  4. Setup Fixing: The setup program either needs to be made aware of the missing modules on OS X or those modules need to be implemented (I believe the address book and database modules are causing the problems but may be wrong). Additionally, we need to make setup aware of additional needs on OS X, such as the static template member initialization library.
  5. Integration and Evolution: We need to get this patch in a state safe for other ports, move to OO641 in preparation for OO1_STABLE, finish up all of the missing parts, etc. etc. etc. In other words, this patch represents the completion of the OO638C build step in our project roadmap and it's time to take up the ball and start heading for the endzone.