August 2, 2008

BSD#: Mono on FreeBSD

Categories: FreeBSD, Mono.

A few weeks ago, I joined the BSD# project which aim to maintain Mono (an open source implementation of the Microsoft .NET framework) on FreeBSD. It was the occasion for giving svk a try.

svk is a decentralised version control system based on Subversion. It acts as a staging area between the repository and your local copy, making synchronisations and merges easy.

Preparing repositories

A tricky thing with mono is that it is likely to blow-up in your face each time you change the framework version. Hence, I decided to build ports with different mono versions to see which one is the best for production use.

In order to work with different versions of mono, I created as many working copies of the ports tree as needed. This was achieved this way:

$ svk mirror http://bsd-sharp.googlecode.com/svn/trunk //mirror/bsd-sharp
$ svk sync -a
$ svk copy //mirror/bsd-sharp //local/bsd-sharp
$ svk checkout //local/bsd-sharp bsd-sharp-latest
$ svk checkout //local/bsd-sharp bsd-sharp-mono-126

The bsd-sharp-latest directory will contain the latest mono version available (1.9.1 at the time of writing), while the bsd-sharp-mono-126 directory will hold mono at version 1.2.6.

Setting-up a Tinderbox

I already mentioned the tinderbox package building system. I will not detail here the complete setup of a tinderbox, please refer to the README file provided in the tarball for detailed instructions.

Creating Ports Trees

The first ports tree to create is an official ports tree, in sync with FreeBSD ports:

# cd ${pb}/scripts
# ./tc createPortsTree -p FreeBSD -d "FreeBSD ports tree" \
  -w http://www.freebsd.org/cgi/cvsweb.cgi/ports/

Each BSD# ports tree is then created using an user (i.e. custom) update script that merge local copies of the BSD# repository in the FreeBSD ports tree:

# cd ${pb}/scripts
# mkdir ../portstrees/BSD-sharp-latest
# ln -s /home/romain/BSD-sharp-update.sh ../portstrees/BSD-sharp-latest/update.sh
# ./tc createPortsTree -p BSD-sharp-latest -u USER

DRY with Hooks

The main problem with this setup is that all ports that do not depends on mono will still be compiled for each build and therefore we will lose a lot of time compiling the same software packages.

This can however be avoided using a post-port-build hook that copy successfully created packages of software pieces not depending on mono to other builds' package directory and update those ports status in the data-store:

# cd ${pb}/scripts
# ./tc updateHookCmd -h postPortBuild -c /home/romain/postPortBuild

Tinderbuild

The environment is ready! You can start playing:

# cd ${pb}/scripts
# ./tinderd

The tinderbox I setup is IPv6 only accessible at http://eddy.sigabrt.org (Not always up).

No Comments Yet

Comments RSS feed | Leave a Reply…

top