Building mono from source

From LSDevLinux
Revision as of 13:36, 29 May 2012 by Mayhewn (talk | contribs) (Add to the Mono category)

Jump to: navigation, search

Dependencies

On Linux

$ sudo apt-get install bison mono-devel libgif-dev git-core quilt libtool automake build-essential 
libgtkmm-2.4-dev mono-gmcs

The packages list the following additional dependencies:

$ sudo apt-get install gawk libxt-dev libjpeg62-dev libtiff4-dev libexif-dev cli-common-dev

(For this step trying it on Precise I had a conflict. libtiff4-dev depends on libjpeg-dev but this will conflict with libjpeg62-dev.)

And of course to build the package you'll also need:

$ sudo apt-get install devscripts cdbs

On Mac

$ sudo port install bison mono giflib git-core quilt

Note: port is the MacPorts package management command. For further information, see Build FieldWorks for Mac.

Get, patch, build, install mono

To build the custom mono, do these steps:

$ git clone git://git.lsdev.sil.org/mono-calgary.git
$ cd mono-calgary
mono-calgary$ ./checkout-and-build-mono

The script will check out the mono sources from the upstream git repo, patch them, build and install mono. The installation will prompt for your sudo password to install into /usr/local.

To ensure the use of the custom version of mono in /usr/local when you run applications, make sure /usr/local/bin is in your PATH before /usr/bin is, or (better) use /usr/local/bin/mono application.exe whenever you run an application. On most Linux distros, /usr/local/bin is already included in your PATH. You can check to see what your current PATH is by typing:

$ echo $PATH

Note that the Linux binfmt system that allows you to execute interpreted programs without specifying the interpreter on the command line (eg by typing just application.exe) will still use /usr/bin/mono unless you reconfigure it.

Warning: The checkout-and-build-mono script runs git reset --hard and git clean -dxf in the mono etc. subdirectories, so if you make any of your own changes to the those trees, they will be lost.

If you want to develop additional changes to mono, after the initial set-up, use make and make install in the appropriate subdirectory rather than the checkout-and-build-mono script. If you then want to add these changes to the mono-calgary repository, first check them into a topic branch in the subdirectory. Then use git format-patch to create new patch(es) in the corresponding patch directory (../debian/patches) and register them in the series file.

Register in GAC

Since you are installing mono into /usr/local, you will need to register some /usr/lib/mono assemblies into the /usr/local/lib/mono GAC.

$ for assembly in /usr/lib/mono/gac/{glib,pango,atk,gtk,gdk}-sharp/*/*-sharp.dll; \
    do sudo gacutil -i $assembly; done

Trying to do this step in Precise gave me errors and did not register anything. An example error is:

Failure adding assembly /usr/lib/mono/gac/glib-sharp/*/*-sharp.dll to the cache: The system cannot find the file specified.

Update custom mono

To get the latest custom mono:

mono-calgary$ git pull
mono-calgary$ ./checkout-and-build-mono