#!/bin/bash # # Usage: $0 [--prefix=LOCATION] [--rc] [--no-jar] [--itest | --itest-nosig] config # # Note: The order of the options is important. # # --prefix=LOCATION # Installation directory. # If not specified, uses $SABLEVM_WITH_JIT_LOCATION. # If $SABLEVM_WITH_JIT_LOCATION undefined, # result to default: $SABLEVM_WITH_JIT_DEFAULT_LOCATION defined # in script. # # --rc Reconfigure and rebuild SableJIT without building SableVM. # This is useful to avoid recompiling SableVM but to be able to # switch configuration of SableJIT to another pre-compiled SableVM # # --no-jar # Do not put SableJIT files in a jar file. # (Partially implemented, you must run installdir manually # in SableJIT source directory.) # # --itest # Turns on inlinability testing # --itest-nosig # Inlinability testing without signals # # Environment variable: # Set CONFIGURE_OPTIONS to any additionnal options you want # to provide to ./configure. # # Set JUNIT_PATH to junit location. Note if in a jar must have the jar # file name included. # # SABLEJIT_WITH_JIT_LOCATION (see --prefix option) # # SABLEVM_WITH_JIT_DEFAULT_LOCATION=/usr/local SCRIPTDIR=`dirname $0` # system specific configuration if test `uname` = "FreeBSD" ; then MAKE=gmake CPPFLAGS="$CPPFLAGS -I/usr/local/include" LDFLAGS="$LDFLAGS -L/usr/local/lib" else MAKE=make fi # specific to my system if test `uname` = "Darwin" ; then CPPFLAGS="$CPPFLAGS -I/sw/include -I$HOME/local/libffi/include" LDFLAGS="$LDFLAGS -L/sw/lib -L$HOME/local/libffi/lib -L$HOME/local/lib" fi # test for --prefix= ARG1A=`echo $1 | cut -d'=' -f1` ARG1B=`echo $1 | cut -d'=' -f2` if test x$ARG1A = "x--prefix" ; then LOCATION=$ARG1B shift else if test x$SABLEVM_WITH_JIT_LOCATION = x ; then LOCATION=$SABLEVM_WITH_JIT_DEFAULT_LOCATION else LOCATION=$SABLEVM_WITH_JIT_LOCATION fi fi if test x$1 = "x--rc" ; then RECONFIG_ONLY=true shift else RECONFIG_ONLY=false fi if test x$1 = "x--no-jar" ; then SABLEJIT_LIBPATH_OPTION=--with-sablejit-libpath=LIBDIR shift else # default SABLEJIT_LIBPATH_OPTION= fi # --disable-no-reorder-blocks if test x$1 = "x--itest" ; then #ITEST_OPTIONS=--enable-inlinability-testing ITEST_OPTIONS="--enable-inlinability-testing" EXTRA_SUFFIX="$EXTRA_SUFFIX-itest" shift elif test x$1 = "x--itest-nosig" ; then ITEST_OPTIONS="--enable-inlinability-testing --disable-signals-for-exceptions" EXTRA_SUFFIX="$EXTRA_SUFFIX-itest_nosig" shift else # default ITEST_OPTIONS= fi #if test x$ITEST_OPTIONS != "x" ; then # if test if test x$JUNIT_PATH = "x" ; then JUNIT_PATH_OPTION= else JUNIT_PATH_OPTION="--with-sablejit-junit-path=$JUNIT_PATH" fi if test x`basename $0` = xbuild-debug ; then GENERAL_CONF=general-debug.conf EXTRA_SUFFIX="$EXTRA_SUFFIX-debug" elif test x`basename $0` = xbuild-nosig ; then GENERAL_CONF=general-nosig.conf EXTRA_SUFFIX="$EXTRA_SUFFIX-nosig" elif test x`basename $0` = xbuild-test ; then GENERAL_CONF=general.conf EXTRA_SUFFIX="$EXTRA_SUFFIX-test" LOCAL_JIT_CONFIGURE_OPTIONS="$LOCAL_JIT_CONFIGURE_OPTIONS --enable-sablejit-testing" else GENERAL_CONF=general.conf fi if test x$1 = x ; then echo "Specify a configuration." echo " Available configurations are:" for f in `find $SCRIPTDIR -name '*.conf'`; do echo " `basename $f .conf`" done exit 1 else CONF_NAME=$1 FILENAME=$SCRIPTDIR/$CONF_NAME.conf fi . $SCRIPTDIR/$GENERAL_CONF || exit 1 . $FILENAME || exit 1 echo "" if test x$RECONFIG_ONLY = xtrue ; then echo "Reconfiguring using configuration file:" else echo "Configuring and building SableVM using configuration file:" fi echo " $FILENAME" echo "General config file: $GENERAL_CONF" echo " CONFIGURE_OPTIONS=$CONFIGURE_OPTIONS" echo " CC=$CC" #echo " CFLAGS=\"$CFLAGS\"" echo " CPPFLAGS=\"$CPPFLAGS\"" echo " LDFLAGS=\"$LDFLAGS\"" echo "" echo " Installation directory: $LOCATION" echo "" ./configure \ --disable-errors-on-warnings \ --prefix=$LOCATION \ --program-suffix=-$CONF_NAME$EXTRA_SUFFIX \ --libdir=$LOCATION/lib/sablevm-$CONF_NAME$EXTRA_SUFFIX \ $SABLEJIT_LIBPATH_OPTION \ $JUNIT_PATH_OPTION \ $ITEST_OPTIONS \ $GLOBAL_CONFIGURE_OPTIONS \ $LOCAL_CONFIGURE_OPTIONS \ $GLOBAL_JIT_CONFIGURE_OPTIONS \ $LOCAL_JIT_CONFIGURE_OPTIONS \ $CONFIGURE_OPTIONS \ CC="$CC" \ CPPFLAGS="$CPPFLAGS $GLOBAL_CPPFLAGS $LOCAL_CPPFLAGS $GLOBAL_JIT_CPPFLAGS $LOCAL_JIT_CPPFLAGS" \ LDFLAGS="$LDFLAGS" || (echo "!!! Configure failed!!!" ; exit 1) # Not if CFLAGS is passed or set (even to empty) when configure is invoked, # SableVM segfault on inlined/ppc (and maybe on other archs) # CFLAGS="$CFLAGS" if test -e Makefile.sablejit ; then MAKE="$MAKE -f Makefile.sablejit" fi if test x$RECONFIG_ONLY != xtrue ; then ${MAKE} || (echo "!!! SableVM build failed !!!" ; exit 1) ${MAKE} install || (echo "!!! SableVM install failed !!!" ; exit 1) fi && \ ln -sf $LOCATION/lib/sablevm $LOCATION/lib/sablevm-$CONF_NAME$EXTRA_SUFFIX/sablevm || (echo !!! SableVM install failed - Unable to create link !!! ; exit 1) if test x$RECONFIG_ONLY != xtrue; then if test "x$GLOBAL_MAKE_JIT_TARGETS" != x; then ${MAKE} $GLOBAL_MAKE_JIT_TARGETS || (echo "!!! SableJIT build or installation failed !!!" ; exit 1) fi else ${MAKE} sablejit_clean sablejit_install__no_svm_rebuild || (echo "!!! SableJIT or installation failed !!!" ; exit 1) fi echo "=== sablevm-$CONF_NAME$EXTRA_SUFFIX built successfully ==="