Installing and Building 1.0 for Quartz

Edward Peterlin

10/26/02 (corrected lib symlink versions)


Introduction has recently completed the beta release of an X11 version of 1.0, and now it is time to begin working on the native graphics version. The Quartz build on 1.0 is a first step in that direction, allowing a compile to be successful. This is but the first hurdle in our long road, but key for continuing onwards.


Getting OpenOffice and External Sources

Once you have the requirements for building OpenOffice met by performing a small contract job or assuming a decent amount of credit card debt for a new hard drive, 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 either with a source tarball, or with the CVS sources.

To download the CVS distribution:

  1. Open a new Terminal (/Applications/Utilities/Terminal)
  2. mkdir /openoffice-aqua
  3. cd /openoffice-aqua
  4. setenv CVSROOT
  5. cvs login
  6. Enter the password anoncvs
  7. cvs co -rOOO_STABLE_1_PORTS 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 take some steps to set up a build properly. OpenOffice currently requires gcc2 to build. The first step is to therefore configure your build box to use gcc2:

  1. sudo gcc_select 2

Next we build the STLPort code. This is a compiler-agnostic STL implementation used with the OOo sources. To obtain the source:

  1. cd /openoffice-aqua
  2. mkdir stlport-4.0
  3. Launch Internet Explorer (or equivalent non M$FT browser)
  4. Download the contents of
  5. Move the extracted contents of the STLport-4.0 directory into /openoffice-aqua/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-aqua/solenv/unxmacxp/bin/patch-STLport-4.0
  8. Enter /openoffice-aqua/stlport-4.0 as the directory when prompted
  9. cd /openoffice-aqua/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
  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

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! You can find all the patches you need to apply in the Quartz PORTS column of the build status. They will all need to be applied individually according to the instructions in the relevant bug filing. Alternatively you can try downloading and applying the single mega patch [] (cd /openoffice-aqua; patch -p0 < /path/to/megapatch), but this method is not supported on the mailing lists and the mega patch is not continually maintained as new module patches come in. The official method is to apply patches individually and keep up to date on the dev@porting mailing list!patch -p0 < /path/to/downloaded/

Building OpenOffice

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

  1. Open up a new Terminal.
  2. cd /openoffice-aqua/config_office
  3. ./configure --without-x --with-stlport4-home=/openoffice-aqua/stlport-4.0
  4. Hit Enter/Return at the "Please enter Java home directory" prompt.
  5. Enter "n" and hit return at the "Directory does not exist. Do you want to create it?" prompt.
  6. cd /openoffice-aqua
  7. source MacosxEnv.Set
  8. ./bootstrap
  9. source MacosxEnv.Set (this is to rescan the PATH to locate zipdep and other executables built during the bootstrap phase)
  10. dmake
  11. 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 /openoffice-aqua-setup
  3. cd /openoffice-aqua-setup
  4. emacs unorc
  5. Add the following contents to the unorc file you're editing:
  6. Hit Control-x Control-s Control-x Control-c to save unorc and exit emacs.
  7. cp /openoffice-aqua/instsetoo/* /openoffice-aqua-setup/
  8. cp /openoffice-aqua/instsetoo/ /openoffice-aqua-setup/
  9. unzip f0\*
  10. ln -s libcppu.dylib.3.0.1 libcppu.dylib.3
  11. ln -s libsal.dylib.3.0.1 libsal.dylib.3
  12. ln -s libstore.dylib.3.0.1 libstore.dylib.3
  13. ln -s libreg.dylib.3.0.1 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. If you've previously installed 1.0 X11 or Quartz, rm ~/.sversionrc
  3. mkdir /openoffice-aqua-install (this is where the final executables will live)
  4. cd /openoffice-aqua-setup/
  5. setenv DYLD_LIBRARY_PATH /openoffice-aqua-install/program:/openoffice-aqua-install/program/filter
  6. sh setup
  7. When prompted for intallation directory, specify /openoffice-aqua-install as the target directory. When you're running OpenOffice binaries from the terminal it isn't possible to use the keyboard. Click on the "Browse..." button to get a file dialog. Navigate to the openoffice-aqua-install folder in the dialog and click "OK".
  8. When prompted to "Please insert the disk...", click "OK" each time
  9. There may be errors that pop up for libraries and files containing the following: 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", your DYLD_LIBRARY_PATH didn't match the installation directory. Delete ooo-install and run setup again

What More Needs to be Done?

A 1.0 build is just that, a build. This build still utilizes the QuickDraw based VCL approach which will need to be replaced with a more robust thread-safe approach. It's time to get to the drawing boards and stop fiddling with things that don't compile...ah, I lived to see the day!

Building Test Programs

OpenOffice contains a number of test programs that can be used to exercise various parts of OpenOffice. These test programs are very useful for trying to find problems in the source code that may cause errors while running OpenOffice. The vcl test programs are incredibly useful for debugging problems when building Aqua graphics.

Once you have built the modules in the Abstraction and Infrastructure Layers, you are now ready to build the test programs for these layers. To build the test programs, execute the following commands:

> cd $SRC_ROOT/svtools/workben ; dmake ; deliver
> cd $SRC_ROOT/stoc/test/testsmgr_cpnt ; dmake ; deliver
> cd $SRC_ROOT/stoc/test ; dmake ; deliver
> cd $SRC_ROOT/bridges/test/java_uno ; dmake ; deliver
The commands listed above will build the following test programs. As these test programs are meant to provide a means for developers to debug the modules that are in the Abstraction and Infrastructure Layers, developers are highly encouraged to run these test programs on a platform such as Windows, Linux, or Solaris to determine what additional porting development effort is needed:

Building Individual Projects

OpenOffice is organized in several projects. For example, the Word Processing Project. These in turn consist of several modules, organised in separate directories. The source contains approximately 90 modules.

You can build any project or module individually. Building modules individually should not be misunderstood as reducing OpenOffice to a special application, say, for instance, the spreadsheet application. The program will always consist in the entire office suite: text processor, spreadsheet, drawing application etc. Building individual modules comes in handy if you want to develop on a certain module or port a module that has not yet been ported for this plaform. Most modules will depend on other modules to be already built. In other words, all modules must build in a particular order. Accordingly, you must build all of the modules in the Abstraction and Infrastructure Layers before you trying building any projects or modules individually.

For more information on modules and on the sequence that they build in, and on the dependencies, see

To build a project, you build each of its modules individually in their directory with the build tool.

> cd $SRC_ROOT/(module-name)
> $SRC_ROOT/(module-name)> build
> $SRC_ROOT/(module-name)> deliver
Files called makefile.rc in each directory with further subdirectories iterate through all directories of the module and executes dmake in each of them (just like the top-level makefile.rc does when building the entire office suite). The last or second to last directory is usually module-name/util which is responsible for linking one or more shared libraries.

Building a Project with Debug Information

To rebuild a complete project with debug information, remove all object files by removing the directory. Then run dmake with the debug option set to true:

> cd $SRC_ROOT/(module-name)
> $SRC_ROOT/(module-name)> rm -Rf
> $SRC_ROOT/(module-name)> build debug=true
> $SRC_ROOT/(module-name)> deliver

Re-running Setup to Reinstall OpenOffice

After you've built a module with debug symbols, chances are you'll want to reinstall OpenOffice in order to run OpenOffice with debugging information. The first thing you'll need to do is remove setup, the install directory, and some config files. If you installed to the paths suggested above, this can be accomplished with the following set of commands:

  1. rm -rf /ooo-install
  2. rm -rf /ooo-setup
  3. rm ~/.sversionrc

After getting rid of the setup directory, install directory, and the .sversionrc file we need to recreate the setup executable. First we need to reconstruct the zip files in instsetoo:

  1. cd /openoffice
  2. source MacosxEnv.Set
  3. cd instsetoo
  4. build

Now you can resume the instructions in Assembling the Setup Executable and complete with the installation. You can then get debug symbols by gdb sh and then issuing r /path/to/soffice

Deleting a Build Directory

When you're deleting a directory containing a checkout of the OpenOffice sources, you should rm -rf it from a terminal. If you are trying to delete your checkout using the Finder, you'll run into a fun little feature of the OS X Finder that doesn't allow you to delete folders named desktop. OpenOffice has a folder with this name in it, and this folder will need to be deleted from the terminal.

Moving or Renaming a Build Directory

The build process for OpenOffice utilizes hardcoded paths to STLPort and other components of the source tree. If you rename your OpenOffice build directory or if you move it to a new location, you should delete all binaries and start from scratch by runnint config_office/configure again. To erase all your object files:

  1. cd $SRCROOT
  2. find . -name -print0 | xargs -n 1 -0 rm -rf

If you do not perform this step, you will most likely be unable to build or link out of your build directory any longer.