aesthetic changes
[mono.git] / web / mono-build-w32.sh
1 #!/bin/bash
2
3 # Script to automate the building of mono and its dependencies on
4 # cygwin.  Relies on wget being installed (could make it fall back to
5 # using lynx, links, w3, curl etc), assumes that gcc, make, tar,
6 # automake, etc are already installed too (may be worth testing for
7 # all that right at the top and bailing out if missing/too old/too new
8 # etc).
9
10
11 # See where we are.  This will become the top level directory for the
12 # installation, unless we are given an alternative location
13 here=$1
14 test -z "$here" && here=`pwd`
15
16 echo "Building Mono and dependencies in $here, installing to $here/install"
17
18 PATH=$here/install/bin:$here/install/lib:$PATH
19
20 # Check mono out first, so we can run aclocal from inside the mono dir (it
21 # needs to see which version of the real aclocal to run)
22 test -z "$CVSROOT" && CVSROOT=:pserver:anonymous@anoncvs.go-mono.com:/mono
23 export CVSROOT
24
25 echo "Updating mono"
26
27 # cvs checkout does the same as cvs update, except that it copes with
28 # new modules being added
29
30 # Older versions of cvs insist on a cvs login for :pserver: methods
31 # Make sure cvs is using ssh for :ext: methods
32
33 if [ ${CVSROOT:0:5} = ":ext:" ]; then
34     CVS_RSH=ssh
35     export CVS_RSH
36 elif [ ${CVSROOT:0:9} = ":pserver:" ]; then
37     if ! grep $CVSROOT ~/.cvspass > /dev/null 2>&1 ; then
38         echo "Logging into CVS server.  Anonymous CVS password is probably empty"
39         cvs login || exit -1
40     fi
41 fi
42
43 cvs checkout mono || exit -1
44
45 # Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
46 # pkgconfig installed already.  Otherwise set PKG_CONFIG_PATH to the
47 # glib we're about to install in $here/install.  This script could
48 # attempt to be clever and see if glib 2 is already installed, too.
49
50
51 # --print-ac-dir was added in 1.2h according to the ChangeLog.  This
52 # should mean that any automake new enough for us has it.
53
54 # This sets ACLOCAL_FLAGS to point to the freshly installed pkgconfig
55 # if it doesnt already exist on the system (otherwise auto* breaks if
56 # it finds two copies of the m4 macros).  The GIMP for Windows
57 # pkgconfig sets its prefix based on the location of its binary, so we
58 # dont need PKG_CONFIG_PATH (the internal pkgconfig config file
59 # $prefix is handled similarly).
60
61 if [ ! -f `(cd mono; aclocal --print-ac-dir)`/pkg.m4 ]; then
62     ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
63 fi
64
65 export PATH
66 export ACLOCAL_FLAGS
67
68 # Grab pkg-config, glib etc
69 if [ ! -d $here/install ]; then
70     mkdir $here/install || exit -1
71
72     # Fetch and install pkg-config, glib, iconv, intl
73     for i in pkgconfig-0.80-tml-20020101.zip glib-1.3.12-20020101.zip glib-dev-1.3.12-20020101.zip libiconv-1.7.zip libiconv-dev-1.7.zip libintl-0.10.40-20020101.zip
74     do
75         wget http://www.go-mono.org/archive/$i
76         (cd $here/install || exit -1; unzip -o ../$i || exit -1) || exit -1
77     done
78 fi
79
80 # Needed to find the libiconv bits
81 CPPFLAGS="-I$here/install/include"
82 LDFLAGS="-L$here/install/lib"
83 export CPPFLAGS
84 export LDFLAGS
85
86 # Make sure we build native w32, not cygwin
87 CC="gcc -mno-cygwin"
88 export CC
89
90 # --prefix is used to set the class library dir in mono, and it needs
91 # to be in windows-native form.  It also needs to have '\' turned into
92 # '/' to avoid quoting issues during the build.
93 prefix=`cygpath -w $here/install | sed -e 's@\\\\@/@g'`
94
95 # Build and install mono
96 echo "Building and installing mono"
97
98 (cd $here/mono; ./autogen.sh --prefix=$prefix || exit -1; make || exit -1; make install || exit -1) || exit -1
99
100
101 echo ""
102 echo ""
103 echo "All done."
104 echo "Add $here/install/bin and $here/install/lib to \$PATH"
105 echo "Don't forget to copy the class libraries to $here/install/lib"
106