Skip to content

Commit 5d11607

Browse files
committed
2008-08-05 Marek Habersack <[email protected]>
* configure.in: added support for cross-compilation 2008-08-05 Marek Habersack <[email protected]> * build-mingw32.sh: added a script to build Mono for Windows on a Linux host using mingw. 2008-08-05 Marek Habersack <[email protected]> * scripts/Makefile.am: added support for cross-compilation, including .bat generation for windows targets. 2008-08-05 Marek Habersack <[email protected]> * scripts/smcs.bat.in, scripts/script.bat.in, scripts/script_umask.bat.in: added .bat templates. 2008-08-05 Marek Habersack <[email protected]> * runtime/Makefile.am: mingw cross-compilation support. 2008-08-05 Marek Habersack <[email protected]> * Makefile.am (GENMDESC_PRG): when cross-compiling use full path to the genmdesc.pl file 2008-08-05 Marek Habersack <[email protected]> * Makefile.am: added support for cross-compilation svn path=/trunk/mono/; revision=109671
1 parent 115fc06 commit 5d11607

File tree

12 files changed

+280
-89
lines changed

12 files changed

+280
-89
lines changed

ChangeLog

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2008-08-05 Marek Habersack <[email protected]>
2+
3+
* configure.in: added support for cross-compilation
4+
5+
2008-08-05 Marek Habersack <[email protected]>
6+
7+
* build-mingw32.sh: added a script to build Mono for Windows on a
8+
Linux host using mingw.
9+
10+
2008-08-05 Marek Habersack <[email protected]>
11+
12+
* scripts/Makefile.am: added support for cross-compilation,
13+
including .bat generation for windows targets.
14+
15+
2008-08-05 Marek Habersack <[email protected]>
16+
17+
* scripts/smcs.bat.in, scripts/script.bat.in,
18+
scripts/script_umask.bat.in: added .bat templates.
19+
20+
2008-08-05 Marek Habersack <[email protected]>
21+
22+
* runtime/Makefile.am: mingw cross-compilation support.
23+
124
2008-08-05 Andreas Färber <[email protected]>
225

326
* autogen.sh: Suppress arguments warning for NOCONFIGURE.

build-mingw32.sh

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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

configure.in

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ case "$host" in
7878
HOST_CC="gcc"
7979
# Windows 2000 is required that includes Internet Explorer 5.01
8080
CPPFLAGS="$CPPFLAGS -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024"
81-
libmono_cflags="-mno-cygwin"
82-
libmono_ldflags="-mno-cygwin"
81+
libmono_cflags="-mno-cygwin -mms-bitfields -mwindows"
82+
libmono_ldflags="-mno-cygwin -mms-bitfields -mwindows"
8383
libdl=
8484
libgc_threads=win32
8585
gc_default=included
@@ -296,6 +296,7 @@ AC_SUBST(HOST_CC)
296296
AC_SUBST(BUILD_EXEEXT)
297297

298298
AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
299+
AM_CONDITIONAL(USE_BATCH_FILES, [test x$platform_win32 = xyes -a x$cross_compiling = xyes])
299300

300301
# Set STDC_HEADERS
301302
AC_HEADER_STDC
@@ -494,9 +495,13 @@ embedded)
494495
AC_CONFIG_SUBDIRS(eglib)
495496
;;
496497
system)
498+
pkg_config_path="$PKG_CONFIG_PATH"
499+
unset PKG_CONFIG_PATH
497500
BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
498501
BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
499-
502+
PKG_CONFIG_PATH=$pkg_config_path
503+
export PKG_CONFIG_PATH
504+
500505
## Versions of dependencies
501506
GLIB_REQUIRED_VERSION=1.3.11
502507

@@ -2188,7 +2193,11 @@ AC_SUBST(mono_runtime)
21882193

21892194
mono_cfg_root=$mono_build_root/runtime
21902195
if test x$platform_win32 = xyes; then
2191-
mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
2196+
if test "x$cross_compiling" = "xno"; then
2197+
mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
2198+
else
2199+
mono_cfg_dir=`echo $mono_cfg_root | tr '/' '\\\'`\\etc
2200+
fi
21922201
else
21932202
mono_cfg_dir=$mono_cfg_root/etc
21942203
fi

mono/metadata/ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2008-08-05 Marek Habersack <[email protected]>
2+
3+
* Makefile.am: added support for cross-compilation
4+
15
2008-08-04 Zoltan Varga <[email protected]>
26

37
* socket-io.c (get_socket_assembly): Make 'moonlight' variable static.

mono/metadata/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ if PLATFORM_WIN32
22
# Use -m here. This will use / as directory separator (C:/WINNT).
33
# The files that use MONO_ASSEMBLIES and/or MONO_CFG_DIR replace the
44
# / by \ if running under WIN32.
5+
if CROSS_COMPILING
6+
assembliesdir = ${libdir}
7+
confdir = ${sysconfdir}
8+
else
59
assembliesdir = `cygpath -m "${libdir}"`
610
confdir = `cygpath -m "${sysconfdir}"`
11+
endif
712
export HOST_CC
813
# The mingw math.h has "extern inline" functions that dont appear in libs, so
914
# optimisation is required to actually inline them

mono/mini/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2008-08-05 Marek Habersack <[email protected]>
2+
3+
* Makefile.am (GENMDESC_PRG): when cross-compiling use full path
4+
to the genmdesc.pl file
5+
16
2008-08-05 Zoltan Varga <[email protected]>
27

38
* ir-emit.h (EMIT_NEW_ARGSTORE): Fix the usage of param_types and

mono/mini/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ generics-variant-types.dll: generics-variant-types.il
416416
# $(arch_define) is the preprocessor symbol that enables all the opcodes
417417
# for the specific platform in mini-ops.h
418418
if CROSS_COMPILING
419-
GENMDESC_PRG=perl genmdesc.pl $(arch_define) $(srcdir)
419+
GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir)
420420
else !CROSS_COMPILING
421421
GENMDESC_PRG=./genmdesc
422422
endif !CROSS_COMPILING

runtime/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,13 @@ mcs-do-run-test-profiles: test-support-files
7575
cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' run-test-profiles
7676

7777
if PLATFORM_WIN32
78+
if CROSS_COMPILING
79+
cur_dir_cmd = pwd
80+
PLATFORM_PATH_SEPARATOR = :
81+
else
7882
cur_dir_cmd = cygpath -w -a .
7983
PLATFORM_PATH_SEPARATOR = ;
84+
endif
8085
else
8186
cur_dir_cmd = pwd
8287
PLATFORM_PATH_SEPARATOR = :

0 commit comments

Comments
 (0)