4 CROSS_DIR
=/opt
/cross
/$MINGW
6 INSTALL_DESTDIR
="$CURDIR/mono-win32"
7 PROFILES
="default net_2_0 net_3_5 net_4_0 moonlight"
8 TEMPORARY_PKG_CONFIG_DIR
=/tmp
/$RANDOM-pkg-config-$RANDOM
11 export CPPFLAGS_FOR_EGLIB CFLAGS_FOR_EGLIB CPPFLAGS_FOR_LIBGC CFLAGS_FOR_LIBGC
15 if [ -d "$TEMPORARY_PKG_CONFIG_DIR" ]; then
16 rm -rf "$TEMPORARY_PKG_CONFIG_DIR"
20 function check_pkg_config_dir
()
25 if [ ! -d "$DIR" ]; then
29 install -d -m 755 "$TEMPORARY_PKG_CONFIG_DIR"
30 for pc
in "$DIR"/*.pc
; do
32 pcname
="`basename $pc`"
33 sed -e "s;^prefix=.*;prefix=$DIR_PREFIX;g" < $pc > "$TEMPORARY_PKG_CONFIG_DIR"/$pcname
37 if [ -z "$CROSS_PKG_CONFIG_DIR" ]; then
38 CROSS_PKG_CONFIG_DIR
="$TEMPORARY_PKG_CONFIG_DIR"
42 function show_build_info
()
45 Installation prefix: $MONO_PREFIX
46 CPPFLAGS: ${CPPFLAGS:=not set}
47 LDFLAGS: ${LDFLAGS:=not set}
48 MONO_PATH: ${MONO_PATH:=not set}
56 CROSS_BIN_DIR
="$CROSS_DIR/bin"
57 CROSS_DLL_DIR
="$CROSS_DIR/bin"
58 PATH
=$CROSS_BIN_DIR:$PATH
60 MONO_VERSION
=`grep AM_INIT_AUTOMAKE configure.in | cut -d ',' -f 2|tr -d '\)'|tr -d '\('`
62 if [ -d .
/.git
]; then
63 MONO_GIT_COMMIT
="`git log -1 --format=format:%t`"
64 MONO_GIT_BRANCH
="`git branch|grep '\*'|cut -d ' ' -f 2|tr -d '\)'|tr -d '\('`"
65 MONO_RELEASE
="$MONO_VERSION-$MONO_GIT_BRANCH-$MONO_GIT_COMMIT"
67 MONO_RELEASE
="$MONO_VERSION"
70 MONO_PREFIX
="$MONO_PREFIX/mono-$MONO_RELEASE"
75 check_pkg_config_dir
"$CROSS_DIR/lib/pkgconfig" "$CROSS_DIR"
77 if [ -n "$EXTRA_CROSS_DIR" -a -d "$EXTRA_CROSS_DIR" ]; then
78 if [ -d "$EXTRA_CROSS_DIR/bin" ]; then
79 PATH
="$EXTRA_CROSS_DIR/bin":$PATH
82 check_pkg_config_dir
"$EXTRA_CROSS_DIR/lib/pkgconfig" "$EXTRA_CROSS_DIR"
84 if [ -d "$EXTRA_CROSS_DIR/include" ]; then
85 if [ -z "$CPPFLAGS" ]; then
86 CPPFLAGS
="-I \"$EXTRA_CROSS_DIR/include\""
88 CPPFLAGS
="-I \"$EXTRA_CROSS_DIR/include\" $CFLAGS"
92 if [ -d "$EXTRA_CROSS_DIR/lib" ]; then
93 if [ -z "$LDFLAGS" ]; then
94 LDFLAGS
="-I \"$EXTRA_CROSS_DIR/lib\""
96 LDFLAGS
="-I \"$EXTRA_CROSS_DIR/lib\" $LDFLAGS"
100 if [ -d "$EXTRA_CROSS_DIR/share/aclocal" ]; then
101 if [ -z "$MONO_PATH" ]; then
102 MONO_PATH
="\"$EXTRA_CROSS_DIR\""
104 MONO_PATH
="\"$EXTRA_CROSS_DIR\":$MONO_PATH"
109 export PATH MONO_PATH CPPFLAGS
115 if [ -f .
/Makefile
]; then
119 if [ -d .
/autom4te.cache
]; then
120 rm -rf .
/autom4te.cache
123 if [ -f .
/config.status
]; then
124 for f
in `find -name config.status -type f`; do
131 BUILD
="`./config.guess`"
133 if [ ! -d "$CURDIR/build-cross-windows" ]; then
134 mkdir
"$CURDIR/build-cross-windows"
137 cd "$CURDIR/build-cross-windows"
139 ..
/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
143 if [ ! -d "$CURDIR/build-cross-windows-mcs" ]; then
144 mkdir
"$CURDIR/build-cross-windows-mcs"
147 rm -rf autom4te.cache
149 PATH
="$ORIGINAL_PATH"
151 cd "$CURDIR/build-cross-windows-mcs"
153 ..
/configure
--prefix=$MONO_PREFIX --enable-parallel-mark
157 function doinstall
()
159 if [ -d "$INSTALL_DIR" ]; then
160 rm -rf "$INSTALL_DIR"
162 cd "$CURDIR/build-cross-windows"
163 make DESTDIR
="$INSTALL_DESTDIR" USE_BATCH_FILES
=yes install
165 if test -d $CURDIR/mcs
; then
168 mcsdir
=$CURDIR/..
/mcs
172 for p
in $PROFILES; do
173 make DESTDIR
="$INSTALL_DESTDIR" PROFILE
=$p install ||
echo "mcs profile $p installation failed"
177 for p
in $PROFILES; do
178 make DESTDIR
="$INSTALL_DESTDIR" PROFILE
=$p install ||
echo "class library profile $p installation failed"
182 for p
in $PROFILES; do
183 make DESTDIR
="$INSTALL_DESTDIR" PROFILE
=$p install ||
echo "tools profile $p installation failed"
186 cd "$CURDIR/mono-win32"
187 rm -f "$CURDIR/mono-win32-$MONO_RELEASE".
zip
188 zip -9r "$CURDIR/mono-win32-$MONO_RELEASE".
zip .
195 Usage: build-mingw32.sh [OPTIONS]
199 -d DIR Sets the location of directory where MINGW is installed [$CROSS_DIR]
200 -e DIR Sets the location of directory where additional cross develoment packages are installed [${EXTRA_CROSS_DIR:=none}]
201 -m MINGW Sets the MINGW target name to be passed to configure [$MINGW]
202 -p PREFIX Prefix at which Mono is to be installed. Build will append the 'mono-X.Y' string to that path
212 while getopts "d:m:e:p:" opt
; do
214 d
) CROSS_DIR
="$OPTARG" ;;
215 m
) MINGW
="$OPTARG" ;;
216 e
) EXTRA_CROSS_DIR
="$OPTARG" ;;
217 p
) MONO_PREFIX
="$OPTARG" ;;