Difference between revisions of "Building mono from source"

From LSDevLinux
Jump to: navigation, search
(Build and install custom mono: Don't encourage cloning from http:// URLs, as we have standardized on git:// and it's safer if everyone uses the same thing)
(Expand and update instructions)
Line 1: Line 1:
 +
We use a custom version of mono that has a number of patches applied relative to the official, "upstream" mono releases. We have forks of the various git repos involved, and a branch named <code>develop</code> in each of these. This branch is based on an official upstream release with additional commits for each of our patches.
 +
 
== Dependencies ==
 
== Dependencies ==
 +
 
=== On Ubuntu or Debian Linux ===
 
=== On Ubuntu or Debian Linux ===
 +
 
  $ sudo apt-get install gnulib mono-devel mono-mcs libgif-dev libjpeg-dev libtiff4-dev libexif-dev git quilt
 
  $ sudo apt-get install gnulib mono-devel mono-mcs libgif-dev libjpeg-dev libtiff4-dev libexif-dev git quilt
  
 
And of course to build the package you'll also need:
 
And of course to build the package you'll also need:
 +
 
  $ sudo apt-get install devscripts cdbs
 
  $ sudo apt-get install devscripts cdbs
  
 
=== On Mac ===
 
=== On Mac ===
 +
 
  $ sudo port install bison mono giflib git-core quilt
 
  $ sudo port install bison mono giflib git-core quilt
 +
 
''Note:'' <code>port</code> is the MacPorts package management command. For further information, see [[Build FieldWorks for Mac]].
 
''Note:'' <code>port</code> is the MacPorts package management command. For further information, see [[Build FieldWorks for Mac]].
  
== Build and install custom mono ==
+
== Check out sources ==
Building the custom mono is now done with the <code>BuildOptMono.sh</code> script in <code><nowiki>git://github.com/sillsdev/mono-calgary.git</nowiki></code>
+
 
 +
You'll need clones of a number of git repositories. The recommended directory layout is to have a single parent directory called <code>mono-sil</code> with the clones as subdirectories:
  
JohnT: That is: clone the mono-calgary repo from the url above, typically in fwrepo/mono. (For the paths below to work without modification, mono-calgary must be a child of fwrepo/mono.)
+
* mono-sil
 +
** gtk-sharp
 +
** libgdiplus
 +
** mono
 +
** mono-basic
 +
** mono-calgary
  
JohnT: Then, cd to fwrepo/mono and run mono-calgary/BuildOptMono.sh.
+
The directory and clones can be created using the following commands:
  
JohnT: If there are problems it may help to cd to fwrepo/mono/mono and make clean (don't worry if that gives errors), then git clean -dxf. Then cd back to fwrepo/mono and try again.
+
mkdir mono-sil
 +
cd mono-sil
 +
for R in gtk-sharp libgdiplus mono mono-basic mono-calgary; do
 +
    git clone git@github:sillsdev/$R.git
 +
 
 +
The <code>mono</code> repository is fairly large, so this will take a while, especially on slower internet connections.
 +
 
 +
== Build and install ==
 +
 
 +
Building mono is done with the <code>BuildOptMono.sh</code> script in <code>mono-calgary</code>. Ensure you are in the <code>mono-sil</code> directory, and then run:
 +
 
 +
mono-calgary/BuildOptMono.sh
 +
 
 +
This uses the <code>sudo</code> command internally (to gain permission to install to <code>/opt/mono-sil</code>) and so will ask for your password at various points.
 +
 
 +
If there are build problems it may help to "clean" the <code>mono</code> subdirectory:
 +
 
 +
(cd mono && git clean -dxf)
  
 
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 <code>application.exe</code>) will still use <code>/usr/bin/mono</code> unless you reconfigure it.
 
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 <code>application.exe</code>) will still use <code>/usr/bin/mono</code> unless you reconfigure it.
  
==Register in GAC==
+
== Updating ==
Since you are installing mono into <code>/usr/local</code>, you will need to register some <code>/usr/lib/mono</code> assemblies into the <code>/usr/local/lib/mono</code> 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:
+
Updating is done by pulling the latest changes in each repo and rebuilding. From the <code>mono-sil</code> directory:
  
Failure adding assembly /usr/lib/mono/gac/glib-sharp/*/*-sharp.dll to the cache: The system cannot find the file specified.
+
for R in gtk-sharp libgdiplus mono mono-basic mono-calgary; do
 +
    (cd $R && git pull)
 +
done
 +
mono-calgary/BuildOptMono.sh
  
==Update custom mono==
 
<ol>
 
  <li>Update and rebuild mono:</li>
 
<nowiki>for repo in libgdiplus mono mono-basic gtk-sharp mono-calgary; do
 
cd ~/fwrepo/mono/$repo && git pull; done
 
cd ~/fwrepo/mono && mono-calgary/BuildOptMono.sh</nowiki>
 
</ol>
 
 
[[Category:Building(FieldWorks)]]
 
[[Category:Building(FieldWorks)]]
 
[[Category:Mono]]
 
[[Category:Mono]]

Revision as of 13:34, 9 February 2015

We use a custom version of mono that has a number of patches applied relative to the official, "upstream" mono releases. We have forks of the various git repos involved, and a branch named develop in each of these. This branch is based on an official upstream release with additional commits for each of our patches.

Dependencies

On Ubuntu or Debian Linux

$ sudo apt-get install gnulib mono-devel mono-mcs libgif-dev libjpeg-dev libtiff4-dev libexif-dev git quilt

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.

Check out sources

You'll need clones of a number of git repositories. The recommended directory layout is to have a single parent directory called mono-sil with the clones as subdirectories:

  • mono-sil
    • gtk-sharp
    • libgdiplus
    • mono
    • mono-basic
    • mono-calgary

The directory and clones can be created using the following commands:

mkdir mono-sil
cd mono-sil
for R in gtk-sharp libgdiplus mono mono-basic mono-calgary; do
    git clone git@github:sillsdev/$R.git

The mono repository is fairly large, so this will take a while, especially on slower internet connections.

Build and install

Building mono is done with the BuildOptMono.sh script in mono-calgary. Ensure you are in the mono-sil directory, and then run:

mono-calgary/BuildOptMono.sh

This uses the sudo command internally (to gain permission to install to /opt/mono-sil) and so will ask for your password at various points.

If there are build problems it may help to "clean" the mono subdirectory:

(cd mono && git clean -dxf)

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.

Updating

Updating is done by pulling the latest changes in each repo and rebuilding. From the mono-sil directory:

for R in gtk-sharp libgdiplus mono mono-basic mono-calgary; do
    (cd $R && git pull)
done
mono-calgary/BuildOptMono.sh