Mac OS X Build Instructions (X11)

From Apache OpenOffice Wiki
Revision as of 11:43, 31 October 2006 by Smsm1 (Talk | contribs)

Jump to: navigation, search

The current build instructions also at: http://porting.openoffice.org/mac/build_680_X11.html. Those are being moved to this page at OOo Wiki.

For historical reasons, there is also Mac OS X Build Instructions of SRC_m71

Note: supported compilers for Mac can be found in Compiler versions used by port maintainers and release engineers

Other Mac OS X related Wiki pages.

Building OpenOffice.org X11 on Darwin PPC

Authors: Eric Hoch

Revised 2006-01-15

Introduction

These build instructions are based upon milestone 680_m140 and higher.

Due to the nature of a port in progress this document cannot give a general overview of all the current patches necessary to build a specific milestone. To get this informations we recommend you to subscribe to our porting mailing list dev@porting.openoffice.org.

There you'll get all the latest informations about patches and everything else related to and needed to port OpenOffice.org to the Mac.

Special Thanks

Before we begin let me thank all the people without whom those build instructions would make no sense, the coders that help bringing OOo 2.0 to Mac OS X. The coders and supporters behind the Mac port are:

   Eric Bachard
   Thorsten Behrens
   Etsushi Kato
   Florian Heckl
   Pavel Janik
   Nakata Maho
   James McKenzie
   Tino Rachui
   Stephan Schäfer
   Eric Hoch

Requirements

   * The fastest machine you can find. It'd be good if it had memory, too.
   * Mac OS X 10.3.5 or Mac OS X 10.4.x including all the latest available Security Updates for 
     your version of Mac OS X
   * on Mac OS X 10.3.x: XCode 1.5 plus November 2004 gcc 3.3 Update for 
   * on Mac OS X 10.4.x: XCode 2.1
     Note: You can get both applications after a free registration at http://connect.apple.com
   * JDK 1.4.2 plus latest SDK Updates (with full JDK SDK for the headers)
   * an installed X-Server. We recommend Apple's X11 but you can also use the ones of X.org or Xfree86
   * A minimum of 4 to 5GB for a standard build. 
     Note: Usage of disk space depends upon the number of localizations you build for. 
     More localizations means more disk space needed.
     A minimum of 18GB for a full debug build.
   * If you can afford it we recommand you to backup clean sources and work with a second set of sources.
     With a second set of clean sources you can easily go back to clean sources if a module doesn't build, 
     a patch doesn't solve the problem, you have to revert a patch or for any other reason there may be. 
     In the meantime cvs sources could have been edited and you need to recompile more modules then just 
     one and that's probably not what you want...

Determine the shell you use for compilation

The default shell of a cleanly installed Mac OS X 10.3.x/Mac OS X 10.4.x is bash. If you did an update to 10.3.x or 10.4.x from early versions of Mac OS X while keeping your personal settings you may still use the tcsh shell, the default shell of Mac OS X 10.0 to 10.2.x.

Where necessary this read-me distinguishes between bash and tcsh.

To determine the shell you currently use open Terminal.app and type the following command:

ps -p $$

The output shows you which shell you're currently using.

-/bin/bash or -bash means you are using bash

-/bin/tcsh or -tcsh means you are using the c-shell

Getting OpenOffice.org and External Sources

Getting OpenOffice.org Source from CVS

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

Download the CVS distribution for SRC680_m130:

  1. Open a new Terminal (/Applications/Utilities/Terminal)
  2. mkdir 680_m130/source
  3. cd 680_m130/source
  4. Now set the CVSROOT
         * for bash do:
           export CVSROOT=:pserver:anoncvs@anoncvs.services.openoffice.org:/cvs
         * for tcsh do:
           setenv CVSROOT :pserver:anoncvs@anoncvs.services.openoffice.org:/cvs
  5. cvs login
  6. Enter the password anoncvs
  7. cvs -z3 co -r SRC680_m187 OpenOffice2
     for later milestones simply replace the 187 with the most current milestonenumber
  8. go get some coffee, or a beer, since it'll take a while to get it all 

Note that if your computer is behind a firewall and you're trying to get the sources from the CVS server, you may need to find a proper way to get it to tunnel through the firewall. The protocol runs on port 2401, and some firewalls will not allow communication on this port.

Attention: We recommend a broadband connection and a not too small amount of volume or time left within your contract since the sources are about 300MB and the checkout could take up to an hour or longer depending on the serverload.

For further informations on this topic see get the source

To get a second copy of the sources use the following commands within your 680_m187 directory:

  1. cd
  2. mkdir build
  3. cd build
  4. cp -R ../source/* .

Additional software that's not in the official OpenOffice.org sources

Now that you have the sources it's time to get the software that is not in the official OOo Source Code Tree.

   * The perl module Archive::Zip
   * Apache Ant
   * gpc
   * pkg-config
   * gnu_copy
   * gtk2 - optional - not needed
   * X11

To install Archive::Zip use the following commands in Terminal.app:

  1. perl -MCPAN -eshell
  2. install Archive::Zip

If this is your first installation of a module using CPAN you're asked to configure the CPAN enviroment. If you're not 100% sure what to answer simply accept the default answers.

Note: In some cases using CPAN with Mac OS X is a bit problematic. In this case simply follow the instructions given here on this website http://sial.org/howto/perl/life-with-cpan/macosx/ to solve the problem.

You can grep Apache Ant 1.6.5 here: http://ant.apache.org/bindownload.cgi Attention: Direct Link to the download site. Before the download starts you need to choose a mirror. The size of Apache Ant is about 6.4MB.

After the download put Apache Ant into the following directory: <your path>/680_mxx/apache-ant-1.6.5

GPC is available here: ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc231.tar.Z>

Attention: Direct Link to the download but it's only a few hundred KB.

Note: You can alternatively use the libart_lgpl library instead of GPC. This requires an additional configure flag (--enable-libart) and a precompiled libart library installed in a standard location, such as /usr/lib.

Since OS X comes with no pkg-config, or to be more specific it's simply not complete in OS X, you have to install it via fink (http://fink.sourceforge.net), Darwinports (http://www.darwinports.org) or the gentoo port system (http://www.metadistribution.org/macos/).

Begining with m101 for Mac OS X gnu_copy is needed to copy files within the build process of OOo. Please use your porting mechanism to install gnu_copy. For Darwinports the package name is coreutils, for fink it's fileutils.

If you want to compile OpenOffice.org with gtk2 support you have to install gtk2 via your porting_mechanism Note: The most current versions of gkt2 and pkg-config are in about 90% of all cases only available as sources that you need to compile and not as binaries. Please consider this while preparing your mac.

Additional Note for fink users: You need to install both packages gtk2 and gtk2-devel using fink install </package name>

Yes, there are other porting mechanisms out there such as the one of NetBSD or you can get precompiled versions of gtk, gnu_copy and pkg-config via pages like osxgnu but the author of these build instructions has no experiences with these so no recommendation for them here.

Note: If you need help with installing or maintaining packages please contact the project that provides the porting_mechanism.

It's also possible to compile pkg-config, gnu_copy as part of the gnu-coreutils and gtk2 without fink or Darwinports. Be aware that in this case you need to resolve the various depencies yourself. So we recommand using one of the porting mechanisms.

Because OS X does not install X11 by default and up to now you haven't installed one, now may be the time do so. There are various X for Mac OS X out there e.g. Apple's X11, XDarwin.org's XDarwin or simply use your porting_mechanism to install either X.org 6.8.x or Xfree86 >=4.3. For help with your X11 please contact the provider of the package or your porting mechanism project

Preparing to Build

Adding gpc to OOo sources

  1. uncompress <path to gpc>/gpc231.tar.Z
  2. tar xvf <path to gpc>/gpc231.tar
  3. cp <path to gpc>/gpc.[hc] <ooo source directory>/build/external/gpc/
  4. rmdir gpc231

Applying Patches

To apply a patch cd into the direcotory for the module which needs to be patched and do a: patch -p0 <path/to/the patch>

Most of the patches use the naming scheme modul_(subdirectory_subdirectory_etc)_filetopatch.patch.

To find all current patches do a search for issues in component subcomponent MacOSX.

You can grab the patches necessary to avoid the freetype crash from my idisk public folder

Due to the fact that not all the patches are from one author it's sometimes necessary to change to the subdirectory/ies or not. In this case the patch knows which subdirectories to jump over.

Additional steps for Mac OS X 10.4.x aka Tiger Users

OpenOffice.org1.9.xxx milestones and OpenOffice.org 2.0.x stable both now compile with gcc 4.0. Remember that you have to use XCode2.1 gcc 4.0 If you're using Mac OS X 10.4 aka Tiger and you want to use gcc 3.3 instead of the default gcc 4.0 you can do so by using the following commands within your shell.

  1. Open up a new Terminal
  2. sudo gcc_select 3.3

Do not use XCode 2.2.1 due to Issue 69314

Building OpenOffice.org

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

  1. Open up a new Terminal.
  2. Configure for your build
  3. cd <path to ooo>/680_m130/build/config_office
  4. ./configure --with-x --with-lang="de fr en-US"
     --with-jdk-home=/System/Library/Frameworks/JavaVM.framework/Home/
     --with-ant-home=<path to 680_mxx>/apache-ant-1.6.5/ --with-epm=internal
     --enable-mozab --enable-pasf --with-gtk2 --with-gnu-cp=<path to your version of gnu_copy>
     --enable-fontconfig
     Instead of using --with-freetype2=... you can also use --with-system-freetype
     Attention: Darwinports gnu_copy is named gcp to avoid conflicts with Mac OS X cp
  5. If configure fails it will output an error message saying what's missing or 
     what else causes it's breakage.
     Be sure to also check the warnings configure outputs at the end of the configuration process.
     Please report any breakage here with the error message output to dev@porting.openoffice.org
  6. cd ..
  7. ./bootstrap
  8. Set up your shell build enviroment:
         * for bash do:
           PPC: source MacosxPPCEnv.Set.sh
           Intel: source MacosxIntelEnv.Set.sh
         * for tcsh do:
           PPC: source MacosxPPCEnv.Set
           Intel: source MacosxIntelEnv.Set
  9. dmake
 10. Report any and all build failures to mac@porting.openoffice.org mail list
 11. cd instsetoo_native/unxmacxp.pro/OpenOffice/install
     Within this directory you will find a folder for each language that
     you build OpenOffice.org for. Those folders contain the installation disk images.

Additional Informations for Darwinports Users

When using Darwinports be sure to use ./configure without freetype since it leads to OpenOffice.org crashing with a version mismatch error when using Darwinport's freetype. You will find the additional patches needed to build freetype within OpenOffice.org in the subdirectory freetype2_patches of the patch archive.

Using Mozilla within OpenOffice.org

If you decided to use Mozilla packages to get special functions OpenOffice.org provides you, as I did in the example configure script, you have two choices to get them:

First:

You let OpenOffice.org compile them. Be aware that this adds additional tim to your compiling time.

If you decide to let OpenOffice.org compile Mozilla simply add --enable-build-mozilla to the ./configure script and OpenOffice.org will compile Mozilla within the moz directory.

  1. Before building Mozilla be sure to download Mozilla Sources. You can get them e.g. here:
     http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.5/source/
  2. cp mozilla-source-1.7.5.tar.gz <your path>/680_m130/moz/download
  3. cd <your path>/680_m130/moz
  4. cd config_office
  5. Use the same ./configure script out of step4 in paragraph "Buiding OpenOffice.org" and add
     --enable-build-mozilla
  6. Continue with Step 5 of the "Building OpenOffice.org" paragraph

OpenOffice.org should now compile mozilla within its build process.

Second:

You grab the Mozilla packages for PPC here: http://florian-heckl.de/ooo/MACOSXGCCPinc.zip http://florian-heckl.de/ooo/MACOSXGCCPlib.zip http://florian-heckl.de/ooo/MACOSXGCCPruntime.zip and put them into <ooo build directory>/680_m130/moz/zipped OpenOffice.org should detect and use them.

For Intel please use the ones from http://eric.bachard.free.fr/mac/moz/zipped/ these libraries appear to be universal binaries, can someone building on PPC please check at some point?

Building the whole OpenOffice.org suite or just a single Project with Debug Information

To build the whole OpenOffice.org Suite with debug informations add --enable-debug to the configure command.

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

   cd $SRC_ROOT/(module-name)
   $SRC_ROOT/(module-name)> rm -rf unxmacxp.pro
   $SRC_ROOT/(module-name)> build debug=true
   $SRC_ROOT/(module-name)> deliver
Personal tools