#!/bin/sh

BUILDDIR=/usr/src/local/mono/1.9.1

# This is needed to pick up our built mono for commands
export PATH=/usr/local/bin:$PATH 

apt-get install -y build-essential bison gawk
apt-get install -y libglib2.0-dev
apt-get install -y libpng12-dev libx11-dev libfontconfig1-dev
apt-get install -y libfreetype6-dev libjpeg62-dev libtiff4-dev
apt-get install -y libungif4-dev libexif-dev libcairo2-dev
apt-get install -y libpango1.0-dev libgtk2.0-dev libglade2-dev
apt-get install -y libgnome2-dev libgnomecanvas2-dev libgnomeui-dev
apt-get install -y libgnomeprint2.2-dev libgnomeprintui2.2-dev
apt-get install -y libpanel-applet2-dev libgtksourceview-dev
apt-get install -y libgtkhtml3.14-dev
apt-get install -y intltool

apt-get remove 'mono-*' libgdiplus

mkdir -p $BUILDDIR
cd $BUILDDIR

wget -c http://go-mono.com/sources/libgdiplus/libgdiplus-1.9.tar.bz2
tar xvf libgdiplus-1.9.tar.bz2
cd libgdiplus-1.9
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://go-mono.com/sources/mono/mono-1.9.1.tar.bz2
tar xvf mono-1.9.1.tar.bz2
cd mono-1.9.1
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://switch.dl.sourceforge.net/sourceforge/nant/nant-0.86-beta1-src.tar.gz
tar xvf nant-0.86-beta1-src.tar.gz
cd nant-0.86-beta1
make 
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/gtk-sharp212/gtk-sharp-2.12.0.tar.bz2
tar xvf gtk-sharp-2.12.0.tar.bz2
cd gtk-sharp-2.12.0
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/gecko-sharp2/gecko-sharp-2.0-0.13.tar.bz2
tar xvf gecko-sharp-2.0-0.13.tar.bz2
cd gecko-sharp-2.0-0.13
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://go-mono.com/sources/gnome-sharp2/gnome-sharp-2.16.1.tar.gz
tar xvf gnome-sharp-2.16.1.tar.gz
cd gnome-sharp-2.16.1
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://go-mono.com/sources/gtksourceview-sharp2/gtksourceview-sharp-2.0-0.12.tar.bz2
tar xvf gtksourceview-sharp-2.0-0.12.tar.bz2
cd gtksourceview-sharp-2.0-0.12
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/gnome-desktop-sharp2/gnome-desktop-sharp-2.20.1.tar.bz2
tar xvf gnome-desktop-sharp-2.20.1.tar.bz2
cd gnome-desktop-sharp-2.20.1
./configure --prefix=/usr/local
make
make install
cd ..

cd mono-1.9.1
wget  -c http://go-mono.com/sources/monodoc/monodoc-1.9.zip
unzip monodoc-1.9.zip
cd monodoc-1.9
./configure --prefix=/usr/local
make
make install
cd ../..

wget -c http://go-mono.com/sources/mono-tools/mono-tools-1.9.tar.bz2
tar xvf mono-tools-1.9.tar.bz2
cd mono-tools-1.9
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-0.60.tar.bz2
tar xvf mono-debugger-0.60.tar.bz2
cd mono-debugger-0.60
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/heap-buddy/heap-buddy-0.2.tar.gz
tar xvf heap-buddy-0.2.tar.gz
cd heap-buddy-0.2
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/mono-addins/mono-addins-0.3.1.tar.bz2
tar xvf mono-addins-0.3.1.tar.bz2
cd mono-addins-0.3.1
./configure --prefix=/usr/local
make
make install
cd ..

wget -c http://ftp.novell.com/pub/mono/sources/monodevelop/monodevelop-1.0.tar.bz2
tar xvf monodevelop-1.0.tar.bz2
cd monodevelop-1.0
./configure --prefix=/usr/local
make
make install
cd ..
