User:Ploum

From The Document Foundation Wiki
Jump to: navigation, search

Cross Compiling LibreOffice for Windows on a Linux machine

Obtain dbghelp.dll and gdiplus.dll from a Windows installation

There are multiple websites offering you to download those DLLs. Unfortunately, I don't know if it is allowed to redistribute those DLLs. Thus, I'm not putting a direct link here on this wiki.

First, we add the OpenSuse repository with all the Windows libraries.

Opensuse:

sudo zypper ar -r http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_12.2/windows:mingw:win32.repo

We install all the Windows libraries. This is completely crazy but it ensures that the build will not break because something is missing. Help to narrow down the number of packages to install is welcome.

Opensuse:

sudo zypper in mingw32-\* && rpm -e `rpm -qa | grep mingw32| grep debug|xargs`

We need Java.

Opensuse:

sudo zypper in java-1_6_0-openjdk-devel

We need to install the build dependancies

Opensuse:

sudo zypper si -d libreoffice

Ubuntu/Debian:

sudo apt-get build-dep libreoffice

Clone LO repository
git clone git://anongit.freedesktop.org/libreoffice/core

Open the autogen.lastrun file (or create it at the root of the repository) and replace its content by:

(on Fedora, replace i686-w64-mingw32 by i686-pc-mingw32)

On Fedora, I remove libwpd, libwps and libwpg which are not useful anyway (wordperfect filters)

CC=ccache i686-w64-mingw32-gcc
CXX=ccache i686-w64-mingw32-g++
CC_FOR_BUILD=ccache gcc
CXX_FOR_BUILD=ccache g++
--build=i586-unknown-linux-gnu
--host=i686-w64-mingw32
--with-distro=LibreOfficeWin32
--disable-binfilter
--disable-build-mozilla
--disable-directx
--disable-ext-nlpsolver
--disable-ext-pdfimport
--disable-ext-presenter-console
--disable-ext-presenter-minimizer
--disable-ext-report-builder
--disable-ext-scripting-beanshell
--disable-ext-scripting-javascript
--disable-ext-wiki-publisher
--disable-ext-wiki-publisher
--disable-mozilla
--disable-zenity
--disable-nss-module
--enable-python=system
--with-num-cpus=1
--with-max-jobs=1
--with-system-altlinuxhyph
--with-system-boost
--with-system-cairo
--with-system-cppunit
--with-system-curl
--with-system-db
--with-system-expat
--with-system-gettext
--with-system-hunspell
--with-system-icu
--with-system-libpng
--with-system-libwpd
--with-system-libwpg
--with-system-libwps
--with-system-libxml
--with-system-libxslt
--with-system-lpsolve
--with-system-mythes
--with-system-neon
--with-system-openssl
--with-system-redland
--with-vendor=no

Generate config files
./autogen.sh
Copy the dll files
cp dbghelp.dll external/dbghelp
chmod +x external/dbghelp/dbghelp.dll
cp gdiplus.dll external/gdiplus.dll
chmod +x external/gdiplus/gdiplus.dll
Build it!
make

Take a nap. When you wake up, you should have a Windows build on your Linux computer.


Building the installer

This is still work in progress. Lanedo is working on it.