EnvironmentSetup/HaikuOS

From Wiki.ooo4kids.org
Jump to: navigation, search

Full build process last tested with OOo4Kids r1522 and Haiku gcc2hybrid hrev44528 in August 2012.

Contents

Prerequisites

  • A recent Haiku nightly build from http://haiku-files.org/ (release >= r39101 should be ok). A gcc2hybrid is better as it is the official flavor. It is also what i use. Unfortunately, Haiku alpha 2 ( http://www.haiku-os.org/get-haiku) has bugs that prevent a full build of OOo4kids.
  • About 15 Go of free disk space on the Haiku partition
  • Lots of computer time : the full build process will take many hours (depending on your hardware)
  • Other tools :
    • haikuporter system for some more tools (see http://ports.haiku-files.org/wiki)
    • Archive-Zip-1.30
    • gperf
    • pkg-config-0.23-haiku-2.zip
    • freetype-2.3.10-r1a1-x86-gcc2-2009-10-09.zip
    • fontconfig-2.6.0-gcc2-2008-12-19.zip
    • ccache-2.4
    • gengetopt-2.22.4
    • getopt

Fully automated setup and build process (well, almost ;-)

Warning

This process assume a clean default Haiku partition (one that has just been installed).

This process use some hacks and workaround that change the system (especially in the following directories) :

* /boot/common/bin
* /boot/common/include/unicode
* /boot/common/include/layout
* /boot/home/config/bin

This might break others applications on existing partitions...

Commented script

# Preparing the source tree

# run this from a /boot/src directory (for example)

mkdir ooo4kids

cd ooo4kids

# install svn
installoptionalpackage subversion

# get the source tree 

svn co svn://svn.adullact.net/svnroot/ooo4kids1/trunk .

# could take more than one hour... Be patient

cd ..

# install Haikuporter

wget http://ports.haiku-files.org/svn/haikuporter/trunk/installhaikuporter.sh
chmod 755 installhaikuporter.sh
./installhaikuporter.sh

# get dependencies

ooo4kids/solenv/inc/startup/HAIKU/scripts/getHaikuDependencies.sh

# two crash while compiling ICU... Need more investigation...
# just enter the debugger and write "continue" in it
# We only need those binaries :
#  - genbrk 
#  - genccode
#  - gencmn

cd ooo4kids

# configure OOo4Kids

./configure --with-use-shell-bash --disable-odk --disable-mozilla --disable-binfilter --with-OOo4Kids \
            --with-java=no --disable-gtk --disable-randr-link --disable-gconf --disable-gnome-vfs \
            --with-system-libxml --with-system-icu --with-system-openssl --with-system-python \
            --with-system-curl --with-system-neon

# We need to compile dmake ourself to pass right commands and support Haiku.
            
cp /boot/common/data/automake-1.11/config.guess dmake
cp /boot/common/data/automake-1.11/config.sub dmake

cd dmake

./autogen.sh
./configure --prefix=/boot/common
make install
cd ..

./bootstrap

ln -s $PWD/solenv/bin/mkout.pl /boot/home/config/bin
ln -s $PWD/solenv/bin/zipdep.pl /boot/home/config/bin 
ln -s $PWD/solenv/bin/build.pl /boot/home/config/bin 
ln -s $PWD/solenv/bin/deliver.pl /boot/home/config/bin 
ln -s $PWD/solenv/bin/modules /boot/home/config/bin 

# needed because i have hardcoded the path in solenv/bin/build.pl to run commands
ln -s /boot/common/bin/dmake $PWD/solenv/bin

solenv/inc/startup/HAIKU/scripts/full_build.sh

# Outputstream problems
# see http://lists.freedesktop.org/archives/libreoffice-commits/2011-January/005750.html

# Proposed patch (don't forget to remove "#") :

#Index: comphelper/inc/comphelper/oslfile2streamwrap.hxx
#===================================================================
#--- comphelper/inc/comphelper/oslfile2streamwrap.hxx	(revision 1517)
#+++ comphelper/inc/comphelper/oslfile2streamwrap.hxx	(working copy)
#@@ -91,8 +91,6 @@
# 	OSLOutputStreamWrapper(::osl::File& _rFile) :rFile(_rFile) { }
# 
# // UNO Anbindung
#-	virtual void			SAL_CALL acquire() throw()
#-		{ OutputStreamWrapper_Base::acquire(); }
# 	virtual void			SAL_CALL release() throw()
# 		{ OutputStreamWrapper_Base::release(); }
# 	virtual ::com::sun::star::uno::Any	SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException)
#Index: unotools/inc/unotools/streamwrap.hxx
#===================================================================
#--- unotools/inc/unotools/streamwrap.hxx	(revision 1517)
#+++ unotools/inc/unotools/streamwrap.hxx	(working copy)
#@@ -124,9 +124,6 @@
# public:
# 	OOutputStreamWrapper(SvStream& _rStream) :rStream(_rStream) { }
# 
#-// UNO Anbindung
#-	DECLARE_UNO3_AGG_DEFAULTS(OOutputStreamWrapper, OutputStreamWrapper_Base);
#-
# // stario::XOutputStream
# 	virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
# 	virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);


# All compiled (except this problem in package system)

#ERROR: Saved logfile: /boot/src/ooo4kids/instsetoo_native/haiku.pro/OOo4Kids/installed/logging/en-US/log_O4K131_en-US.log
#**************************************************
#Thu Aug 16 11:03:57 2012 (17:14 min.)
#dmake:  Error code 255, while making 'openoffice_en-US.installed'

#ERROR: Error 65280 occurred while making /boot/src/ooo4kids/instsetoo_native/util
#rmdir /tmp/fvSzzs0Cne

Manual setup and build process

Getting subversion

As Haiku has switched to git for his own use, subversion is no more included by default on a fresh setup.

You can install it using this command :

installoptionalpackage subversion

Getting sources

svn co svn://svn.adullact.net/svnroot/ooo4kids1/trunk OOo4Kids

Please do not checkout a revision between 1217 and 1250 (included), because the build was broken in meantime in sysui, hunspell, and lingucomponent (ask ericb2 on IRC for further information)

Setup prerequisites (by hands)

Don't forget to set gcc 4 as the default compiler using this command

setgcc gcc4
  • gperf :
    • run "installoptionalpackage -a gperf" from a Terminal. It will install the latest version compiled from http://haiku-files.org/
  • libcurl :
    • run "installoptionalpackage curl" on a Terminal
    • you should add a symlink to "/boot/common/lib/curl.so" in "/boot/develop/abi/x86/gcc4/lib". It allow linking at compile time.
  • libxml : available by default
  • libxslt :
    • run "installoptionalpackage libxslt" on a Terminal
  • gettext :
    • run "installoptionalpackage gettext" on a Terminal (needed to compile hunspell)
  • libneon :
    • run "installoptionalpackage neon" on a Terminal
  • icu : Haiku contains icu built-in, but development tools and headers are not included. We will use haikuporter to get and build a complete version. But, you should not use the install option as the built version might be different from the system one. I will investigate this later. In the meantime, it is safer to install the necessary tools and headers "by hand" :
    • copy genbrk, genccode and gencmn from /boot/develop/haikuports/dev-libs/icu/work/icu/source/bin to /boot/common/bin
    • copy /boot/common/develop/haikuports/dev-libs/icu/work/icu/source/common/unicode to /boot/common/include/
    • copy /boot/common/develop/haikuports/dev-libs/icu/work/icu/source/i18n/unicode to /boot/common/include
    • create a layout directory in /boot/common/include
    • copy LayoutEngine.h, LEFontInstance.h, LEScripts.h, LETypes.h from /boot/common/develop/haikuports/dev-libs/icu/work/icu/source/layout/ in /boot/common/include/layout
    • link libicudata.so, libicuuc.so, libicui18n.so, libicule.so from /boot/system/lib/gcc4/ in /boot/develop/abi/x86/gcc4/lib
  • file : Install the file command. Latest sources at http://www.darwinsys.com/file/ should compile out of the box using the usual commands :
    • ./configure --prefix=/boot/common
    • make
    • make install
  • python
    • link libpython2.6.so in /boot/common/lib/ in /boot/develop/abi/x86/gcc4/lib to enable linking with this library using gcc 4.

With the above dependencies installed, you should be able to run the configure script

Setup prerequisites (with a script)

A script can do all steps above in one shot. This script is now located in the source tree (https://adullact.net/scm/viewvc.php/trunk/solenv/inc/startup/HAIKU/scripts/?root=ooo4kids1).

This script need an installed Haikuporter system. You can get the needed files using those commands :

wget http://ports.haiku-files.org/svn/haikuporter/trunk/installhaikuporter.sh
chmod 755 installhaikuporter.sh
./installhaikuporter.sh

See http://ports.haiku-files.org/wiki for details.

You can now get and setup all dependencies using this command from the parent directory of root directory of the source tree (to avoid messing it) :

ooo4kids/solenv/inc/startup/HAIKU/scripts/getHaikuDependencies.sh

Configure the build system

It may be necessary to run autoconf at the root of the source repository until the next configure rebuild.

 ./configure --with-use-shell-bash --disable-odk --disable-mozilla --disable-binfilter --with-OOo4Kids --with-java=no \
             --disable-gtk --disable-randr-link --disable-gconf --disable-gnome-vfs --with-system-libxml \
             --with-system-icu --with-system-openssl --with-system-python --with-system-curl \
             --with-system-neon

(in one line !)

Bootstrapping

  • Update config.guess and config.sub in the dmake subdirectory with ones from Haiku (/boot/common/share/automake-1.11/).
  • Run "./autogen.sh" in the dmake subdirectory to update configure script.
  • Run "./configure --prefix=/boot/common"
  • Run "make install"
  • Run "./bootstrap" from the root directory of the source tree.

Workaround

I suppose there is a bug (or at least a different behavior under Haiku) regarding alias handling in the system() call (see http://dev.haiku-os.org/ticket/7922).

It prevent build.pl to run some aliased commands out of the box.

First, i prefix $job_to_do with the complete path to the solenv/bin directory.

Index: bin/build.pl
===================================================================
--- bin/build.pl	(revision 1239)
+++ bin/build.pl	(working copy)
@@ -1768,7 +1768,8 @@
             system("cat $log_file");
         };
     } else {
-        $error_code = system ("$job_to_do");
+    	# Haiku workaround
+        $error_code = system ("/boot/src/OOo4Kids/OOo4Kids/solenv/bin/$job_to_do");
     };
     return $error_code;
 };

Then, i create a symlink to solenv/bin/mkout.pl, solenv/bin/zipdel.pl, solenv/bin/build.pl and solenv/bin/deliver.pl in /boot/home/config/bin/. A link to solenv/bin/modules is also needed to run build.pl and zipdel.pl (please, FIX ME !).

Due to the hardcoded path, you will have to add dmake in solenv/bin so build.pl could launch it.

Building OOo4Kids

  • run "source HaikuX86Env.Set.sh" to setup the build environment at the root of OOo4Kids source tree
  • run "export LIBRARY_PATH=$LIBRARY_PATH:/boot/src/OOo4Kids/OOo4Kids/solver/1.30/haiku.pro/lib:\

/boot/src/OOo4Kids/OOo4Kids/cppu/haiku.pro/lib:/boot/src/OOo4Kids/OOo4Kids/sax/haiku.pro/lib" to fix linking with some libraries during the build (Haiku use some non standard places by default)

  • run "make"

The build should start and stop on the next error to fix

To be continued...

VCL Development

Fortunately, it is not necessary to do a full build after each improvement in the Haiku part of the VCL. In fact, the turnaround time is quite fast. The VCL come with some demo applications that expose enough features to test the port.

The most complete one is in svtools/workben. A build script for Haiku is available in solenv/inc/startup/HAIKU/scripts. This script is called build_workben.sh.

The application need access to VCL libraries. The easiest way to do this under Haiku at the moment is to symlink solver/1.31/haiku.pro/lib in a lib directory in svtools/haiku.pro/bin/

To run the application, go to the svtools/haiku.pro/bin directory and then run ./svdem.

It might be necessary to copy some VCL files in this directory from vcl/haiku.pro/bin :

  • vclen-US.res. It might be necessary to rename it to vclen.res depending on your Haiku version (i need to fully understand the reason to fix this).
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox