From 0ffa1e1153ac32040683fc61394fb32e8c6b04c6 Mon Sep 17 00:00:00 2001 From: Florian Uhlig Date: Thu, 9 Oct 2014 16:14:21 +0200 Subject: [PATCH] Add scripst to install FairRoot, AliRoot, and DDS. These three packages are not installed when running configure.sh. If one want to install these packages one has to use the script alfaconfig.sh which will call configure.sh and will afterwards install the new packages. Add configuration option for ALFA which is needed for some error and debug output. The new stuff is documented in README.md. --- README.md | 18 ++++- alfaconfig.sh | 25 +++++++ configure.sh | 42 +++++++++++- scripts/check_system.sh | 15 +++++ scripts/functions.sh | 127 ++++++++++++++++++++++++++++++++++++ scripts/install_DDS.sh | 30 +++++++++ scripts/install_aliroot.sh | 37 +++++++++++ scripts/install_fairroot.sh | 33 ++++++++++ scripts/package_versions.sh | 10 +++ tools/rootconfig.sh | 10 ++- 10 files changed, 343 insertions(+), 4 deletions(-) create mode 100755 alfaconfig.sh create mode 100644 scripts/install_DDS.sh create mode 100644 scripts/install_aliroot.sh create mode 100644 scripts/install_fairroot.sh diff --git a/README.md b/README.md index 50fc942ef..7ed760dc1 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ run a simulation. If unsure choose _Yes_. If the previous choice was _Yes_ one has to define in the next menu how to handle the Geant4 data files. These files have after installation a size of approximately 650 MB. -If you don't intent to use Geant4 you shoule choose _Don't install_, if unsure choose +If you don't intent to use Geant4 you should choose _Don't install_, if unsure choose one of the other options described below. If the data files should be installed it is normally save to choose the @@ -103,7 +103,21 @@ directory of FairSoft. * ZeroMQ 3.2.4 * Protocoll Buffers 2.5.0 * Nano Message 0.4-beta -Packages included: + +##Installation of ALFA (Alice-FAIR software) + +The ALFA installation will install the FairSoft as above and after that it will install +three more packages: + +* FairRoot +* DDS +* AliRoot + + FairSoft> ./alfaconfig.sh + +The script will get the source code of all the packages from there own repostories, +compile and install tme. The versions and the urls of the different repostories used +are specified in the file "scripts/package_versions.sh" diff --git a/alfaconfig.sh b/alfaconfig.sh new file mode 100755 index 000000000..64ba1a53e --- /dev/null +++ b/alfaconfig.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# +# AlFa package installation script +# m.al-turany@gsi.de, Sept. 2014 + +install_alfasoft=yes +##################### FairSoft############################################# +source configure.sh + +##################### FairRoot############################################# +if [ "$check" = "1" ]; +then +source scripts/install_fairroot.sh +fi +##################### DDS ############################################# +if [ "$check" = "1" ]; +then +source scripts/install_DDS.sh +fi +##################### AliRoot ############################################# +if [ "$check" = "1" ]; +then +source scripts/install_aliroot.sh +fi + diff --git a/configure.sh b/configure.sh index 363d9280b..9b9fa9ac9 100755 --- a/configure.sh +++ b/configure.sh @@ -104,6 +104,41 @@ then onlyreco=1 fi +#echo $installation_type + +#if [ "$installation_type" = "custom" ] +#then +# echo "Custom mode" +#elif [ "$installation_type" = "automatic" ] +#then +# compiler= +# if [ "$compiler" = "" ]; then +# echo "*** Edit the configure.sh script and add the compiler in line 112." +# echo "*** The following error is due to the undefinded compiler." +# exit 1 +# fi +#elif [ "$installation_type" = "grid" ] +#then +#elif [ "$installation_type" = "onlyreco" ] +#then +# compiler= +# if [ "$compiler" = "" ]; then +# echo "*** Edit the configure.sh script and add the compiler in line 140." +# echo "*** The following error is due to the undefinded compiler." +# exit 1 +# fi +#else +# echo "Parameter given to the script is not known." +# echo "Call the script either with no parameter, then your are guided through the installation procedure," +# echo "or with one parameter which defines the installation type." +# echo "The supported installation types are:" +# echo " - automatic" +# echo " - custom" +# echo " - grid" +# echo " - onlyreco" +# exit 42 +#fi + if [ "$installation_type" = "grid" ]; then export BUILD_BATCH=TRUE @@ -332,7 +367,12 @@ then echo "During the installation a new version of CMake has been installed in $SIMPATH_INSTALL/bin." echo "Please add this path to your environment variable PATH to use this new version of CMake." fi - exit 0 + if [ "$install_alfasoft" = "yes" ]; + then + echo "----------------- End of FairSoft installation ---------------" + else + exit 0 + fi else echo "*** End installation of external packages with Errors***" | tee -a $logfile exit 42 diff --git a/scripts/check_system.sh b/scripts/check_system.sh index f2b006e96..ef109f614 100644 --- a/scripts/check_system.sh +++ b/scripts/check_system.sh @@ -380,6 +380,14 @@ if [ "$result" = "0" ]; then exit 1 fi +if [ "$install_alfasoft" = "yes" ]; +then + echo "----------------- Install AlFaSoft ---------------" +else + echo "----------------- Install FairSoft ---------------" +fi + + mkdir -p $SIMPATH/test/build cd $SIMPATH/test @@ -406,6 +414,7 @@ hascxx11=$(grep HasCxx11 $SIMPATH/test/configure | cut -f2 -d:) haslibcxx=$(grep HasLibCxx $SIMPATH/test/configure | cut -f2 -d:) _hascurl=$(grep HasCurl $SIMPATH/test/configure | cut -f2 -d:) + if [ ${_hascurl} ]; then install_curl=no @@ -419,6 +428,12 @@ if [ $hascxx11 ]; then export CXXFLAGS="${CXXFLAGS} -std=c++11" export build_cpp11=yes +else + if [ "$install_alfasoft" = "yes" ]; + then + echo "AlFaSoft require C++11, please install a compiler that support C++11 " + exit + fi fi if [ $haslibcxx ]; diff --git a/scripts/functions.sh b/scripts/functions.sh index 57d418567..954365af2 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -278,6 +278,120 @@ check_yes_no() { fi } +#_____________________________________________________________________ +# The function checks if all needed variables are defined in the input file and +# if only valid values and value combinations are present in the input file. +function check_variables { + + if [ "$compiler" = "" ]; then + echo "*** The compiler definition is not set in the input file." + echo "*** Please add the compiler definition in the input file." + echo "*** e.g.: compiler=gcc" + echo "*** possible values are gcc, Clang, intel" # CC, PGI + exit 1 + else + if [ ! "$compiler" = "gcc" -a ! "$compiler" = "Clang" -a ! "$compiler" = "intel" ]; then + echo "*** The compiler definition $compiler is not known." + echo "*** possible values are gcc, Clang, intel" # CC, PGI + echo "*** Please correct the compiler definition in the input file." + echo "*** e.g.: compiler=gcc" + exit 1 + fi + fi + if [ "$debug" = "" ]; then + echo "*** The debug definition is not set in the input file." + echo "*** Please add the debug definition in the input file." + echo "*** e.g.: debug=no or debug=yes" + exit 1 + else + check_yes_no debug + fi + if [ "$optimize" = "" ]; then + echo "*** The optimize definition is not set in the input file." + echo "*** Please add the optimize definition in the input file." + echo "*** e.g.: optimize=no or optimize=yes" + exit 1 + else + check_yes_no optimize + fi + if [ "$geant4_download_install_data_automatic" = "" ]; then + echo "*** It is not defined in the input file if the geant4 data should be downloaded automatically." + echo "*** Please add the missing definition in the input file." + echo "*** e.g.: geant4_download_install_data_automatic=[no/yes]" + exit 1 + else + check_yes_no geant4_download_install_data_automatic + fi + if [ "$geant4_install_data_from_dir" = "" ]; then + echo "*** It is not defined in the input file if the geant4 data should be installed from the directory." + echo "*** Please add the missing definition in the input file." + echo "*** e.g.: geant4_install_data_from_dir=[no/yes]" + exit 1 + else + check_yes_no geant4_install_data_from_dir + fi + if [ "$build_python" = "" ]; then + echo "*** It is not defined in the input file if the python bindings should be installed." + echo "*** Please add the missing definition in the input file." + echo "*** e.g.: build_python=[no/yes]" + exit 1 + else + check_yes_no build_python + fi + if [ "$install_sim" = "" ]; then + echo "*** It is not defined in the input file if all tools for simulation should be installed." + echo "*** Please add the missing definition in the input file." + echo "*** e.g.: install_sim=[no/yes]" + exit 1 + else + check_yes_no install_sim + fi + if [ "$SIMPATH_INSTALL" = "" ]; then + echo "*** No installation directory is defined in the input file." + echo "*** Please add the missing definition in the input file." + echo "*** e.g.: SIMPATH_INSTALL=" + exit 1 + else + # expand variables, which could be in the filepath. + # A example is if $PWD is in the path + eval SIMPATH_INSTALL=$SIMPATH_INSTALL + #check if the user can write to the installation path + mkdir -p $SIMPATH_INSTALL + if [ $? -ne 0 ]; then + echo "Cannot write to the installation directory $SIMPATH_INSTALL." + exit 1 + fi + fi + if [ "$debug" = "yes" -a "$optimize" = "yes" ]; then + echo "*** The variables \"debug\" and \"otimize\" can't be set both to \"yes\" at the" + echo "*** same time. All other combinations yes/no, no/no, and no/yes are valid." + echo "*** Please change the definitions in the input file." + exit 1 + fi + if [ "$geant4_download_install_data_automatic" = "yes" -a "$geant4_install_data_from_dir" = "yes" ]; then + echo "*** The variables \"geant4_download_install_data_automatic\" and" + echo "*** \"geant4_install_data_from_dir\" can't be set both to \"yes\" at the" + echo "*** same time. All other combinations yes/no, no/no, and no/yes are valid." + echo "*** Please change the definitions in the input file." + exit 1 + fi + +} + +#_____________________________________________________________________ +# The function checks if the varibale has either yes or no as value. +# In case any other value is given the script stops with an error message. +check_yes_no() { + variable=$1 + eval value=\$$1 #eval forces update of $a which is set to the value of $1 + if [ ! "$value" = "yes" -a ! "$value" = "no" ]; then + echo "*** For the variable $variable only yes or no are allowed." + echo "*** Please correct the definition of \"$variable=$value\" in the input file." + echo "*** e.g.: $variable=no or $variable=yes" + exit 1 + fi +} + #_____________________________________________________________________ function is_in_path { # This function checks if a file exists in the $PATH. @@ -340,6 +454,19 @@ function generate_config_cache { echo platform=$platform >> $cache_file } +#_____________________________________________________________________ +function generate_config_cache { + echo compiler=$compiler > $cache_file + echo debug=$debug >> $cache_file + echo optimize=$optimize >> $cache_file + echo geant4_download_install_data_automatic=$geant4_download_install_data_automatic >> $cache_file + echo geant4_install_data_from_dir=$geant4_install_data_from_dir >> $cache_file + echo build_python=$build_python >> $cache_file + echo install_sim=$install_sim >> $cache_file + echo SIMPATH_INSTALL=$SIMPATH_INSTALL >> $cache_file + echo platform=$platform >> $cache_file +} + #_____________________________________________________________________ function download_file { # download the file from the given location using either wget or diff --git a/scripts/install_DDS.sh b/scripts/install_DDS.sh new file mode 100644 index 000000000..a08ef4243 --- /dev/null +++ b/scripts/install_DDS.sh @@ -0,0 +1,30 @@ +#!/bin/bash + + +if [ ! -d $SIMPATH/DDS ]; +then + cd $SIMPATH + git clone $DDS_LOCATION +fi + +install_prefix=$SIMPATH_INSTALL/DDS + + checkfile=$install_prefix/bin/dds-server + +if (not_there DDS $checkfile); +then + cd DDS + git checkout $DDSVERSION + if [ ! -d build_for_alfa ]; + then + mkdir build_for_alfa + fi + cd build_for_alfa + BOOST_ROOT=$SIMPATH_INSTALL cmake -DCMAKE_INSTALL_PREFIX=install_prefix -C ../BuildSetup.cmake ../ + $MAKE_command -j$number_of_processes wn_bin + $MAKE_command -j$number_of_processes install + +fi + +cd $SIMPATH +return 1 diff --git a/scripts/install_aliroot.sh b/scripts/install_aliroot.sh new file mode 100644 index 000000000..3733c90c2 --- /dev/null +++ b/scripts/install_aliroot.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +if [ ! -d $SIMPATH/AliRoot ]; +then + cd $SIMPATH + git clone $ALIROOT_LOCATION +fi + +install_prefix=$SIMPATH_INSTALL/AliRoot +export GEANT3DIR=$SIMPATH_INSTALL/share/geant3 +export ALICE_ROOT=$SIMPATH/AliRoot +export ALICE_TARGET=`root-config --arch` + +export ROOTSYS=$SIMPATH_INSTALL + + +checkfile=$install_prefix/lib/libSTEER.so + +if (not_there AliRoot $checkfile); +then + cd AliRoot + git checkout $ALIROOTVERSION + + if [ ! -d build_for_alfa ]; + then + mkdir build_for_alfa + fi + cd build_for_alfa + + cmake -DCMAKE_INSTALL_PREFIX=$install_prefix -DGEANT3DIR=$SIMPATH_INSTALL -DGEANT3_INCLUDE_DIR=$SIMPATH_INSTALL/include/TGeant3 -DGEANT3_LIBRARY_DIR=SIMPATH_INSTALL/lib -DGEANT3_SYSTEM_DIR=$SIMPATH_INSTALL/share/geant3 -DZEROMQ_LIBRARY=$SIMPATH_INSTALL/lib -DZEROMQ_INCLUDE_DIR=$SIMPATH_INSTALL/include $ALICE_ROOT + + $MAKE_command -j$number_of_processes + $MAKE_command install + +fi +cd $SIMPATH +return 1 diff --git a/scripts/install_fairroot.sh b/scripts/install_fairroot.sh new file mode 100644 index 000000000..faa1ecb39 --- /dev/null +++ b/scripts/install_fairroot.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +if [ ! -d $SIMPATH/FairRoot ]; +then + cd $SIMPATH + git clone $FAIRROOT_LOCATION +fi + +install_prefix=$SIMPATH_INSTALL/FairRoot + +checkfile=$install_prefix/lib/libBase.so + +if (not_there FairRoot $checkfile); +then + cd FairRoot + git checkout $FAIRROOTVERSION + if [ ! -d build_for_alfa ]; + then + mkdir build_for_alfa + fi + cd build_for_alfa + if [ "$onlyreco" = "0" ]; + then + SIMPATH=$SIMPATH_INSTALL cmake -DCMAKE_INSTALL_PREFIX=$install_prefix ../ + else + SIMPATH=$SIMPATH_INSTALL cmake -DCMAKE_INSTALL_PREFIX=$install_prefix -DRECO_ONLY=1 ../ + fi + $MAKE_command -j$number_of_processes + $MAKE_command install + +fi +cd $SIMPATH +return 1 diff --git a/scripts/package_versions.sh b/scripts/package_versions.sh index e0f2593af..850cca223 100644 --- a/scripts/package_versions.sh +++ b/scripts/package_versions.sh @@ -92,3 +92,13 @@ export RadioactiveDecay_TAR=G4RadioactiveDecay.4.0.tar.gz export RealSurface_VERSION=RealSurface1.0 export RealSurface_TAR=RealSurface.1.0.tar.gz + +export FAIRROOT_LOCATION="https://github.com/FairRootGroup/FairRoot.git" +export FAIRROOTVERSION=dev + +export DDS_LOCATION="https://github.com/FairRootGroup/DDS.git" +export DDSVERSION=master + +export ALIROOT_LOCATION="http://git.cern.ch/pub/AliRoot" +export ALIROOTVERSION=master + diff --git a/tools/rootconfig.sh b/tools/rootconfig.sh index 7cb80bcb9..164b3f179 100755 --- a/tools/rootconfig.sh +++ b/tools/rootconfig.sh @@ -55,6 +55,14 @@ PYTHONBUILD=" " fi + if [ "$install_alfasoft" = "yes" ]; + then + VCBUILD=" " + else + VCBUILD="--enable-vc" + fi + + ####################################################### pythia6_libdir=$SIMPATH_INSTALL/lib @@ -75,7 +83,7 @@ --disable-globus \ --disable-reflex \ --disable-cintex \ - --enable-vc --enable-http \ + $VCBUILD --enable-http \ --with-gsl-incdir=$gsl_dir/include \ --with-gsl-libdir=$gsl_dir/lib \ --with-f77=$FC $root_comp_flag $prefix_string \