2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
9 if [[ $# -ne 3 ]]; then
10 echo "Usage: $0 [path_to_mono] [build_dir] [install_dir]"
14 readonly MONO_DIR
=$
(readlink
-f $1)
15 readonly BUILD_DIR
=$
(readlink
-f $2)
16 readonly INSTALL_DIR
=$
(readlink
-f $3)
17 readonly ORIGINAL_CWD
=$
(pwd)
20 if [ -f ${BUILD_DIR}/Makefile
]; then
27 case "${TARGET_ARCH}" in
30 readonly NACL_CROSS_PREFIX_DASH
=i686-nacl-
31 readonly CONFIG_OPTS
="--host=i686-pc-linux-gnu \
32 --build=i686-pc-linux-gnu \
33 --target=i686-pc-linux-gnu"
35 readonly CUSTOM_CFLAGS
=""
36 readonly CUSTOM_LDFLAGS
=""
40 readonly NACL_CROSS_PREFIX_DASH
=x86_64-nacl-
41 readonly CONFIG_OPTS
="--host=x86_64-pc-linux-gnu \
42 --build=x86_64-pc-linux-gnu \
43 --target=x86_64-pc-linux-gnu"
45 readonly CUSTOM_CFLAGS
=""
46 readonly CUSTOM_LDFLAGS
=""
50 readonly NACL_CROSS_PREFIX_DASH
=pnacl-
51 readonly PNACL_LINK_ARGS
="-arch armv7 -O2"
52 readonly CONFIG_OPTS
="--host=armv7l-unknown-linux-gnueabi \
53 --build=x86_64-pc-linux-gnu \
54 --target=armv7l-unknown-linux-gnueabi"
55 readonly LIBDIR
=libarm
56 # TODO(olonho): move it to Mono's configure, once nacl target implemented.
57 readonly CUSTOM_CFLAGS
="\
60 -D__portable_native_client__ \
62 -Dtimezone=_timezone \
67 readonly CUSTOM_LDFLAGS
=${PNACL_LINK_ARGS}
71 # UGLY hack to allow dynamic linking
72 sed -i -e s
/elf_i386
/elf_nacl
/ -e s
/elf_x86_64
/elf64_nacl
/ \
74 sed -i -e s
/elf_i386
/elf_nacl
/ -e s
/elf_x86_64
/elf64_nacl
/ \
75 ${MONO_DIR}/libgc
/configure
76 sed -i -e s
/elf_i386
/elf_nacl
/ -e s
/elf_x86_64
/elf64_nacl
/ \
77 ${MONO_DIR}/eglib
/configure
83 mkdir
-p ${INSTALL_DIR}
85 if [ ${USE_PNACL} == 1 ]; then
86 readonly NACL_BIN_PATH
="\
87 ${NACL_SDK_ROOT}/toolchain/linux_x86_pnacl/newlib/bin"
88 readonly NACLCC
=${NACL_BIN_PATH}/pnacl-clang
89 readonly NACLCXX
=${NACL_BIN_PATH}/pnacl-clang
++
91 readonly NACL_BIN_PATH
=${NACL_SDK_ROOT}/toolchain
/linux_x86_glibc
/bin
92 readonly NACLCC
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}gcc
93 readonly NACLCXX
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}g
++
95 readonly NACLAR
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ar
96 readonly NACLRANLIB
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ranlib
97 readonly NACLLD
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ld
98 readonly NACLOBJDUMP
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}objdump
99 readonly NACLSTRIP
=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}strip
101 CFLAGS
="-g -O2 -D_POSIX_PATH_MAX=256 -DPATH_MAX=256 $CUSTOM_CFLAGS"
102 LDFLAGS
="$CUSTOM_LDFLAGS"
103 LIBS
="-lnacl_dyncode -lc -lg -lnosys -lpthread"
105 CC
=${NACLCC} CXX=${NACLCXX} LD=${NACLLD} \
106 STRIP
=${NACLSTRIP} AR=${NACLAR} RANLIB=${NACLRANLIB} OBJDUMP=${NACLOBJDUMP} \
108 PATH
=${NACL_BIN_PATH}:${PATH} \
111 LDFLAGS
="${LDFLAGS}" \
112 ${MONO_DIR}/configure
${CONFIG_OPTS} \
113 --exec-prefix=${INSTALL_DIR} \
114 --libdir=${INSTALL_DIR}/${LIBDIR} \
115 --prefix=${INSTALL_DIR} \
116 --program-prefix=${NACL_CROSS_PREFIX_DASH} \
117 --oldincludedir=${INSTALL_DIR}/include \
118 --with-glib=embedded \
120 --enable-threads=posix \
121 --without-sigaltstack \
127 --enable-nacl-codegen \
128 --disable-system-aot \
130 --disable-parallel-mark \
131 --with-static-mono=no