Build FieldWorks

From LSDevLinux
Revision as of 12:53, 23 December 2009 by Mayhewn (talk | contribs) (Set up our customized ICU: Put the user back into the top-level directory, ready for subsequent commands)

Jump to: navigation, search

These are instructions to build the currently-working parts of FieldWorks on Linux.

Check out from VCS

Make a working directory somewhere on your system and cd to it. Check out the FieldWorks and COM repositories into this directory using these commands:

$ svn co http://linux.lsdev.sil.org/svn/FieldWorks/branches/refactoring/FieldWorks
$ svn co http://linux.lsdev.sil.org/svn/COM/trunk/{COM,Win32Base,Win32More}

If you structure it differently than the above, you will need to modify the build configuration.

Unless specified otherwise, all following commands are to be executed from the FieldWorks directory that was checked out above. To go there now, immediately after executing the commands above:

$ cd FieldWorks

Install and build build dependencies

Install build dependency packages

In Ubuntu or Debian, install these dependencies:

$ sudo apt-get install build-essential tofrodos unixodbc-dev libgtkmm-2.4-dev \
  uuid-dev libmagick++9-dev mono-1.0-devel libmono-winforms1.0-cil \
  libgraphite-dev mono-gmcs libmono-winforms2.0-cil firebird2.0-dev \
  g++ automake mono-2.0-devel gawk libtool gtk-sharp2 libmono-cairo2.0-cil \
  libenchant-dev subversion xutils-dev libmono-dev xserver-xephyr metacity unzip subversion-tools

Automake 1.10 works. You may also need a Java runtime installed, e.g. openjdk-6-jre

Also if running Intrepid there is bug in the firebird package that creates an incorrect link. To fix this, sudo ln -sf libfbclient.so.2 /usr/lib/libfbclient.so

Currently, you need a very recent version of mono (2.5 or later) to be able to run FieldWorks. If your distro doesn't have this you will need to build mono from source.

Ubuntu 9.04 (Jaunty)

  • Install libmagick++-dev instead of libmagick++9-dev

Set up our customized ICU

$ source environ
$ cd Bld
Bld$ ../Bin/nant/bin/NAnt.exe iculibs
Bld$ cd ..

Create a user-specific configuration file

$ cp -p Bld/_user.mak.lnx.example Bld/_user.mak.lnx

Then optionally edit the resulting Bld/_user.mak.lnx file if you need to specify any system-specific build information.

Build (including running unit tests)

To build TE and FLEx for the first time:

$ source environ
$ make setup
$ Xephyr :2 -screen 1024x768 &
$ DISPLAY=:2 metacity &
$ DISPLAY=:2 make Unit++-package Fw

Subsequent builds should be built by doing:

$ source environ
$ cd Bld
Bld$ Xephyr :2 -screen 1024x768 &
Bld$ DISPLAY=:2 metacity &
Bld$ DISPLAY=:2 NAnt.exe build build-target

where build-target is something like TeExe, LexTextExe or SimpleRootSite-nodep.

Runtime dependencies

libdb4.5 (for Berkeley Database BEP - not in ubuntu repo http://packages.debian.org/sid/i386/libdb4.5/download)
sudo apt-get install firebird2.1-classic
sudo dpkg-reconfigure firebird2.1-classic
Click yes to have it run automatically.
Password: inscrutable
sudo adduser {PUT YOUR USERNAME HERE} firebird

Unit tests

Unit tests can be run by doing:

Bld$ NAnt.exe build-target

To run a specific test:

Bld$ export PROJ="FwCoreDlgs" # Project where test is
Bld$ export TEST="SIL.FieldWorks.FwCoreDlgs.CharContextCtrlTests.GetTokenSubstrings_NoValidator" # Test to run
Bld$ mono ../Bin/nant/bin/NAnt.exe build ${PROJ}-nodep # Optionally rebuild code being tested
Bld$ mono ../Bin/nant/bin/NAnt.exe buildtest ${PROJ}-nodep # Optionally rebuild unit test code
Bld$ mono --debug ../Bin/nant/bin/tasks/nunit-console.exe ../Output/Debug/${PROJ}Tests.dll -run=$TEST # Run specific test

To see a unit test report, run:

Bld$ NAnt.exe nunitreport
Bld$ firefox ../Output/Debug/NUnit-report.html

Run FieldWorks

$ . environ
$ cd Output/Debug

Run Translation Editor

Output/Debug$ mono TE.exe

Run Language Explorer

Output/Debug$ mono Flex.exe -db XML

Build script

You may find it helpful to sometimes use the Continuous Integration server's build script. You will want to peek at the script first to make sure it's doing what you want, and will want to comment out the line "export TE_DATABASE="TestLangProjbuilder"". To use the CI's build script:

~$ git clone git://git.lsdev.sil.org/fieldworks-build.git
~$ cd .../repository/ # go to the directory above FieldWorks
repository$ ~/fieldworks-build/agent-build-fw.sh

To get updates to the CI build script:

fieldworks-build$ git pull