diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt index ab2539bb05ba141fe11db821b72834226c09b4b4..8db019d70fa187c0ea8c8511be5610ef47476deb 100644 --- a/Projects/Athena/CMakeLists.txt +++ b/Projects/Athena/CMakeLists.txt @@ -77,10 +77,5 @@ configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in install( FILES ${CMAKE_BINARY_DIR}/PostConfig.cmake DESTINATION ${CMAKE_INSTALL_CMAKEDIR} ) -# Turn off the compression of the created RPM. This makes the RPM a lot -# bigger, but should push the RPM creation time down by a lot. -set( CPACK_RPM_SPEC_MORE_DEFINE - "%define _source_payload w0.gzdio\n%define _binary_payload w0.gzdio" ) - # Package up the release using CPack: atlas_cpack_setup() diff --git a/Projects/Athena/build.sh b/Projects/Athena/build.sh index 61c6278ac3c01667de7678c639f316fdec5e0e95..058721a0fb495f96159294d90f9283979bb7f84b 100755 --- a/Projects/Athena/build.sh +++ b/Projects/Athena/build.sh @@ -6,13 +6,24 @@ # Function printing the usage information for the script usage() { - echo "Usage: build.sh [-t build type] [-b build dir]" + echo "Usage: build.sh [-t build type] [-b build dir] [-c] [-m] [-i] [-p]" + echo " -c: Execute CMake step" + echo " -m: Execute make step" + echo " -i: Execute install step" + echo " -p: Execute CPack step" + echo "If none of the c, m, i or p options are set then the script will do" + echo "*all* steps. Otherwise only the enabled steps are run - it's your" + echo "reponsibility to ensure that precusors are in good shape" } # Parse the command line arguments: BUILDDIR="" BUILDTYPE="RelWithDebInfo" -while getopts ":t:s:b:h" opt; do +EXE_CMAKE="" +EXE_MAKE="" +EXE_INSTALL="" +EXE_CPACK="" +while getopts ":t:b:hcmip" opt; do case $opt in t) BUILDTYPE=$OPTARG @@ -20,6 +31,22 @@ while getopts ":t:s:b:h" opt; do b) BUILDDIR=$OPTARG ;; + c) + EXE_CMAKE="1" + ;; + m) + EXE_MAKE="1" + ;; + i) + EXE_INSTALL="1" + ;; + p) + EXE_CPACK="1" + ;; + h) + usage + exit 0 + ;; :) echo "Argument -$OPTARG requires a parameter!" usage @@ -33,68 +60,50 @@ while getopts ":t:s:b:h" opt; do esac done +if [ -z "$EXE_CMAKE" -a -z "$EXE_MAKE" -a -z "$EXE_INSTALL" -a -z "$EXE_CPACK" ]; then + EXE_CMAKE="1" + EXE_MAKE="1" + EXE_INSTALL="1" + EXE_CPACK="1" +fi + # Stop on errors from here on out: set -e -# We are in BASH, get the path of this script in a simple way: +# Source in our environment AthenaSrcDir=$(dirname ${BASH_SOURCE[0]}) -AthenaSrcDir=$(cd ${AthenaSrcDir};pwd) - -# The directory holding the helper scripts: -scriptsdir=${AthenaSrcDir}/../../Build/AtlasBuildScripts - -# Go to the main directory of the repository: -cd ${AthenaSrcDir}/../.. - -# Check if the user specified any source/build directories: -if [ "$BUILDDIR" = "" ]; then +if [ -z "$BUILDDIR" ]; then BUILDDIR=${AthenaSrcDir}/../../../build fi - -# Set up the environment for the build: -export NICOS_PROJECT_VERSION=`cat ${AthenaSrcDir}/version.txt` -export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} -export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} -export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/Athena - -# Set up the environment variables for finding LCG and the TDAQ externals: -source ${scriptsdir}/LCG_RELEASE_BASE.sh -source ${scriptsdir}/TDAQ_RELEASE_BASE.sh - -# Set up the AthenaExternals project: -extDir=${BUILDDIR}/install/AthenaExternals/${NICOS_PROJECT_VERSION}/InstallArea -if [ ! -d ${extDir} ]; then - echo "Didn't find the AthenaExternals project under ${extDir}" - exit 1 +mkdir -p ${BUILDDIR} +BUILDDIR=$(cd ${BUILDDIR} && pwd) +source $AthenaSrcDir/build_env.sh -b $BUILDDIR + +# CMake: +if [ -n "$EXE_CMAKE" ]; then + mkdir -p ${BUILDDIR}/build/Athena + cd ${BUILDDIR}/build/Athena + time cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ + -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + ${AthenaSrcDir} 2>&1 | tee cmake_config.log fi -echo "Setting up AthenaExternals from: ${extDir}" -source ${extDir}/*/setup.sh - -# Get the "platform name" from the directory created by the AthenaExternals -# build: -platform=$(cd ${extDir};ls) - -# Point to Gaudi: -export GAUDI_ROOT=${BUILDDIR}/install/GAUDI/${NICOS_PROJECT_VERSION}/InstallArea/${platform} -echo "Taking Gaudi from: ${GAUDI_ROOT}" - -# Configure the build: -mkdir -p ${BUILDDIR}/build/Athena -cd ${BUILDDIR}/build/Athena -time cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \ - -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ - ${AthenaSrcDir} 2>&1 | tee cmake_config.log # At this point stop worrying about errors: set +e -# Execute the build: -time make -k +# make: +if [ -n "$EXE_MAKE" ]; then + time make -k +fi # Install the results: -time make install/fast \ - DESTDIR=${BUILDDIR}/install/Athena/${NICOS_PROJECT_VERSION} +if [ -n "$EXE_INSTALL" ]; then + time make install/fast \ + DESTDIR=${BUILDDIR}/install/Athena/${NICOS_PROJECT_VERSION} +fi # Build an RPM for the release: -time cpack -cp Athena*.rpm ${BUILDDIR}/ +if [ -n "$EXE_CPACK" ]; then + time cpack + cp Athena*.rpm ${BUILDDIR}/ +fi diff --git a/Projects/Athena/build_env.sh b/Projects/Athena/build_env.sh new file mode 100644 index 0000000000000000000000000000000000000000..f4955abacc377a166211373b24248eb94b31d22a --- /dev/null +++ b/Projects/Athena/build_env.sh @@ -0,0 +1,101 @@ +# This script sets up the build enironment for an Athena +# build, on top of a built set of externals (including Gaudi) +# +# This script is kept separate from the build.sh +# wrapper so it can be sourced separately from it when +# clients want to manage their own build and just want +# to setup the build environment + +env_usage() { + echo "Usage: build_env.sh [-b build dir]" +} + +# This function actually sets up the environment for us +# (factorise it here in case it needs skipped) +env_setup() { + startdir=$(pwd) + # As this script can be sourced we need to support zsh and + # possibly other Bourne shells + if [ "x${BASH_SOURCE[0]}" = "x" ]; then + # This trick should do the right thing under ZSH: + thisdir=$(dirname `print -P %x`) + if [ $? != 0 ]; then + echo "ERROR: This script must be sourced from BASH or ZSH" + return 1 + fi + else + # The BASH solution is a bit more straight forward: + thisdir=$(dirname ${BASH_SOURCE[0]}) + fi + AthenaSrcDir=$(cd ${thisdir};pwd) + + # The directory holding the helper scripts: + scriptsdir=${AthenaSrcDir}/../../Build/AtlasBuildScripts + + # Go to the main directory of the repository: + cd ${AthenaSrcDir}/../.. + + # Check if the user specified any source/build directories: + if [ "$BUILDDIR" = "" ]; then + BUILDDIR=${AthenaSrcDir}/../../../build + fi + + # Set up the environment for the build: + export NICOS_PROJECT_VERSION=`cat ${AthenaSrcDir}/version.txt` + export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} + export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} + export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/Athena + + # Set up the environment variables for finding LCG and the TDAQ externals: + source ${scriptsdir}/LCG_RELEASE_BASE.sh + source ${scriptsdir}/TDAQ_RELEASE_BASE.sh + + # Set up the AthenaExternals project: + extDir=${BUILDDIR}/install/AthenaExternals/${NICOS_PROJECT_VERSION}/InstallArea + if [ ! -d ${extDir} ]; then + echo "Didn't find the AthenaExternals project under ${extDir}" + fi + echo "Setting up AthenaExternals from: ${extDir}" + source ${extDir}/*/setup.sh + + # Get the "platform name" from the directory created by the AthenaExternals + # build: + platform=$(cd ${extDir};ls) + + # Point to Gaudi: + export GAUDI_ROOT=${BUILDDIR}/install/GAUDI/${NICOS_PROJECT_VERSION}/InstallArea/${platform} + echo "Taking Gaudi from: ${GAUDI_ROOT}" + + cd $startdir +} + +# Parse the command line arguments: +BUILDDIR="" +while getopts "b:h" opt; do + case $opt in + b) + BUILDDIR=$OPTARG + ;; + h) + env_usage + ABORT=1 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + env_usage + ABORT=1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + env_usage + ABORT=1 + ;; + esac +done + +# Put a big wrapper around bad argument case, because +# a sourced script should not call "exit". This is quite +# annoying... +if [ -z "$ABORT" ]; then + env_setup +fi diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index 5009b5f5d36bd04b9c3aa59e94c9a468d3016ac9..404baf4821ea2ec6775c96a3bea8f0c1c5626872 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -5,13 +5,18 @@ # Function printing the usage information for the script usage() { - echo "Usage: build_externals.sh [-t build type] [-b build dir]" + echo "Usage: build_externals.sh [-t build_type] [-b build_dir] [-f]" + echo " -f: Force rebuild of externals, otherwise if script" + echo " finds an external build present it will simply exit" + echo "If a build_dir is not given the default is '../build'" + echo "relative to the athena checkout" } # Parse the command line arguments: BUILDDIR="" BUILDTYPE="RelWithDebInfo" -while getopts ":t:s:b:h" opt; do +FORCE="" +while getopts ":t:b:fh" opt; do case $opt in t) BUILDTYPE=$OPTARG @@ -19,6 +24,13 @@ while getopts ":t:s:b:h" opt; do b) BUILDDIR=$OPTARG ;; + f) + FORCE=1 + ;; + h) + usage + exit 0 + ;; :) echo "Argument -$OPTARG requires a parameter!" usage @@ -65,6 +77,18 @@ cd ${thisdir}/../.. if [ "$BUILDDIR" = "" ]; then BUILDDIR=${thisdir}/../../../build fi +BUILDDIR=$(cd $BUILDDIR; pwd) + +if [ -n "$FORCE" ]; then + echo "Force deleting existing build area..." + rm -fr ${BUILDDIR}/install ${BUILDDIR}/src ${BUILDDIR}/build +fi + +if [ -d ${BUILDDIR}/install/AthenaExternals -a -d ${BUILDDIR}/install/GAUDI ]; then + echo "Found install directories for AthenaExternals and Gaudi in ${BUILDDIR}/install" + echo "Use -f option to force a rebuild" + exit 0 +fi # Create some directories: mkdir -p ${BUILDDIR}/install @@ -76,6 +100,7 @@ export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} # The directory holding the helper scripts: scriptsdir=${thisdir}/../../Build/AtlasBuildScripts +scriptsdir=$(cd ${scriptsdir}; pwd) # Set the environment variable for finding LCG releases: source ${scriptsdir}/LCG_RELEASE_BASE.sh