3 # Script to automate the building of mono and its dependencies.
4 # Relies on wget being installed (could make it fall back to using
5 # lynx, links, w3, curl etc), assumes that gcc, make, tar, automake,
6 # etc are already installed too (may be worth testing for all that
7 # right at the top and bailing out if missing/too old/too new etc).
10 # See where we are. This will become the top level directory for the
11 # installation, unless we are given an alternative location
13 test -z "$here" && here=`pwd`
15 echo "Building Mono and dependencies in $here, installing to $here/install"
17 PATH=$here/install/bin:$PATH
18 LD_LIBRARY_PATH=$here/install/lib:$LD_LIBRARY_PATH
20 # Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
21 # pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
22 # glib we're about to install in $here/install. This script could
23 # attempt to be clever and see if glib 2 is already installed, too.
26 # --print-ac-dir was added in 1.2h according to the ChangeLog. This
27 # should mean that any automake new enough for us has it.
28 if [ -f `aclocal --print-ac-dir`/pkg.m4 ]; then
30 PKG_CONFIG_PATH="$here/install/lib/pkgconfig"
33 ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
38 export LD_LIBRARY_PATH
40 export PKG_CONFIG_PATH
42 # Grab pkg-config-0.8, glib-1.3.12 if necessary
44 # If any more dependencies are added, it would be worth encapsulating
45 # the configure; make; make install part in a shell function
47 if [ $install_pkgconfig = "yes" ]; then
48 echo "Installing pkgconfig..."
49 if [ ! -f $here/pkgconfig-0.8.0.tar.gz ]; then
50 wget --timestamping http://www.go-mono.org/archive/pkgconfig-0.8.0.tar.gz
53 # Assume that pkgconfig built correctly if the dir is there
54 if [ ! -d $here/pkgconfig-0.8.0 ]; then
55 # Build and install pkg-config
56 tar xzf $here/pkgconfig-0.8.0.tar.gz || exit -1
57 (cd $here/pkgconfig-0.8.0; ./configure --prefix=$here/install || exit -1; make || exit -1; make install || exit -1)
59 if [ $success -ne 0 ]; then
60 echo "***** pkgconfig build failure. Run rm -rf $here/pkgconfig-0.8.0 to have this script attempt to build pkgconfig again next time"
65 echo "Not installing pkgconfig, you already seem to have it installed"
69 echo "Installing glib..."
70 if [ ! -f $here/glib-1.3.13.tar.gz ]; then
71 wget --timestamping http://www.go-mono.org/archive/glib-1.3.13.tar.gz
74 # Assume that glib built correctly if the dir is there
75 if [ ! -d $here/glib-1.3.13 ]; then
76 # Build and install glib
77 tar xzf $here/glib-1.3.13.tar.gz || exit -1
78 (cd $here/glib-1.3.13; ./configure --prefix=$here/install || exit -1; make || exit -1; make install || exit -1)
80 if [ $success -ne 0 ]; then
81 echo "***** glib build failure. Run rm -rf $here/glib-1.3.13 to have this script attempt to build glib again next time"
86 # End of build dependencies, now get the latest mono checkout and build that
88 test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
93 # cvs checkout does the same as cvs update, except that it copes with
94 # new modules being added
96 # Older versions of cvs insist on a cvs login for :pserver: methods
97 # Make sure cvs is using ssh for :ext: methods
99 if [ ${CVSROOT:0:5} = ":ext:" ]; then
102 elif [ ${CVSROOT:0:9} = ":pserver:" ]; then
103 if ! grep $CVSROOT ~/.cvspass > /dev/null 2>&1 ; then
104 echo "Logging into CVS server. Anonymous CVS password is probably empty"
109 cvs checkout mono || exit -1
111 # Build and install mono
112 echo "Building and installing mono"
114 (cd $here/mono; ./autogen.sh --prefix=$here/install || exit -1; make || exit -1; make install || exit -1) || exit -1
120 echo "Add $here/install/bin to \$PATH"
121 echo "Add $here/install/lib to \$LD_LIBRARY_PATH"
122 echo "Don't forget to copy the class libraries to $here/install/lib"