#!/bin/bash # Configure script for fresh RAT code release # authored by Jared Nance at University of Washington # nancejk@phys.washington.edu #Check uname printf "%-50s" "Checking Host OS type..." HOSTOS=`uname` && printf "$HOSTOS\n" #Now check if sed is GNU or BSD, as this will be important. printf "%-50s" "Checking if sed is GNU or BSD..." #GNU sed supports a --version flag, whereas BSD sed does not. sed --version &> /dev/null if [ $? == 1 ]; then GNUSED=0 && printf "BSD\n" else GNUSED=1 && printf "GNU\n" fi #Now check if a system scons is present #We rely on the sasquatch makefile, which is better #than to assume we are the default dev branch printf "%-50s" "Checking for system scons..." SCONS=`which scons` if [ $? == 1 ] || [ "$SCONS"=="$RAT_SCONS/script/scons" ]; then printf "no, using the snocave scons\n" SCONS_BIN="$RAT_SCONS/script:" SCONS_LIB="$RAT_SCONS/engine:" else printf "installed\n" SCONS_BIN="" SCONS_LIB="" fi SYSTEM="${HOSTOS}" #OK, now we make env.sh and env.csh. printf "%-50s" "Generating env.sh..." cat > env.sh << EOF RATROOT=`pwd` PATH=\$RATROOT/bin:$SCONS_BIN\$PATH LD_LIBRARY_PATH=\$RATROOT/lib:\$LD_LIBRARY_PATH # For Mac OS X DYLD_LIBRARY_PATH=\$RATROOT/lib:\$DYLD_LIBRARY_PATH GLG4DATA=\$RATROOT/data RAT_CFLAGS="$RAT_CFLAGS" RATSYSTEM=$SYSTEM PYTHONPATH=\$RATROOT/python:$SCONS_LIB\$PYTHONPATH ROOT_INCLUDE_PATH=\$RATROOT/include:\$RATROOT/include/libpq:\$ROOT_INCLUDE_PATH export RATROOT PATH LD_LIBRARY_PATH DYLD_LIBRARY_PATH GLG4DATA RAT_CFLAGS PYTHONPATH RATSYSTEM ROOT_INCLUDE_PATH EOF [[ -e env.sh ]] && chmod +x env.sh && printf "OK\n" printf "%-50s" "Generating env.csh..." cat > env.csh << EOF #!/bin/csh setenv RATROOT `pwd` setenv PATH "\$RATROOT/bin:$SCONS_BIN\$PATH" if ({\$?LD_LIBRARY_PATH}) then setenv LD_LIBRARY_PATH "\${RATROOT}/lib:\$LD_LIBRARY_PATH" else setenv LD_LIBRARY_PATH "\${RATROOT}/lib" endif # For Mac OS X if ({\$?DYLD_LIBRARY_PATH}) then setenv DYLD_LIBRARY_PATH "\${RATROOT}/lib:\$DYLD_LIBRARY_PATH" else setenv DYLD_LIBRARY_PATH "\${RATROOT}/lib" endif setenv RATSYSTEM "$SYSTEM" if ({\$?PYTHONPATH}) then setenv PYTHONPATH "\$RATROOT/python:$SCONS_LIB\$PYTHONPATH" else setenv PYTHONPATH "$SCONS_LIB\$RATROOT/python" endif if ({\$?ROOT_INCLUDE_PATH}) then setenv ROOT_INCLUDE_PATH "\$RATROOT/include:\$RATROOT/include/libpq:\$ROOT_INCLUDE_PATH:\$ROOT_INCLUDE_PATH" else setenv ROOT_INCLUDE_PATH "\$RATROOT/include:\$RATROOT/include/libpq:\$ROOT_INCLUDE_PATH" endif setenv GLG4DATA "\$RATROOT/data" setenv RAT_CFLAGS "$RAT_CFLAGS" EOF [[ -e env.csh ]] && chmod +x env.csh && printf "OK\n" printf "%-50s" "Checking for git..." which git &> /dev/null test $? -eq 0 && printf "Installed\n" || printf "Not Installed\n" printf "%-50s" "Checking if this is a git repository..." git branch &> /dev/null test $? -eq 0 && USEGIT=1 || USEGIT=0 test $USEGIT -eq 1 && printf "yes\n" || printf "no\n" # ignore changes to src/core/Version.hh test $USEGIT -eq 1 && git update-index --assume-unchanged src/core/Version.hh #Now just spit out some information for the user about what to do next. printf "\n" printf "Configure completed. Before you try to run make, you will need to source the env.{sh,csh} file created here.\n"