Class-status is an autogenerated file, remove
[mono.git] / web / mono-build.sh
1 #!/bin/bash
2
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).
8
9
10 # See where we are.  This will become the top level directory for the
11 # installation, unless we are given an alternative location
12 here=$1
13 test -z "$here" && here=`pwd`
14
15 echo "Building Mono and dependencies in $here, installing to $here/install"
16
17 PATH=$here/install/bin:$PATH
18 LD_LIBRARY_PATH=$here/install/lib:$LD_LIBRARY_PATH
19
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.
24
25
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
29     install_pkgconfig=no
30     PKG_CONFIG_PATH="$here/install/lib/pkgconfig"
31 else
32     install_pkgconfig=yes
33     ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
34 fi
35
36
37 export PATH
38 export LD_LIBRARY_PATH
39 export ACLOCAL_FLAGS
40 export PKG_CONFIG_PATH
41
42 # Grab pkg-config-0.8, glib-1.3.12 if necessary
43
44 # If any more dependencies are added, it would be worth encapsulating
45 # the configure; make; make install part in a shell function
46
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
51     fi
52
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)
58         success=$?
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"
61             exit -1
62         fi
63     fi
64 else
65     echo "Not installing pkgconfig, you already seem to have it installed"
66 fi
67
68
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
72 fi
73
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)
79     success=$?
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"
82         exit -1
83     fi
84 fi
85
86 # End of build dependencies, now get the latest mono checkout and build that
87
88 test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
89 export CVSROOT
90
91 echo "Updating mono"
92
93 # cvs checkout does the same as cvs update, except that it copes with
94 # new modules being added
95
96 # Older versions of cvs insist on a cvs login for :pserver: methods
97 # Make sure cvs is using ssh for :ext: methods
98
99 if [ ${CVSROOT:0:5} = ":ext:" ]; then
100     CVS_RSH=ssh
101     export CVS_RSH
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"
105         cvs login
106     fi
107 fi
108
109 cvs checkout mono || exit -1
110
111 # Build and install mono
112 echo "Building and installing mono"
113
114 (cd $here/mono; ./autogen.sh --prefix=$here/install || exit -1; make || exit -1; make install || exit -1) || exit -1
115
116
117 echo ""
118 echo ""
119 echo "All done."
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"
123