4 CROSS_DIR=/opt/cross/$MINGW
5 INSTALL_DESTDIR="$CURDIR/mono-win32"
6 PROFILES="default net_2_0 net_3_5 net_4_0 moonlight"
7 TEMPORARY_PKG_CONFIG_DIR=/tmp/$RANDOM-pkg-config-$RANDOM
10 export CPPFLAGS_FOR_EGLIB CFLAGS_FOR_EGLIB CPPFLAGS_FOR_LIBGC CFLAGS_FOR_LIBGC
14 if [ -d "$TEMPORARY_PKG_CONFIG_DIR" ]; then
15 rm -rf "$TEMPORARY_PKG_CONFIG_DIR"
23 CROSS_BIN_DIR="$CROSS_DIR/bin"
24 CROSS_DLL_DIR="$CROSS_DIR/bin"
25 CROSS_PKG_CONFIG_DIR=$CROSS_DIR/lib/pkgconfig
26 PATH=$CROSS_BIN_DIR:$PATH
28 MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'`
30 if [ -d ./.git/svn ]; then
31 SVN_INFO='git svn info'
32 elif [ -d ./.svn ]; then
38 if [ -n "$SVN_INFO" ]; then
39 MONO_SVN_REVISION=`$SVN_INFO | grep Revision | sed 's/.*: //'`
40 MONO_BRANCH=`$SVN_INFO | grep URL | sed -e 's;.*source/;;g' -e 's;/mono;;g'`
41 MONO_RELEASE="$MONO_VERSION-$MONO_BRANCH-r$MONO_SVN_REVISION"
43 MONO_RELEASE="$MONO_VERSION"
46 MONO_PREFIX="/mono-$MONO_RELEASE"
51 if [ -d "$CROSS_PKG_CONFIG_DIR" ]; then
52 install -d -m 755 "$TEMPORARY_PKG_CONFIG_DIR"
53 for pc in "$CROSS_PKG_CONFIG_DIR"/*.pc; do
55 pcname="`basename $pc`"
56 sed -e "s;^prefix=.*;prefix=$CROSS_DIR;g" < $pc > "$TEMPORARY_PKG_CONFIG_DIR"/$pcname
59 CROSS_PKG_CONFIG_DIR="$TEMPORARY_PKG_CONFIG_DIR"
62 echo Mono Win32 installation prefix: $MONO_PREFIX
69 BUILD="`./config.guess`"
71 if [ -f ./Makefile ]; then
76 if [ ! -d "$CURDIR/build-cross-windows" ]; then
77 mkdir "$CURDIR/build-cross-windows"
80 cd "$CURDIR/build-cross-windows"
82 ../configure --prefix=$MONO_PREFIX --with-crosspkgdir=$CROSS_PKG_CONFIG_DIR --build=$BUILD --target=$MINGW --host=$MINGW --enable-parallel-mark --program-transform-name="" --with-tls=none --disable-mcs-build --disable-embed-check --enable-win32-dllmain=yes --with-libgc-threads=win32 --with-profile4=yes
86 if [ ! -d "$CURDIR/build-cross-windows-mcs" ]; then
87 mkdir "$CURDIR/build-cross-windows-mcs"
94 cd "$CURDIR/build-cross-windows-mcs"
96 ../configure --prefix=$MONO_PREFIX --enable-parallel-mark
100 function doinstall ()
102 if [ -d "$INSTALL_DIR" ]; then
103 rm -rf "$INSTALL_DIR"
105 cd "$CURDIR/build-cross-windows"
106 make DESTDIR="$INSTALL_DESTDIR" USE_BATCH_FILES=yes install
108 if test -d $CURDIR/mcs; then
111 mcsdir=$CURDIR/../mcs
115 for p in $PROFILES; do
116 make DESTDIR="$INSTALL_DESTDIR" PROFILE=$p install || echo "mcs profile $p installation failed"
120 for p in $PROFILES; do
121 make DESTDIR="$INSTALL_DESTDIR" PROFILE=$p install || echo "class library profile $p installation failed"
125 for p in $PROFILES; do
126 make DESTDIR="$INSTALL_DESTDIR" PROFILE=$p install || echo "tools profile $p installation failed"
129 cd "$CURDIR/mono-win32"
130 rm -f "$CURDIR/mono-win32-$MONO_RELEASE".zip
131 zip -9r "$CURDIR/mono-win32-$MONO_RELEASE".zip .
138 Usage: build-mingw32.sh [OPTIONS]
142 -d DIR Sets the location of directory where MINGW is installed [$CROSS_DIR]
143 -m MINGW Sets the MINGW target name to be passed to configure [$MINGW]
153 while getopts "d:m:h" opt; do
155 d) CROSS_DIR="$OPTARG" ;;
156 m) MINGW="$OPTARG" ;;