OpenOffice.org MinGW cross building with GUB3

Cross building shortcuts

Cross compile support for OO.o started in Novell's Hack Week-iii and is still quite experimental. It build on the Grand Unified Builder -- GUB, a mini source based distribution Han-Wen and I delevoped for creating LilyPond binaries and installers.

I took some shortcuts to get the OpenOffice.org cross build going, read along.

Build a native OO.o

[If you already have a recent version of OO.o and you know what you're doing, you may skip this step.]

Cross compile support for OO.o is not yet self hosting. Several custom tools are used in the build process (dmake, makedepend, regcomp, idlc, helpex, transex3, ...). These tools are created as part of the build process. They are happily compiled along with the rest of the software, with the same compiler. It's not straightforward to tell what tools and libraries are used in the build process only and can be built using CC_FOR_BUILD, and which tools and libraries need to be built twice, both with CC and CC_FOR_BUILD.

Instead of fixing this properly right now, we'll be using tools from a native build.

It's easy to add a native OO.o build to GUB, but as we all have a recent build laying around it would be a waste not to use that, right? If this is the first OO.o build on your box, install all build dependencies

sudo zypper source-install OpenOffice_org # SUSE
sudo apt-get build-dep openoffice.org     # Debian, Ubuntu
So first, build a recent version of OpenOffice.org. Easiest is using ooo-build, do something like
mkdir -p ~/vc && cd ~/vc
svn co svn://svn.gnome.org/svn/ooo-build/trunk ooo-trunk.svn && cd ooo-trunk.svn
./autogen.sh --with-distro=SUSE --with-git --with-gcc-speedup=ccache,icecream
./download
bin/gob reset
make

Get Wine

The cross build process uses not only the wrc resource compiler, but also Wine itself to run regcomp.exe . We cannot simply use regcomp from the native build. Apparently regcomp has compile time switches rather than run time options that to tweak its behaviour. Yuck.

Using Wine is a most gross hack, as this precludes cross building to other platforms, such as Solaris.

sudo zypper install wine  # SUSE
sudo apt-get install wine # Debian, Ubuntu

Cross building

Enter GUB3. Do

git clone git://github.com/janneke/gub.git
cd gub
export OOO_TOOLS_DIR=$HOME/vc/ooo-trunk.svn/build/ooo3-m9/solver/300/unxlngx6.pro/bin  # or your directory here
bin/gub mingw::openoffice

That's all. Do I need to say this is experimental and it won't work for you? This is experimental, it won't work for you. Please send patches to me ;-)

TODO