Difference between revisions of "Documentation/Building Guide/Building on MacOSX"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (new screenshot, minor edits)
m
Line 331: Line 331:
 
# Pavel Janik screenshots http://blog.janik.cz/images/MacOSX/2006-08-10
 
# Pavel Janik screenshots http://blog.janik.cz/images/MacOSX/2006-08-10
 
# Important screenshot (eventloop issue) : http://blog.janik.cz/images/MacOSX/  => See : OOoMenus-separator-and-disabled_entries.png
 
# Important screenshot (eventloop issue) : http://blog.janik.cz/images/MacOSX/  => See : OOoMenus-separator-and-disabled_entries.png
# Christian Lippka screenshots : http://eric.bachard.free.fr/mac/aquavcl/screenshots/ericb_22august/native_menu_4.jpg
+
# Native Menus : http://eric.bachard.free.fr/mac/aquavcl/screenshots/ericb_22august/native_menu_4.jpg
  
 
[[Category:Porting]]
 
[[Category:Porting]]
 
[[Category:Development]]
 
[[Category:Development]]
 
[[Category:Aqua]]
 
[[Category:Aqua]]

Revision as of 20:58, 2 September 2006

Building OpenOffice for MacOSX using Aqua, or the Story of svdem ...

This Document tries to wrap-up the buildprocess for OpenOffice on MacOS X using the native windowing-toolkit of the Platform named Aqua. The main goal is to get the demonstration programs 'svdem' up and running. They act as a fairly good starting point to further endaevours, since they are used to test the capabilities of the underlying VCL Layer.

The base for this Document is the Description of the X11 Build thanksworthy provided by Eric Hoch in this Document: MacOSXBuildInstructions. Please check this document for prerequesites (perl, gnu-copy, compilers, Xcode, ...). In this step-by-step description i will only refer to the things which need to be done for each new milestone of the Master workspace SRC680.

I use the bash shell in all examples, since to my believe users of the c-shell are smart enough to figure out the differences anyway. If you want to dig deeper in the build-process have a look at the description of the build-enviroment here: http://tools.openoffice.org/build_env.html.

Many thanks for help & assistance go to Pavel Janik and Eric Bachard.

Some Backgroud (what is aquavcl01, EIS)

EIS

OpenOffice sources are basically kept in the CVS server located at anoncvs.services.openoffice.org. However this repository is managed by a database on top called EIS (Environment Information System) which is used to keep track of Master- and Client Workspaces. Master Workspaces are used to keep track of changes going back of the mainline trunk and undergo extensive QA-cycles. These Master Workspaces are driven to official releases. Child workspaces in contrast are copies of certain Master Workspaces used to develop and test bugfixes and additional functionality. These Child Workspaces are later (hopefully) merged back to mainlain Master Workspaces. The TX20 Report mentioned in the Links section gives a very good overview about the overall process. To learn more about Childworkspaces (CWS) have a look here: CWS.

Go to EIS http://eis.services.openoffice.org/EIS2/servlet/Logon and Logon as guest/guest to get yourself an impression. You can find information about the different workspaces, their dates and times there.

VCL (Visual Class Libraries)

Porting OpenOffice to a new Windowing Toolkit is mostly porting of the OpenOffice's VCL Layer (Visual Class Libraries) to the new platforms toolkit. The VCL-Layer is responsible of mapping the OpenOffice Application calls to the windowing toolkit.

The (native) OpenOffice port to MacOSX using the Aqua Windowing Toolkit is developed in a child workspace called aquavcl01. This child workspace consists of the modules (aka subdirs): canvas dtrans extensions freetype padmin scp2 sj2 solenv vcl.

The basic approach to prepare a developer's client system to succsessfully build OpenOffice/Aqua is the following:

  1. checkout a given OpenOffice Milestone.
  2. checkout aquavcl01 Child Workspace.
  3. merge them together.
  4. apply the latest patches.

The last point here is a cumbersome but nevertheless necessary operation, since this porting project is in flux. Thanks to Pavel and many others improvements are happening at tremendous pace at the moment. All of these improvements get distributed as patches/diffs against aquavcl01. Aquavcl01 needs to remain stable all the time, therefore the team needs to work on this patch-by-patch aproach at the moment.

Getting the code (checkout, merge and patch the puppy)

Now let's have a look what to check-out and where. All these milestone numbers below highly depend on the given point-in-time. The current milestone as of now (August, 16th 2006) is m181. You may change this to your needs. You can finde the current milestone of each cws in the EIS database.

You also need to bear in mind that you have to access to the CVS-Server's default port (2401). If a firewall stop's you here you have to setup a CVS-Tunnel.

create a directory for a given milestone, setup CVS access:

mkdir src680-m182
cd src680-m182

export CVSROOT=:pserver:anoncvs@anoncvs.services.openoffice.org:/cvs
cvs login

Please Enter the password 'anoncvs'

checkout Milestone m182:

cvs -z3 co -r SRC680_m182 OpenOffice2

Once done, you'll obtain milestone 182. this not exactly what we want, because all changes concerning aquavcl01 Child workspace are not included. To complete, we need to check aquavcl01 changes.

checkout Aquavcl01:

1) First possibility : create a dedicated tree (cool backup )

To check aquavcl01 Child workspace, the most simple is to create aquavcl01 directory, and go inside this dir

mkdir aquavcl01-src 

cd aquavcl01-src

(assuming you arelady did cvs login ..etc )
cvs -z3 co -r cws_src680_aquavcl01 OpenOffice2
The following modules will be present at the end :
canvas
extensions
padmin
scp2
solenv
dtrans
freetype
psprint
sj2
vcl

All these modules are the ones we modified to create the native version : they all are tagged "aquavcl01" (see all CVS/Tag files in the tree) and all you have to do is either rename or delete the one located in src680-m182 and replace them with the one located in aquavcl01-src.

e.g.  : canvas in src680-m182 will become canvas_m182 , and then, cp canvas from aquavcl01-src into src-m182

This applies for all the modules listed above.

2) Second possibility : use a little script to extract changes : extract_aquavcl01.sh

This shell script, located in src680-m182 will contain :

#!/bin/bash
 list="canvas extensions padmin scp2 solenv dtrans freetype psprint sj2 vcl"
 for i in $list ;  do 
    cd $i
    cvs diff -nur CWS_SRC680_AQUAVCL01_ANCHOR -nur cws_src680_aquavcl01 | patch -p0
    cd ..
 done


Then chmod +x extract_aquavcl01.sh

and run it :

./extract_aquavcl01.sh

When finished, and if no problem occurs, you should have a complete tree.

Apply some patches

After you've checked-out all the sources you need, you may have to apply some patches.

For the succsessfull build of m182 plus aqauvcl you need to apply the patch from issue number 68810:

patch -p0 <../patches/i68810.patch

One-Time preparations and scripts

Ant

For the OpenOffice Builds you need to have Apache's Ant in the source-directory. You have to have Ant Version 1.6.5+. My Ant usually resides in /opt/ant so i link it in from there:

cd src680-m182/
ln -s /opt/ant/ apache-ant-1.6.5

./configure

OpenOffice building gets configured by the popular open-source configuration-management package 'autoconf'. So you can do your beloved './configure' command, but in our case this is done in the 'config_office' subdirectory. To save the configure parameters and use them with different milestones I used to link-in my shellscript to fire up the ./configure line.

My directory-structure looks like this:

bin/
src680-m176/
src680-m182/
...

Now I go to the 'config_office' subdir and link in my startscript:

cd src680-m182/config_office/
ln -s ../../bin/build.sh

And this is how 'build.sh' looks like:

#!/bin/sh
export BASE=`pwd|sed 's/\/config_office//'`
export OOVERSION=`echo $BASE|sed 's/^\/.*\///'`
echo Building from      : $BASE
echo OpenOffice Version : $OOVERSION
./configure \
--with-lang="de en-US" \
--with-jdk-home=/Library/Java/Home/ \
--with-ant-home=$BASE/apache-ant-1.6.5/ \
--with-gnu-cp=/sw/bin/cp \
--with-epm=internal \
--disable-mozab \
--disable-pasf \
--disable-gtk \
--disable-mozilla \
--with-build-version=$OOVERSION-`date +%d-%m-%y` \
--disable-fontconfig

This is allowedly a pretty much limited setup, but my overall goal is to get people to have 'svdem' build to start coding rather than to have a production ready build for the final release. Therefore I switched off most of the stuff. How these offical builds are done in the long run is to be decided when we get there.

Doing the build

Fine, now we have a (hopefully) working 'build.sh' in the config_office subdir. We need to run it beforehand:

cd src680-m182/config_office/
./build.sh

This will setup the necessary includefiles and create a couple of files in the parent directory (bootstrap, MacOSXPPCEnv.Set.sh, MacOSXPPCEnv.Set). If you are using the sh, ksh or bash you only need to take care for 'MacOSXPPCEnv.Set.sh'.

Now we need to get back to our base-directory, run the bootstrap script, source our Enviroment (MacOSXPPCEnv.Set.sh) and finally start the build-process:

On PowerPC :

cd ..
./bootstrap
source MacOSXPPCEnv.Set.sh
time dmake


Or (on Mac Intel ) :

cd ..
./bootstrap
source MacOSXIntelEnv.Set.sh
time dmake

The main purpose of the boostrap script is to build (if necessary) the dmake utility used. Dmake once was a unix make-clone made by wticorp but got incorporated into OpenOffice since it was orphaned. For more information about dmake, it's history and manpage have a look here: http://tools.openoffice.org/dmake/index.html

Sourcing MacOSXPPCEnv.Set.sh is very important not only for building but also for running svdem later on. Here all the Enviroment-Variables for the Build will be set up. For a detailed descripton see Environment_Variables. Please note that on Intel machines, 'MacOSXPPCEnv.Set' should be substituted with 'MacOSXIntelEnv.Set'.

This Build process takes on my box (Dual 1.8 GHz G5, 1.5GB RAM) roughly 10 hours. Be paitioned. What can you do meanwhile? Do this:

while true ; do find . -maxdepth 1 -type d -anewer MacOSXPPCEnv.Set.sh |wc -l ; sleep 5; done

and wait till the number reaches 174

Building and running svdem

We want to run the demonstration programs called 'svdem'. There are a couple of binaries called 'svdem', which area they cover is still somewhat unclear to me, i hope some of you guys can shed some light here. But Hey, this is a wiki! Just correct here :-).

To have the VCL Testprogram build you have to do:

cd vcl; build --all

This should have created a file called 'svdem' here: vcl/unxmacxp.pro/bin/svdem. If you managed to build this binaries you are nearly there. What you need now is a wrapper directory structure to make this binary a fellow Mac OSX application. I mean the ones who have this structure:

svdem.app/
svdem.app/Contents
svdem.app/Contents/Info.plist
svdem.app/Contents/MacOS
svdem.app/Contents/MacOS/applicat.rdb
svdem.app/Contents/MacOS/svdem

You can basically create this structure anywhere you want. And you can link-in the file you just created (svdem). So you build up this structure once and link-in the freshly created svdem there:

ls -l svdem applicat.rdb
svdem -> /opt/src/openoffice/src680-m177//vcl/unxmacxp.pro/bin/svdem
applicat.rdb -> /opt/src/openoffice/src680-m177//vcl/unxmacxp.pro/bin/applicat.rdb

Now only the Info.plist file is missing, so here we go:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleDisplayName</key>
        <string>SvDem</string>
        <key>CFBundleExecutable</key>
        <string>svdem</string>
        <key>CFBundleIdentifier</key>
        <string>com.yourcompany.svdem</string>
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
        <key>CFBundlePackageType</key>
        <string>APPL</string>
        <key>CFBundleSignature</key>
        <string>????</string>
        <key>CFBundleVersion</key>
        <string>1.0</string>
        <key>LSRequiresCarbon</key>
        <true/>
</dict>
</plist>

If you created the directory structure properly you can do './svdem' in the 'svdem.app/Contents/MacOS/' directory. You should see the svdem coming up.

Installing, preparing and running OpenOffice

Here I like to outline the steps to run OpenOffice after a successfull build from the sources. Running the native Aqua Version of OpenOffice is somewhat tricky at the moment, since the installation procedure and mode is not in it's final state. So right now one has to manually do some preparations to run the Office suite. This will change in the future when we are about to release some Alpha Builds to a wider audience.

Drag & Drop Install the Application from the Diskimage

When you are one of the lucky few (Don't give up, Eric!) who has a successfull build you are going to see something like this as the last lines of the build:

.
.
.
......................................................................................................................................................
   (CRC32 $11685D33: DiscRecording 3.1.3f2 (Apple_HFS : 2))
Ressourcen hinzufügen…
......................................................................................................................................................
Dauer: 15.406s
Dateigröße: 144732418 Bytes, Prüfsumme: CRC32 $14E0BB67
Bearbeitete Sektoren: 773848, 773845 komprimiert
Geschwindigkeit: 24.5M Bytes/Sek
Ersparnis: 63.5 %
created: /opt/src/openoffice/src680-m182/instsetoo_native/unxmacxp.pro/OpenOffice/install/de/OpenOffice.org-2.0.4_de.dmg

In this final step the ""instsetoo_native"" target creates the install Diskimages using Apple's 'hdiutil'. In my case it gives it's output in german. After this Diskimage(s) are created, doubleclick the Diskimage to mount it and then move the Icon named 'OpenOffice.org 2.0' to your Application's Folder (or any other Folder you want this program to reside). The 'OpenOffice.org 2.0' Icon shown in the Finder is in fact a subdirectory called 'OpenOffice.org 2.0.app'. Subdirectories named .app (along with some well-know files inside like Info.plist, etc) are called Bundles in Apple's lingo.

Prepare the installation

After the OpenOffice 2.0 Application was copied to it's destination, you have to go into this Bundles and run a small shellscript provided by Pavel Janik to prepare soffice.bin (OpenOffice Launcher) for running. You have to run this script in the directory where a Universal Binary called 'droplet' is located. This 'droplet' binary was used to fire-off the X11 version of OpenOffice. Expect this to change, but as of now we have to do it like this.

I have put my OpenOffice Build in my Homedir's private Application Folder (/Users/schmidtm/Applications), so please change this path to your installation. Now go to into the Bundle and run the script:

cd /Users/schmidtm/Applications/OpenOffice.org 2.0.app/Contents/MacOS
/opt/src/openoffice/bin/fix_installed_OOo


#!/bin/bash

[ ! -f droplet ] && {
    echo "Please run me in the directory where binary named droplet is located."
    exit 0
}

mv THIRDPARTYLICENSEREADME.html help presets share ..
mv droplet droplet.orig
mv program/* .
rmdir program

cd ..
ln -sf MacOS program
sed 's#droplet#soffice.bin#' Info.plist >Info.plist.new
mv Info.plist.new Info.plist
cd MacOS

# now run ./soffice.bin

Run the soffice.bin

We're nearly through, let's fire-off the binary, but don't forget to have your 'MacOSXPPCEnv.Set.sh' sourced:

AQUA_NATIVE_MENUS=TRUE ./soffice.bin -nofirststartwizard -norestore

URL Links

  1. MacOSX X11 Build Documentation: http://wiki.services.openoffice.org/wiki/MacOSXBuildInstructions
  2. Bug Database: http://www.openoffice.org/issues/query.cgi
  3. Mailinglist: mac@porting.openoffice.org
  4. IRC Meeting-Logs (#ooo_macport@freenode.org): http://eric.bachard.free.fr/mac/aquavcl/logs_meetings/
  5. TX20: http://eric.bachard.free.fr/UTBM_TX20/reports/Carbon_vcl.pdf
  6. OpenOffice Source Directory Structure: http://wiki.services.openoffice.org/wiki/Source_code_directories
  7. Pavels Patch Wiki: http://blog.janik.cz/
  8. Eric Bachard Wiki: http://wiki.services.openoffice.org/wiki/User:Ericb
  9. Christian Lippka Wiki: http://wiki.services.openoffice.org/wiki/User:CL
  10. Carbon: http://developer.apple.com/carbon
  11. EIS: http://eis.services.openoffice.org/EIS2/servlet/Logon
  12. Runtime Configuration: http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/index.html

Screenshots

  1. Eric Bachard screenshots (some are from Stephan Schaefer) http://eric.bachard.free.fr/mac/aquavcl/screenshots/
  2. Most recent: http://eric.bachard.free.fr/mac/aquavcl/screenshots/scrollbar_01sept
  3. Pavel Janik screenshots http://blog.janik.cz/images/MacOSX/2006-08-10
  4. Important screenshot (eventloop issue) : http://blog.janik.cz/images/MacOSX/ => See : OOoMenus-separator-and-disabled_entries.png
  5. Native Menus : native_menu_4.jpg
Personal tools