From 25a71c743f03d13c088291b4cd4e67aa5c227b05 Mon Sep 17 00:00:00 2001 From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> Date: Fri, 3 Feb 2017 19:03:39 +0100 Subject: [PATCH] Adding the code developed for performing the full stack build of the Athena project from scratch. The code builds AthenaExternals and Gaudi from git, and then sets up the build of the Athena project on top of those externals. Former-commit-id: ed0de56264c23d92947888944d6d9e6fab97e057 --- Build/AtlasBuildScripts/LCG_RELEASE_BASE.sh | 24 ++++ Build/AtlasBuildScripts/README.md | 5 + Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh | 22 ++++ Build/AtlasBuildScripts/build_Gaudi.sh | 104 +++++++++++++++ .../AtlasBuildScripts/build_atlasexternals.sh | 97 ++++++++++++++ Build/AtlasBuildScripts/checkout_Gaudi.sh | 80 ++++++++++++ .../checkout_atlasexternals.sh | 80 ++++++++++++ Projects/Athena/CMakeLists.txt | 86 +++++++++++++ Projects/Athena/PostConfig.cmake.in | 12 ++ Projects/Athena/README.md | 44 +++++++ Projects/Athena/build.sh | 100 +++++++++++++++ Projects/Athena/build_externals.sh | 120 ++++++++++++++++++ Projects/Athena/externals.txt | 5 + Projects/Athena/package_filters.txt | 20 +++ Projects/Athena/version.txt | 1 + 15 files changed, 800 insertions(+) create mode 100644 Build/AtlasBuildScripts/LCG_RELEASE_BASE.sh create mode 100644 Build/AtlasBuildScripts/README.md create mode 100644 Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh create mode 100755 Build/AtlasBuildScripts/build_Gaudi.sh create mode 100755 Build/AtlasBuildScripts/build_atlasexternals.sh create mode 100755 Build/AtlasBuildScripts/checkout_Gaudi.sh create mode 100755 Build/AtlasBuildScripts/checkout_atlasexternals.sh create mode 100644 Projects/Athena/CMakeLists.txt create mode 100644 Projects/Athena/PostConfig.cmake.in create mode 100644 Projects/Athena/README.md create mode 100755 Projects/Athena/build.sh create mode 100755 Projects/Athena/build_externals.sh create mode 100644 Projects/Athena/externals.txt create mode 100644 Projects/Athena/package_filters.txt create mode 100644 Projects/Athena/version.txt diff --git a/Build/AtlasBuildScripts/LCG_RELEASE_BASE.sh b/Build/AtlasBuildScripts/LCG_RELEASE_BASE.sh new file mode 100644 index 00000000000..9125180f8f0 --- /dev/null +++ b/Build/AtlasBuildScripts/LCG_RELEASE_BASE.sh @@ -0,0 +1,24 @@ +# +# This helper script is meant to set up a valid value for the +# LCG_RELEASE_BASE environment variable for the builds. +# +# If the environment variable is already set when the script runs, its +# value is not modified. If it isn't set yet, then the script tries to +# check for the existence of a number of standard directories in which +# LCG releases usually reside. +# + +if [ -z "${LCG_RELEASE_BASE}" ]; then + + if [ -d /cvmfs/sft.cern.ch/lcg/releases ]; then + export LCG_RELEASE_BASE=/cvmfs/sft.cern.ch/lcg/releases + elif [ -d /afs/cern.ch/sw/lcg/releases ]; then + export LCG_RELEASE_BASE=/afs/cern.ch/sw/lcg/releases + elif [ -d /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases ]; then + export LCG_RELEASE_BASE=/cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases + fi + echo "Set LCG_RELEASE_BASE = ${LCG_RELEASE_BASE}" + +else + echo "Leaving LCG_RELEASE_BASE = ${LCG_RELEASE_BASE}" +fi diff --git a/Build/AtlasBuildScripts/README.md b/Build/AtlasBuildScripts/README.md new file mode 100644 index 00000000000..dd50ee543bb --- /dev/null +++ b/Build/AtlasBuildScripts/README.md @@ -0,0 +1,5 @@ +Build Scripts For ATLAS External Projects +========================================= + +This directory collects the helper scripts needed to build / set up everything +necessary to build the projects of this repository. diff --git a/Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh b/Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh new file mode 100644 index 00000000000..7eb581f6e25 --- /dev/null +++ b/Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh @@ -0,0 +1,22 @@ +# +# This helper script is meant to set up a valid value for the +# TDAQ_RELEASE_BASE environment variable for the builds. +# +# If the environment variable is already set when the script runs, its +# value is not modified. If it isn't set yet, then the script tries to +# check for the existence of a number of standard directories in which +# TDAQ releases usually reside. +# + +if [ -z "${TDAQ_RELEASE_BASE}" ]; then + + if [ -d /afs/cern.ch/atlas/project/tdaq/prod ]; then + export TDAQ_RELEASE_BASE=/afs/cern.ch/atlas/project/tdaq/prod + elif [ -d /cvmfs/atlas.cern.ch/repo/sw/software/21.0 ]; then + export TDAQ_RELEASE_BASE=/cvmfs/atlas.cern.ch/repo/sw/software/21.0 + fi + echo "Set TDAQ_RELEASE_BASE = ${TDAQ_RELEASE_BASE}" + +else + echo "Leaving TDAQ_RELEASE_BASE = ${TDAQ_RELEASE_BASE}" +fi diff --git a/Build/AtlasBuildScripts/build_Gaudi.sh b/Build/AtlasBuildScripts/build_Gaudi.sh new file mode 100755 index 00000000000..b07758d8628 --- /dev/null +++ b/Build/AtlasBuildScripts/build_Gaudi.sh @@ -0,0 +1,104 @@ +#!/bin/bash +# +# Script used for building Gaudi. +# + +# Don't stop on errors: +set +e + +# Function printing the usage information for the script +usage() { + echo "Usage: build_Gaudi.sh <-s source dir> <-b build dir> " \ + "<-i install dir> <-e externals dir> <-p externals project name> " \ + "<-f platform name> [-r RPM dir] [-t build type]" +} + +# Parse the command line arguments: +SOURCEDIR="" +BUILDDIR="" +INSTALLDIR="" +EXTDIR="" +EXTPROJECT="" +PLATFORM="" +RPMDIR="" +BUILDTYPE="Release" +while getopts ":s:b:i:e:p:f:r:t:h" opt; do + case $opt in + s) + SOURCEDIR=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + i) + INSTALLDIR=$OPTARG + ;; + e) + EXTDIR=$OPTARG + ;; + p) + EXTPROJECT=$OPTARG + ;; + f) + PLATFORM=$OPTARG + ;; + r) + RPMDIR=$OPTARG + ;; + t) + BUILDTYPE=$OPTARG + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# Make sure that the required options were all specified: +if [ "$SOURCEDIR" = "" ] || [ "$BUILDDIR" = "" ] || [ "$INSTALLDIR" = "" ] \ + || [ "$EXTDIR" = "" ] || [ "$EXTPROJECT" = "" ] \ + || [ "$PLATFORM" = "" ]; then + echo "Not all required parameters received!" + usage + exit 1 +fi + +# Create the build directory if it doesn't exist, and move to it: +mkdir -p ${BUILDDIR} +cd ${BUILDDIR} + +# Set up the externals project: +source ${EXTDIR}/setup.sh + +# Configure the build: +cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + -DGAUDI_ATLAS:BOOL=TRUE -DGAUDI_ATLAS_BASE_PROJECT:STRING=${EXTPROJECT} \ + -DCMAKE_INSTALL_PREFIX:PATH=/InstallArea/${PLATFORM} \ + ${SOURCEDIR} 2>&1 | tee cmake_config.log + +# Build it: +make -k + +# Install it: +make -k install/fast DESTDIR=${INSTALLDIR} + +# If no RPM directory was specified, stop here: +if [ "$RPMDIR" = "" ]; then + exit 0 +fi + +# Build the RPM for the project: +cpack +mkdir -p ${RPMDIR} +cp GAUDI*.rpm ${RPMDIR} diff --git a/Build/AtlasBuildScripts/build_atlasexternals.sh b/Build/AtlasBuildScripts/build_atlasexternals.sh new file mode 100755 index 00000000000..20f6dfbcfd4 --- /dev/null +++ b/Build/AtlasBuildScripts/build_atlasexternals.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# Example script used for building one of the projects from the atlasexternals +# repository. +# + +# Don't stop on errors: +set +e + +# Function printing the usage information for the script +usage() { + echo "Usage: build_atlasexternals.sh <-s source dir> <-b build dir> " \ + "<-i install dir> [-p project] [-r RPM dir] [-t build type]" +} + +# Parse the command line arguments: +SOURCEDIR="" +BUILDDIR="" +INSTALLDIR="" +PROJECT="AthenaExternals" +RPMDIR="" +BUILDTYPE="Release" +PROJECTVERSION="" +while getopts ":s:b:i:p:r:t:v:h" opt; do + case $opt in + s) + SOURCEDIR=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + i) + INSTALLDIR=$OPTARG + ;; + p) + PROJECT=$OPTARG + ;; + r) + RPMDIR=$OPTARG + ;; + t) + BUILDTYPE=$OPTARG + ;; + v) + PROJECTVERSION=$OPTARG + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# Make sure that the required options were all specified: +if [ "$SOURCEDIR" = "" ] || [ "$BUILDDIR" = "" ] || [ "$INSTALLDIR" = "" ]; then + echo "Not all required parameters received!" + usage + exit 1 +fi + +# Create the build directory if it doesn't exist, and move to it: +mkdir -p ${BUILDDIR} +cd ${BUILDDIR} + +# Extra settings for providing a project version for the build if necessary: +EXTRACONF= +if [ "$PROJECTVERSION" != "" ]; then + PNAME=$(echo ${PROJECT} | awk '{print toupper($0)}') + EXTRACONF=-D${PNAME}_PROJECT_VERSION:STRING=${PROJECTVERSION} +fi + +# Configure the build: +cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ + ${EXTRACONF} \ + ${SOURCEDIR}/Projects/${PROJECT}/ 2>&1 | tee cmake_config.log + +# Build it: +make -k + +# Install it: +make -k install/fast DESTDIR=${INSTALLDIR} + +# If no RPM directory was specified, stop here: +if [ "$RPMDIR" = "" ]; then + exit 0 +fi + +# Build the RPM for the project: +cpack +mkdir -p ${RPMDIR} +cp ${PROJECT}*.rpm ${RPMDIR} diff --git a/Build/AtlasBuildScripts/checkout_Gaudi.sh b/Build/AtlasBuildScripts/checkout_Gaudi.sh new file mode 100755 index 00000000000..8d89cc12a44 --- /dev/null +++ b/Build/AtlasBuildScripts/checkout_Gaudi.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# Script for automating the checkout of the Gaudi repository when +# building the whole software stack in a nightly/release. +# +# The script must receive the tag/branch that should be checked out of the +# Gaudi repository. And it can write the commit hash that the +# checkout ended up with, into another file. +# + +# Stop on errors: +set -e + +# Function printing the usage information for the script +usage() { + echo "Usage: checkout_Gaudi.sh <-t branch/tag> " \ + "<-s source directory> [-o hash_file.txt]" +} + +# Parse the command line arguments: +TAGBRANCH="" +SOURCEDIR="" +HASHFILE="" +while getopts ":t:o:s:h" opt; do + case $opt in + t) + TAGBRANCH=$OPTARG + ;; + s) + SOURCEDIR=$OPTARG + ;; + o) + HASHFILE=$OPTARG + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# The tag/branch and a source directory must have been specified: +if [ "$TAGBRANCH" = "" ] || [ "$SOURCEDIR" = "" ]; then + echo "Not all required arguments were provided!" + usage + exit 1 +fi + +# Tell the user what will happen: +echo "Checking out Gaudi tag/branch: $TAGBRANCH" +if [ "$HASHFILE" != "" ]; then + echo "Writing the commit hash into file: $HASHFILE" +fi + +# Clone the repository: +git clone https://gitlab.cern.ch/atlas/Gaudi.git \ + ${SOURCEDIR} + +# Get the appropriate tag of it: +cd ${SOURCEDIR} +git checkout ${TAGBRANCH} + +# If an output file was not specified, stop here: +if [ "$HASHFILE" = "" ]; then + exit 0 +fi + +# Write the hash of whatever we have checked out currently, into the +# specified output file: +git rev-parse ${TAGBRANCH} > ${HASHFILE} diff --git a/Build/AtlasBuildScripts/checkout_atlasexternals.sh b/Build/AtlasBuildScripts/checkout_atlasexternals.sh new file mode 100755 index 00000000000..93c068d7cb1 --- /dev/null +++ b/Build/AtlasBuildScripts/checkout_atlasexternals.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# Script for automating the checkout of the atlasexternals repository when +# building the whole software stack in a nightly/release. +# +# The script must receive the tag/branch that should be checked out of the +# atlasexternals repository. And it can write the commit hash that the +# checkout ended up with, into another file. +# + +# Stop on errors: +set -e + +# Function printing the usage information for the script +usage() { + echo "Usage: checkout_atlasexternals.sh <-t branch/tag> " \ + "<-s source directory> [-o hash_file.txt]" +} + +# Parse the command line arguments: +TAGBRANCH="" +SOURCEDIR="" +HASHFILE="" +while getopts ":t:o:s:h" opt; do + case $opt in + t) + TAGBRANCH=$OPTARG + ;; + s) + SOURCEDIR=$OPTARG + ;; + o) + HASHFILE=$OPTARG + ;; + h) + usage + exit 0 + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# The tag/branch and a source directory must have been specified: +if [ "$TAGBRANCH" = "" ] || [ "$SOURCEDIR" = "" ]; then + echo "Not all required arguments were provided!" + usage + exit 1 +fi + +# Tell the user what will happen: +echo "Checking out atlasexternals tag/branch: $TAGBRANCH" +if [ "$HASHFILE" != "" ]; then + echo "Writing the commit hash into file: $HASHFILE" +fi + +# Clone the repository: +git clone ssh://git@gitlab.cern.ch:7999/atlas/atlasexternals.git \ + ${SOURCEDIR} + +# Get the appropriate tag of it: +cd ${SOURCEDIR} +git checkout ${TAGBRANCH} + +# If an output file was not specified, stop here: +if [ "$HASHFILE" = "" ]; then + exit 0 +fi + +# Write the hash of whatever we have checked out currently, into the +# specified output file: +git rev-parse ${TAGBRANCH} > ${HASHFILE} diff --git a/Projects/Athena/CMakeLists.txt b/Projects/Athena/CMakeLists.txt new file mode 100644 index 00000000000..ab2539bb05b --- /dev/null +++ b/Projects/Athena/CMakeLists.txt @@ -0,0 +1,86 @@ + +# The minimum required CMake version: +cmake_minimum_required( VERSION 3.2 FATAL_ERROR ) + +# Read in the project's version from a file called version.txt. But let it be +# overridden from the command line if necessary. +file( READ ${CMAKE_SOURCE_DIR}/version.txt _version ) +string( STRIP ${_version} _version ) +set( ATHENA_PROJECT_VERSION ${_version} + CACHE STRING "Version of the Athena project to build" ) +unset( _version ) + +# Set the versions of the TDAQ externals to pick up for the build: +set( TDAQ-COMMON_VERSION "02-01-00" ) +set( TDAQ-COMMON_ROOT + "$ENV{TDAQ_RELEASE_BASE}/tdaq-common/tdaq-common-${TDAQ-COMMON_VERSION}" ) + +set( DQM-COMMON_VERSION "01-01-00" ) +set( DQM-COMMON_ROOT + "$ENV{TDAQ_RELEASE_BASE}/dqm-common/dqm-common-${DQM-COMMON_VERSION}" ) + +set( TDAQ_PROJECT_NAME "tdaq") +set( TDAQ_VERSION "07-00-00" ) +set( TDAQ_ROOT "$ENV{TDAQ_RELEASE_BASE}/${TDAQ_PROJECT_NAME}/${TDAQ_PROJECT_NAME}-${TDAQ_VERSION}" ) + +# Find the ATLAS CMake code: +find_package( AtlasCMake QUIET ) + +# Find the base project(s): +find_package( AthenaExternals REQUIRED ) +find_package( Gaudi REQUIRED ) + +# Set up CTest: +atlas_ctest_setup() + +# Declare project name and version +atlas_project( Athena ${ATHENA_PROJECT_VERSION} + USE AthenaExternals 0.0.1 + PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ + FORTRAN ) + +# Generate the environment setup for the externals, to be used during the build: +lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh ) + +# Generate replacement rules for the installed paths: +set( _replacements ) +if( NOT "$ENV{NICOS_PROJECT_HOME}" STREQUAL "" ) + get_filename_component( _buildDir $ENV{NICOS_PROJECT_HOME} PATH ) + list( APPEND _replacements ${_buildDir} "\${Athena_DIR}/../../../.." ) +endif() +if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" ) + list( APPEND _replacements $ENV{NICOS_PROJECT_RELNAME} + "\${Athena_VERSION}" ) +endif() +if( NOT "$ENV{TDAQ_RELEASE_BASE}" STREQUAL "" ) + list( APPEND _replacements $ENV{TDAQ_RELEASE_BASE} + "\${TDAQ_RELEASE_BASE}" ) +endif() + +# Now generate and install the installed setup files: +lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/env_setup_install.sh + REPLACE ${_replacements} ) +install( FILES ${CMAKE_BINARY_DIR}/env_setup_install.sh + DESTINATION . RENAME env_setup.sh ) + +# Configure and install the post-configuration file: +string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" + TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" ) +string( REPLACE "${TDAQ-COMMON_VERSION}" "\${TDAQ-COMMON_VERSION}" + TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" ) +string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}" + DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" ) +string( REPLACE "${DQM-COMMON_VERSION}" "\${DQM-COMMON_VERSION}" + DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" ) +configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in + ${CMAKE_BINARY_DIR}/PostConfig.cmake @ONLY ) +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/PostConfig.cmake.in b/Projects/Athena/PostConfig.cmake.in new file mode 100644 index 00000000000..04f63f68fe6 --- /dev/null +++ b/Projects/Athena/PostConfig.cmake.in @@ -0,0 +1,12 @@ +# +# File taking care of pointing the downstream projects at the right +# version of the externals. +# + +set( TDAQ-COMMON_VERSION "@TDAQ-COMMON_VERSION@" ) +set( TDAQ-COMMON_ROOT "@TDAQ-COMMON_ROOT@" ) + +set( DQM-COMMON_VERSION "@DQM-COMMON_VERSION@" ) +set( DQM-COMMON_ROOT "@DQM-COMMON_ROOT@" ) + +find_package( Gaudi ) diff --git a/Projects/Athena/README.md b/Projects/Athena/README.md new file mode 100644 index 00000000000..59582d5780b --- /dev/null +++ b/Projects/Athena/README.md @@ -0,0 +1,44 @@ +The Full ATLAS Offline Software Project +======================================= + +This is the configuration for building the full offline software from the +repository. + +Build Instructions +------------------ + +To build the externals necessary for building this project itself, use the + + build_externals.sh + +script. It will build all the externals necessary for this project into a +subdirectory of the directory holding this repository, called `build`. + +The sources of the externals will be checked out under `build/src`, the +build of the projects will commence under `build/build`, and the results of +the build will be installed under `build/install`. + +RPMs created from the externals are copied under `build/` by the script. + +Once the externals have finished building, you can initiate the full build +of the project against these newly built externals by executing the + + build.sh + +script. It uses the same directory layout inside the `build` directory as +was used for the externals. + +Custom Builds +------------- + +Of course it is perfectly allowed to set up a build by hand, not using the +`build.sh` script as well. In that case you have to make sure to have a +functional version of AthenaExternals set up in your environment, and point +the `GAUDI_ROOT` environment variable against the Gaudi version that you +want to use for the build. + +You will also need to set the `TDAQ_RELEASE_BASE` environment variable for +the build to be successful. The simplest way of doing this is to use the +helper script: + + Build/AtlasBuildScripts/TDAQ_RELEASE_BASE.sh diff --git a/Projects/Athena/build.sh b/Projects/Athena/build.sh new file mode 100755 index 00000000000..61c6278ac3c --- /dev/null +++ b/Projects/Athena/build.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# +# Script for building the release on top of externals built using one of the +# scripts in this directory. +# + +# Function printing the usage information for the script +usage() { + echo "Usage: build.sh [-t build type] [-b build dir]" +} + +# Parse the command line arguments: +BUILDDIR="" +BUILDTYPE="RelWithDebInfo" +while getopts ":t:s:b:h" opt; do + case $opt in + t) + BUILDTYPE=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# Stop on errors from here on out: +set -e + +# We are in BASH, get the path of this script in a simple way: +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 + 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 +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 + +# Install the results: +time make install/fast \ + DESTDIR=${BUILDDIR}/install/Athena/${NICOS_PROJECT_VERSION} + +# Build an RPM for the release: +time cpack +cp Athena*.rpm ${BUILDDIR}/ diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh new file mode 100755 index 00000000000..5009b5f5d36 --- /dev/null +++ b/Projects/Athena/build_externals.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# +# Script building all the externals necessary for the nightly build. +# + +# Function printing the usage information for the script +usage() { + echo "Usage: build_externals.sh [-t build type] [-b build dir]" +} + +# Parse the command line arguments: +BUILDDIR="" +BUILDTYPE="RelWithDebInfo" +while getopts ":t:s:b:h" opt; do + case $opt in + t) + BUILDTYPE=$OPTARG + ;; + b) + BUILDDIR=$OPTARG + ;; + :) + echo "Argument -$OPTARG requires a parameter!" + usage + exit 1 + ;; + ?) + echo "Unknown argument: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# Version comparison function. Taken from a StackOverflow article. +verlte() { + if [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]; then + return 1 + fi + return 0 +} + +# First off, check that we are using a new enough version of Git. We need +# at least version 1.8.1. +git_min_version=1.8.1 +git_version=`git --version | awk '{print $3}'` +verlte "${git_min_version}" "${git_version}" +if [ $? = 0 ]; then + echo "Detected git version (${git_version}) not new enough." + echo "Need at least: ${git_min_version}" + exit 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: +thisdir=$(dirname ${BASH_SOURCE[0]}) +thisdir=$(cd ${thisdir};pwd) + +# Go to the main directory of the repository: +cd ${thisdir}/../.. + +# Check if the user specified any source/build directories: +if [ "$BUILDDIR" = "" ]; then + BUILDDIR=${thisdir}/../../../build +fi + +# Create some directories: +mkdir -p ${BUILDDIR}/install + +# Set some environment variables that the builds use internally: +export NICOS_PROJECT_VERSION=`cat ${thisdir}/version.txt` +export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION} +export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION} + +# The directory holding the helper scripts: +scriptsdir=${thisdir}/../../Build/AtlasBuildScripts + +# Set the environment variable for finding LCG releases: +source ${scriptsdir}/LCG_RELEASE_BASE.sh + +# Read in the tag/branch to use for AthenaExternals: +AthenaExternalsVersion=$(awk '/^AthenaExternalsVersion/{print $3}' ${thisdir}/externals.txt) + +# Check out AthenaExternals from the right branch/tag: +${scriptsdir}/checkout_atlasexternals.sh \ + -t ${AthenaExternalsVersion} \ + -s ${BUILDDIR}/src/AthenaExternals + +# Build AthenaExternals: +export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/AthenaExternals +${scriptsdir}/build_atlasexternals.sh \ + -s ${BUILDDIR}/src/AthenaExternals \ + -b ${BUILDDIR}/build/AthenaExternals \ + -i ${BUILDDIR}/install/AthenaExternals/${NICOS_PROJECT_VERSION} \ + -p AthenaExternals -r ${BUILDDIR} -t ${BUILDTYPE} \ + -v ${NICOS_PROJECT_VERSION} + +# Get the "platform name" from the directory created by the AthenaExternals +# build: +platform=$(cd ${BUILDDIR}/install/AthenaExternals/${NICOS_PROJECT_VERSION}/InstallArea;ls) + +# Read in the tag/branch to use for Gaudi: +GaudiVersion=$(awk '/^GaudiVersion/{print $3}' ${thisdir}/externals.txt) + +# Check out Gaudi from the right branch/tag: +${scriptsdir}/checkout_Gaudi.sh \ + -t ${GaudiVersion} \ + -s ${BUILDDIR}/src/GAUDI + +# Build Gaudi: +export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/Gaudi +${scriptsdir}/build_Gaudi.sh \ + -s ${BUILDDIR}/src/GAUDI \ + -b ${BUILDDIR}/build/GAUDI \ + -i ${BUILDDIR}/install/GAUDI/${NICOS_PROJECT_VERSION} \ + -e ${BUILDDIR}/install/AthenaExternals/${NICOS_PROJECT_VERSION}/InstallArea/${platform} \ + -p AthenaExternals -f ${platform} \ + -r ${BUILDDIR} -t ${BUILDTYPE} diff --git a/Projects/Athena/externals.txt b/Projects/Athena/externals.txt new file mode 100644 index 00000000000..41aaab97057 --- /dev/null +++ b/Projects/Athena/externals.txt @@ -0,0 +1,5 @@ +# Versions of the various externals to build before starting the build of +# this project, when doing a full stack nightly build. + +AthenaExternalsVersion = master +GaudiVersion = v28r0.004 diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt new file mode 100644 index 00000000000..55da4f6938e --- /dev/null +++ b/Projects/Athena/package_filters.txt @@ -0,0 +1,20 @@ +# Package filtering rules for the Athena project build. +# +# Only pick up a few packages from the External directory: ++External/AtlasDataArea ++External/pyAMI ++External/FWDet/TwissFiles ++External/Herwigpp ++External/AtlasMKL +-External +# Only pick up the RunTime packages from Projects: ++Projects/.*RunTime +-Projects +# Remove HLT and Java requiring packages: +-HLT +-Trigger/TrigConfiguration/TrigDb +-Trigger/TrigConfiguration/TriggerTool + +# Offload service has build problems +-External/APEGlue +-Offloading diff --git a/Projects/Athena/version.txt b/Projects/Athena/version.txt new file mode 100644 index 00000000000..1d975bef246 --- /dev/null +++ b/Projects/Athena/version.txt @@ -0,0 +1 @@ +22.0.0 -- GitLab