User:Dyrcona/LeopardBuild

From Apache OpenOffice Wiki
< User:Dyrcona
Revision as of 12:50, 21 March 2008 by Dyrcona (Talk | contribs)

Jump to: navigation, search

File Organization

OpenOffice.org is a large project. A fresh checkout of a recent development milestone (DEV300_m3) comprises 98,117 files in 13,307 directories that occupy about 1.8 GB of space on disk. Those 13,307 directories are themselves split among 179 modules, each module being a top-level directory. Good file organization is necessary to work effectively with such a large project.

If you work on several different projects, not just OO.o, you might like to keep your code files neatly organized and separate from your other files. To that end, I suggest creating a subdirectory, called Sources, in your home directory. In this directory, you could create a subdirectory for each of your major projects. Thus, the code for each project is neatly organized and distinct from the others.

In the case of OO.o, a further subdivision of the project directory helps to organize the various builds and other files. First, one has the main OO.o project directory, ${HOME}/Sources/OpenOffice.org/, where all of the OpenOffice.org-related code and build files may be kept. Under this main project directory, a bin subdirectory is a useful place to keep some scripts and environment files. Side by side with this bin subdirectory sits another called prebuild. It stores the various pre-built binaries that are recommended to speed up the total OO.o build process. If you work on more than one release at a time, or if you try different milestones, then you will likely want a subdirectory name for each milestone CVS tag that you checkout. You might also want to incorporate the name of any CWS that you integrate into that build. Finally, once you begin actually making changes to the OpenOffice.org code, or if you receive any patches from another developer, you will want a directory to store these. I call this directory diff in my setup.

The structure of this layout looks something like the following:

${HOME}/Sources/OpenOffice.org/
                               bin/
                               diff/
                               prebuild/
                               ${CVSTAG}/
                               .../

Getting Pre-built Binaries

You can get pre-built binaries for a couple of things that OO.o relies on to speed up your build. Otherwise, you will have to build these yourself.

Mozilla

You should follow the instructions in the main AquaBuild#prebuilt_Mozilla_archives page if you want to get pre-built Mozilla binaries.

unowinreg.dll

The unowinreg.dll is only required if you plan to build and use the OO.o SDK with Java. (My instructions and build script posted here assume that you do.) You can find the latest unowinreg.dll binary as of this writing at the tools website. (NOTE: This is a MS Windows DLL, and you cannot actually build this file on Mac OS X at this time. You do actually have the source for it in your checkout, though.)

Scripts and Environment Files

(Some text needs to be filled in here, but it is getting late and I'm tired, so I'll finish this tomorrow.)

env.sh

export CCACHE_DIR="$(pwd)/.ccache"
export CC="ccache gcc"
export CXX="ccache g++"
export TMP=/tmp
export SYSTEM_OPENSSL=YES

mkBuildDir.sh

#!/bin/sh

cvsTag=${1}
CVSROOT=:pserver:anoncvs@anoncvs.services.openoffice.org:2401/cvs 
where=$(pwd)

if [ "${where}" != "${HOME}/Sources/OpenOffice.org" ]; then
    cd ${HOME}/Sources/OpenOffice.org
fi

if [ -e ${cvsTag} ]; then
    if [ -d ${cvsTag} ]; then
        echo "${cvsTag} already exists and is a directory"
        read -p "Do you wish to continue (y|n)? " readContinue
        case "${readContinue}" in
            y|Y|yes|YES)
                echo "Expect undesired results if ${cvsTag} is not empty"
                cd "${cvsTag}"
                ;;
            *)
                exit 1
                ;;
        esac
    else
        echo "${cvsTag} is not a directory"
        exit 1;
    fi
else
    mkdir ${cvsTag}
    cd ${cvsTag}
fi

cvs -z4 -d ${CVSROOT} co -r ${cvsTag} OpenOffice2

# Copy the Mozilla and unowinreg.dll pre-builts to the proper place.
cp ${HOME}/Sources/OpenOffice.org/prebuild/MACOSXGCC*.zip ./moz/zipped/
cp ${HOME}/Sources/OpenOffice.org/prebuild/unowinreg.dll ./external/unowinreg/

# Link the pre-existing build script
cd config_office/
ln -s ../../bin/build.sh

build.sh

#!/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="en-US" \
--disable-binfilter \
--disable-pasf \
--disable-gtk \
--disable-build-mozilla \
--with-build-version=$OOVERSION-`date +%d-%m-%y` \
--disable-fontconfig \
--disable-headless \
--without-nas \
--with-use-shell=bash \
--with-jdk-home=/System/Library/Frameworks/JavaVM.framework/Home \
--with-stlport=no

The Build

Again, some explanatory text should go here.

In the ${CVSTAG} directory:

source ../bin/env.sh
cd config_office/
./build.sh
cd ..
./bootstrap
source MacOSXX86Env.Set.sh
cd instsetoo_native
build --all -P4 --dlv_switch -link  

Installing/Using the Result

You will find .dmg images files with installable apps in the following two directories under your main build directory, the one named for the CVS tag that you checked out earlier. The exact names of the dmg files will vary as they will include the date of the build, but there should be only 1 dmg file per directory unless you've done multiple builds.

instsetoo_native/unxmacxi.pro/OpenOffice/dmg/install/en-US
instsetoo_native/unxmacxi.pro/OpenOffice_SDK/dmg/install/en-US

You can install the OpenOffice.org.app from the dmg to almost anywhere on your system and it should work just fine. I usually place it in my Applications folder. You can also drag the icon to the dock, and that works. If you have a previous installation of OpenOffice.org in your Applications folder, I highly recommend dragging it to the Trash before installing the new OO.o in the Applicaitons folder. If you wish to have multiple versions of OO.o installed for testing or whatever reason, then it is best to install the OO.o that you just built some place other than the Applications folder.

Inside the OpenOffice_SDK dmg file is a folder that you can drag to wherever you want to put it on your disk. (I'd suggest somewhere under $HOME/Sources/.) It is beyond the scope this document to tell you how to use the SDK, but there is a whole site dedicated to that very thing.

Hacking OO.o

Once I've had some more time for code changes of my own, I'll add a subpage about hacking OO.o on Mac OS X, managing patches, etc. I have an idea for an example hack, too.

Personal tools