Merge remote branch 'upstream/master'
[mono.git] / nacl / nacl-runtime-mono.sh
1 #!/bin/bash
2 # Copyright (c) 2009 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that be
4 # found in the LICENSE file.
5 #
6
7 # nacl-runtime-mono.sh
8 #
9 # usage:  nacl-runtime-mono.sh
10 #
11 # this script builds mono runtime for Native Client 
12 #
13
14 readonly MONO_TRUNK_NACL=$(pwd)
15
16 source common.sh
17 source nacl-common.sh
18
19 readonly PACKAGE_NAME=runtime${TARGET_BIT_PREFIX}-build
20 readonly INSTALL_PATH=${MONO_TRUNK_NACL}/runtime${TARGET_BIT_PREFIX}
21
22
23 CustomConfigureStep() {
24   Banner "Configuring ${PACKAGE_NAME}"
25   # export the nacl tools
26   set +e
27   if [ -f ${PACKAGE_NAME}/Makefile ]
28   then
29     cd ${PACKAGE_NAME}
30   fi
31   make distclean
32   cd ${MONO_TRUNK_NACL}
33   set -e
34   cp config-nacl-runtime${TARGET_BIT_PREFIX}.cache config-nacl-runtime${TARGET_BIT_PREFIX}.cache.temp
35   Remove ${PACKAGE_NAME}
36   MakeDir ${PACKAGE_NAME}
37   cd ${PACKAGE_NAME}
38   # TODO: remove this once libintl.h becomes available to nacl
39   CC=${NACLCC} CXX=${NACLCXX} AR=${NACLAR} RANLIB=${NACLRANLIB} PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig \
40   PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} PATH=${NACL_BIN_PATH}:${PATH} LIBS="-lnosys -lg" \
41   CFLAGS="-g -D_POSIX_PATH_MAX=256 -DPATH_MAX=256" ../../configure \
42     --host=nacl${TARGET_BIT_PREFIX} \
43     --exec-prefix=${INSTALL_PATH} \
44     --libdir=${INSTALL_PATH}/lib \
45     --prefix=${INSTALL_PATH} \
46     --oldincludedir=${MONO_TRUNK_NACL}/runtime/include \
47     --disable-shared \
48     --disable-mcs-build \
49     --with-glib=embedded \
50     --with-tls=pthread \
51     --enable-threads=posix \
52     --without-sigaltstack \
53     --without-mmap \
54     --with-gc=included \
55     --enable-nacl-gc \
56     --enable-nacl-codegen \
57     --cache-file=../config-nacl-runtime${TARGET_BIT_PREFIX}.cache.temp
58   echo "// --- Native Client runtime below" >> config.h
59   echo "#define pthread_cleanup_push(x, y)" >> config.h
60   echo "#define pthread_cleanup_pop(x)" >> config.h
61   echo "#undef HAVE_EPOLL" >> config.h
62   echo "#undef HAVE_WORKING_SIGALTSTACK" >> config.h
63   echo "extern long int timezone;" >> config.h
64   echo "extern int daylight;" >> config.h
65   echo "#define sem_trywait(x) sem_wait(x)" >> config.h
66   echo "#define sem_timedwait(x,y) sem_wait(x)" >> config.h
67   echo "#define getdtablesize() (32768)" >> config.h
68   echo "// --- Native Client runtime below" >> eglib/src/eglib-config.h
69   echo "#undef G_BREAKPOINT" >> eglib/src/eglib-config.h
70   echo "#define G_BREAKPOINT() G_STMT_START { __asm__ (\"hlt\"); } G_STMT_END" >> eglib/src/eglib-config.h
71   rm ../config-nacl-runtime${TARGET_BIT_PREFIX}.cache.temp
72 }
73
74 CustomInstallStep() {
75   make install
76   CopyNormalMonoLibs
77 }
78
79 CustomPackageInstall() {
80   CustomConfigureStep
81   DefaultBuildStep
82   CustomInstallStep
83 }
84
85
86 CustomPackageInstall
87 exit 0