|
| 1 | +#!/bin/bash -e |
| 2 | +CURDIR="`pwd`" |
| 3 | +CROSS_DIR=${1:-/opt/cross/} |
| 4 | +MINGW=${1:-i386-mingw32msvc} |
| 5 | +CROSS_BIN_DIR="$CROSS_DIR/bin" |
| 6 | +CROSS_DLL_DIR="$CROSS_DIR/$MINGW/bin" |
| 7 | +CROSS_PKG_CONFIG_DIR=$CROSS_DIR/$MINGW/lib/pkgconfig |
| 8 | +COPY_DLLS="libgio*.dll libglib*.dll libgmodule*.dll libgthread*.dll libgobject*.dll" |
| 9 | +PATH=$CROSS_BIN_DIR:$PATH |
| 10 | +INSTALL_DESTDIR="$CURDIR/mono-win32" |
| 11 | +PROFILES="default net_2_0 net_2_1 net_3_5" |
| 12 | + |
| 13 | +export PATH |
| 14 | + |
| 15 | +function setup () |
| 16 | +{ |
| 17 | + if [ -d ./.git/svn ]; then |
| 18 | + SVN_INFO='git svn info' |
| 19 | + elif [ -d ./.svn ]; then |
| 20 | + SVN_INFO='svn info' |
| 21 | + else |
| 22 | + SVN_INFO="" |
| 23 | + fi |
| 24 | + |
| 25 | + if [ -n "$SVN_INFO" ]; then |
| 26 | + MONO_SVN_REVISION=`$SVN_INFO | grep Revision | sed 's/.*: //'` |
| 27 | + MONO_BRANCH=`$SVN_INFO | grep URL | sed -e 's;.*source/;;g' -e 's;/mono;;g'` |
| 28 | + else |
| 29 | + MONO_SVN_REVISION="rUNKNOWN" |
| 30 | + MONO_BRANCH="tarball" |
| 31 | + fi |
| 32 | + |
| 33 | + MONO_VERSION=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'` |
| 34 | + MONO_RELEASE="$MONO_VERSION-$MONO_BRANCH-r$MONO_SVN_REVISION" |
| 35 | + MONO_PREFIX="/mono-$MONO_RELEASE" |
| 36 | + |
| 37 | + NOCONFIGURE=yes |
| 38 | + export NOCONFIGURE |
| 39 | + |
| 40 | + echo Mono Win32 installation prefix: $MONO_PREFIX |
| 41 | +} |
| 42 | + |
| 43 | +function build () |
| 44 | +{ |
| 45 | + ./autogen.sh |
| 46 | + |
| 47 | + if [ -f ./Makefile ]; then |
| 48 | + make distclean |
| 49 | + fi |
| 50 | + |
| 51 | + if [ ! -d "$CURDIR/build-cross-windows" ]; then |
| 52 | + mkdir "$CURDIR/build-cross-windows" |
| 53 | + fi |
| 54 | + |
| 55 | + cd "$CURDIR/build-cross-windows" |
| 56 | + rm -rf * |
| 57 | + ../configure --prefix=$MONO_PREFIX --with-crosspkgdir=$CROSS_PKG_CONFIG_DIR --target=$MINGW --host=$MINGW --enable-parallel-mark --program-transform-name="" |
| 58 | + make |
| 59 | + cd "$CURDIR" |
| 60 | + |
| 61 | + if [ ! -d "$CURDIR/build-cross-windows-mcs" ]; then |
| 62 | + mkdir "$CURDIR/build-cross-windows-mcs" |
| 63 | + fi |
| 64 | + cd "$CURDIR/build-cross-windows-mcs" |
| 65 | + rm -rf * |
| 66 | + ../configure --prefix=$MONO_PREFIX --enable-parallel-mark |
| 67 | + make |
| 68 | +} |
| 69 | + |
| 70 | +function doinstall () |
| 71 | +{ |
| 72 | + if [ -d "$INSTALL_DIR" ]; then |
| 73 | + rm -rf "$INSTALL_DIR" |
| 74 | + fi |
| 75 | + cd "$CURDIR/build-cross-windows" |
| 76 | + make DESTDIR="$INSTALL_DESTDIR" USE_BATCH_FILES=yes install |
| 77 | + |
| 78 | + cd "$CURDIR/../mcs/mcs" |
| 79 | + |
| 80 | + for p in $PROFILES; do |
| 81 | + make DESTDIR="$INSTALL_DESTDIR" PROFILE=$p install || echo "mcs profile $p installation failed" |
| 82 | + done |
| 83 | + |
| 84 | + cd "$CURDIR/../mcs/class" |
| 85 | + for p in $PROFILES; do |
| 86 | + make DESTDIR="$INSTALL_DESTDIR" PROFILE=$p install || echo "class library profile $p installation failed" |
| 87 | + done |
| 88 | + |
| 89 | + cd "$CURDIR/../mcs/tools" |
| 90 | + for p in $PROFILES; do |
| 91 | + make DESTDIR="$INSTALL_DESTDIR" PROFILE=$p install || echo "tools profile $p installation failed" |
| 92 | + done |
| 93 | + |
| 94 | + cd "$CURDIR/mono-win32" |
| 95 | + for dll in $COPY_DLLS; do |
| 96 | + cp -ap "$CROSS_DLL_DIR"/$dll "$INSTALL_DESTDIR/$MONO_PREFIX/bin" |
| 97 | + done |
| 98 | + |
| 99 | + rm -f "$CURDIR/mono-win32-$MONO_RELEASE".zip |
| 100 | + zip -9r "$CURDIR/mono-win32-$MONO_RELEASE".zip . |
| 101 | + |
| 102 | +} |
| 103 | + |
| 104 | +pushd . > /dev/null |
| 105 | + |
| 106 | +setup |
| 107 | +build |
| 108 | +doinstall |
| 109 | + |
| 110 | +popd > /dev/null |
0 commit comments