Difference between revisions of "Building mono from source"

From LSDevLinux
Jump to: navigation, search
m (Build and install custom mono)
(Build and install custom mono: Move PATH change out of loop)
Line 11: Line 11:
  
 
== Build and install custom mono ==
 
== Build and install custom mono ==
To build the custom mono, paste in the following command:
+
To build the custom mono, paste in the following commands:
  
  $ cd ~/fwrepo/mono &&
+
  MONO_PREFIX=/usr/local
  for repo in libgdiplus mono mono-basic gtk-sharp; do
+
export PATH=/usr/lib/ccache:$MONO_PREFIX:$PATH
    cd "$repo"
 
 
   
 
   
    # use ccache
+
cd ~/fwrepo/mono &&
    export PATH=/usr/lib/ccache:/usr/local/bin:$PATH
+
for repo in libgdiplus mono mono-basic gtk-sharp; do
    MONO_PREFIX=/usr/local
+
  cd $repo
 
   
 
   
    AUTOGEN_CMD="./autogen.sh"
+
  AUTOGEN_CMD=./autogen.sh
    if [ $repo = "gtk-sharp" ]; then
+
  if [ $repo = "gtk-sharp" ]; then
      AUTOGEN_CMD="./bootstrap-2.12"
+
    AUTOGEN_CMD="./bootstrap-2.12"
    fi
+
  fi
 
   
 
   
    [ -e configure ] || NOCONFIGURE=1 $AUTOGEN_CMD
+
  [ -e configure ] || NOCONFIGURE=1 $AUTOGEN_CMD
    ./configure --prefix=$MONO_PREFIX
+
  ./configure --prefix=$MONO_PREFIX
    make
+
  make
    sudo make install
+
  sudo make install
    cd -
+
  done
+
  cd "$OLDPWD"
 +
done
 +
 
 
The installation will prompt for your sudo password to install into <code>/usr/local</code>.
 
The installation will prompt for your sudo password to install into <code>/usr/local</code>.
  

Revision as of 17:45, 28 January 2013

Dependencies

On Ubuntu or Debian Linux

$ sudo apt-get install bison mono-devel 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.

Build and install custom mono

To build the custom mono, paste in the following commands:

MONO_PREFIX=/usr/local
export PATH=/usr/lib/ccache:$MONO_PREFIX:$PATH

cd ~/fwrepo/mono && 
for repo in libgdiplus mono mono-basic gtk-sharp; do
  cd $repo

  AUTOGEN_CMD=./autogen.sh
  if [ $repo = "gtk-sharp" ]; then
    AUTOGEN_CMD="./bootstrap-2.12"
  fi

  [ -e configure ] || NOCONFIGURE=1 $AUTOGEN_CMD
  ./configure --prefix=$MONO_PREFIX
  make
  sudo make install

  cd "$OLDPWD"
done

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.

If you want to develop additional changes to mono, after the initial set-up, you can use make and make install in the appropriate subdirectory to apply them.

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:

$ cd ~/fwrepo/mono && for repo in libgdiplus mono mono-basic gtk-sharp; do
 cd $repo && git pull && ./configure --prefix=/usr/local && make && 
 sudo make install && cd -; done