[msvc] Update csproj files (#4395)
[mono.git] / nacl / nacl-runtime-mono.sh
index 51e09447156dd65e18b86c3c5381671f66f02e85..d93bb97546375ed1cafb2444c42d312480d7314e 100755 (executable)
 readonly MONO_TRUNK_NACL=$(pwd)
 
 source common.sh
-source nacl-common.sh
 
 readonly PACKAGE_NAME=runtime${TARGET_BIT_PREFIX}-build
-readonly INSTALL_PATH=${MONO_TRUNK_NACL}/runtime${TARGET_BIT_PREFIX}
+readonly INSTALL_PATH=${MONO_TRUNK_NACL}/naclmono-${CROSS_ID}
 
 
 CustomConfigureStep() {
@@ -31,21 +30,27 @@ CustomConfigureStep() {
   make distclean
   cd ${MONO_TRUNK_NACL}
   set -e
-  cp config-nacl-runtime.cache config-nacl-runtime.cache.temp
+  if [ $TARGET_BITSIZE == "32" ]; then
+    CONFIG_OPTS="--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu"
+  else
+    CONFIG_OPTS="--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu"
+  fi
+  # UGLY hack to allow dynamic linking
+  sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../configure
+  sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../libgc/configure
+  sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../eglib/configure
   Remove ${PACKAGE_NAME}
   MakeDir ${PACKAGE_NAME}
   cd ${PACKAGE_NAME}
-  # TODO: remove this once libintl.h becomes available to nacl
-  CC=${NACLCC} CXX=${NACLCXX} AR=${NACLAR} RANLIB=${NACLRANLIB} PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig \
-  PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} PATH=${NACL_BIN_PATH}:${PATH} LIBS="-lnosys -lg" \
-  CFLAGS="-g -D_POSIX_PATH_MAX=256 -DPATH_MAX=256" ../../configure \
-    --host=nacl${TARGET_BIT_PREFIX} \
-    --disable-shared \
+  CC=${NACLCC} CXX=${NACLCXX} AR=${NACLAR} RANLIB=${NACLRANLIB} PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig LD="${NACLLD}" \
+  PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} PATH=${NACL_BIN_PATH}:${PATH} LIBS="-lnacl_dyncode -lc -lg -lnosys -lnacl" \
+  CFLAGS="-g -O2 -D_POSIX_PATH_MAX=256 -DPATH_MAX=256" ../../configure \
+    ${CONFIG_OPTS} \
     --exec-prefix=${INSTALL_PATH} \
     --libdir=${INSTALL_PATH}/lib \
     --prefix=${INSTALL_PATH} \
-    --oldincludedir=${MONO_TRUNK_NACL}/runtime/include \
-    --disable-mcs-build \
+    --program-prefix="" \
+    --oldincludedir=${INSTALL_PATH}/include \
     --with-glib=embedded \
     --with-tls=pthread \
     --enable-threads=posix \
@@ -53,28 +58,18 @@ CustomConfigureStep() {
     --without-mmap \
     --with-gc=included \
     --enable-nacl-gc \
+    --with-sgen=no \
+    --enable-nls=no \
     --enable-nacl-codegen \
-    --cache-file=../config-nacl-runtime.cache.temp
-  echo "// --- Native Client runtime below" >> config.h
-  echo "#define pthread_cleanup_push(x, y)" >> config.h
-  echo "#define pthread_cleanup_pop(x)" >> config.h
-  echo "#define DISABLE_SOCKETS 1" >> config.h
-  echo "#undef HAVE_EPOLL" >> config.h
-  echo "#undef HAVE_WORKING_SIGALTSTACK" >> config.h
-  echo "extern long int timezone;" >> config.h
-  echo "extern int daylight;" >> config.h
-  echo "#define sem_trywait(x) sem_wait(x)" >> config.h
-  echo "#define sem_timedwait(x,y) sem_wait(x)" >> config.h
-  echo "#define getdtablesize() (32768)" >> config.h
-  echo "// --- Native Client runtime below" >> eglib/src/eglib-config.h
-  echo "#undef G_BREAKPOINT" >> eglib/src/eglib-config.h
-  echo "#define G_BREAKPOINT() G_STMT_START { __asm__ (\"hlt\"); } G_STMT_END" >> eglib/src/eglib-config.h
-  rm ../config-nacl-runtime.cache.temp
+    --disable-system-aot \
+    --enable-shared \
+    --disable-parallel-mark \
+    --with-static-mono=no
+
 }
 
 CustomInstallStep() {
   make install
-  CopyNormalMonoLibs
 }
 
 CustomPackageInstall() {
@@ -83,6 +78,5 @@ CustomPackageInstall() {
   CustomInstallStep
 }
 
-
 CustomPackageInstall
 exit 0