forked from koush/androidmono
-
Notifications
You must be signed in to change notification settings - Fork 1
/
get-mono.sh
executable file
·107 lines (96 loc) · 2.4 KB
/
get-mono.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
function checkresult
{
RESULT=`echo $?`
if [ "$RESULT" != 0 ]; then
echo $1
exit $RESULT
fi
}
if [ -z "$1" ]
then
echo No local mono directory supplied. Cloning mono from Github. This may take a while...
echo You can provide a local mono checkout using: $0 \<path-to-mono-git-repository\>
MONO_GIT=git://github.com/mono/mono.git
else
MONO_GIT=$1/.git
fi
echo =====CHECKING OUT MONO FROM $MONO_GIT=====
MONO_GIT_CHECKOUT=origin/master
echo $MONO_GIT_CHECKOUT
ROOT_DIR=$(basename $0)
pushd $(dirname $0)
echo
echo =====CHECKING OUT MONO=====
if [ -d MonoActivity/jni/mono ]
then
echo =====UPDATING EXISTING MONO CHECKOUT=====
echo =====If you get errors, you may want to delete mono and hostbuild to force a clean build=====
pushd MonoActivity/jni/mono
MONO_SKIP_PATCH=true
git fetch origin
git checkout $MONO_GIT_CHECKOUT
popd
checkresult 'Error while updating ./mono'
pushd hostbuild/mono
git fetch origin
git checkout $MONO_GIT_CHECKOUT
popd
checkresult 'Error while updating ./hostbuild/mono'
else
pushd MonoActivity/jni
git clone $MONO_GIT mono
git checkout $MONO_GIT_CHECKOUT
popd
rm -rf hostbuild
mkdir -p hostbuild
pushd hostbuild
git clone $MONO_GIT mono
pushd mono
git checkout $MONO_GIT_CHECKOUT
popd
popd
fi
echo
echo =====COMPILING MONO CLASS LIBRARIES FOR MCS BUILD=====
sleep 2
export CC=$(which gcc-4.0)
export CXX=$(which g++-4.0)
#pushd ../hostbuild/mono/eglib
#if [ ! -f configure ]
#then
# ./autogen.sh --prefix=$ROOT_DIR/hostbuild/install
#fi
#popd
mkdir -p hostbuild/install
pushd hostbuild/install
INSTALL_PREFIX=$(pwd)
echo INSTALL_PREFIX=$INSTALL_PREFIX
popd
pushd hostbuild/mono
UNAME=$(uname -a | grep Darwin | grep x86_64)
if [ ! -z "$UNAME" ]
then
echo Using gcc-4.0 on Darwin x86_64!
export CC=gcc-4.0
fi
if [ ! -f configure ]
then
echo Running configure...
./autogen.sh --with-glib=embedded --with-moonlight=no --prefix=$INSTALL_PREFIX --with-monodroid=yes
fi
make && make install
popd
if [ ! -f MonoActivity/jni/mono.patch ]
then
echo =====NO LOCAL MONO PATCH FOUND=====
MONO_SKIP_PATCH=true
fi
if [ -z $MONO_SKIP_PATCH ]
then
pushd MonoActivity/jni/mono
echo
echo =====APPLYING ANDROID PATCHES FOR ARM BUILD=====
git apply ../mono.patch
popd
fi
echo "=====Done! Don't forget Rebuild the ARM build using the Android NDK now!====="