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
11 # See where we are. This will become the top level directory for the
12 # installation, unless we are given an alternative location
14 test -z "$here" && here=`pwd`
16 echo "Building Mono and dependencies in $here, installing to $here/install"
18 PATH=$here/install/bin:$here/install/lib:$PATH
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
27 # cvs checkout does the same as cvs update, except that it copes with
28 # new modules being added
30 # Older versions of cvs insist on a cvs login for :pserver: methods
31 # Make sure cvs is using ssh for :ext: methods
33 if [ ${CVSROOT:0:5} = ":ext:" ]; then
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"
43 cvs checkout mono || exit -1
45 if [ ! -z "${AUTO_STABLE}" -o -e /usr/autotool/stable ]; then
46 export AUTO_STABLE=${AUTO_STABLE:-/usr/autotool/stable}
47 export AUTO_DEVEL=${AUTO_STABLE}
50 # Need to install pkgconfig and set ACLOCAL_FLAGS if there is not a
51 # pkgconfig installed already. Otherwise set PKG_CONFIG_PATH to the
52 # glib we're about to install in $here/install. This script could
53 # attempt to be clever and see if glib 2 is already installed, too.
56 # --print-ac-dir was added in 1.2h according to the ChangeLog. This
57 # should mean that any automake new enough for us has it.
59 # This sets ACLOCAL_FLAGS to point to the freshly installed pkgconfig
60 # if it doesnt already exist on the system (otherwise auto* breaks if
61 # it finds two copies of the m4 macros). The GIMP for Windows
62 # pkgconfig sets its prefix based on the location of its binary, so we
63 # dont need PKG_CONFIG_PATH (the internal pkgconfig config file
64 # $prefix is handled similarly).
66 function aclocal_scan () {
67 # Quietly ignore the rogue '-I' and other aclocal flags that
68 # aren't actually directories...
70 # cd into mono/ so that the aclocal wrapper can work out which version
72 for i in `(cd mono && aclocal --print-ac-dir)` $ACLOCAL_FLAGS
82 function install_package() {
87 echo "Installing $name..."
88 if [ ! -f $here/$zipfile ]; then
89 wget http://www.go-mono.com/archive/$zipfile
92 # Assume that the package is installed correctly if the marker
94 if [ ! -f $here/install/$markerfile ]; then
95 (cd $here/install || exit -1; unzip -o $here/$zipfile || exit -1) || exit -1
99 if ! aclocal_scan pkg.m4 ; then
100 ACLOCAL_FLAGS="-I $here/install/share/aclocal $ACLOCAL_FLAGS"
106 # Grab pkg-config, glib etc
107 if [ ! -d $here/install ]; then
108 mkdir $here/install || exit -1
111 # Fetch and install pkg-config, glib, iconv, intl
113 install_package pkgconfig-0.80-tml-20020101.zip bin/pkg-config.exe pkgconfig
114 install_package glib-1.3.12-20020101.zip lib/libglib-1.3-12.dll glib
115 install_package glib-dev-1.3.12-20020101.zip lib/glib-1.3.lib glib-dev
116 install_package libiconv-1.7.zip lib/iconv.dll iconv
117 install_package libiconv-dev-1.7.zip lib/iconv.lib iconv-dev
118 install_package libintl-0.10.40-20020101.zip lib/libintl-1.dll intl
119 install_package libgc-dev.zip lib/gc.dll gc-dev
121 # Needed to find the libiconv bits
122 CPPFLAGS="$CPPFLAGS -I$here/install/include"
123 LDFLAGS="$LDFLAGS -L$here/install/lib"
127 # Make sure we build native w32, not cygwin
128 #CC="gcc -mno-cygwin"
131 # --prefix is used to set the class library dir in mono, and it needs
132 # to be in windows-native form. It also needs to have '\' turned into
133 # '/' to avoid quoting issues during the build.
134 prefix=`cygpath -w $here/install | sed -e 's@\\\\@/@g'`
136 # Build and install mono
137 echo "Building and installing mono"
139 (cd $here/mono; ./autogen.sh --prefix=$prefix || exit -1; make || exit -1; make install || exit -1) || exit -1
145 echo "Add $here/install/bin and $here/install/lib to \$PATH"
146 echo "Don't forget to copy the class libraries to $here/install/lib"