diff --git a/CMakeLists.txt b/CMakeLists.txt index f6281b64..c5b9fea8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,13 @@ # buildtool [-I /install/path] -bt[i] -jN # ====================================================================== -cmake_minimum_required(VERSION 3.19 FATAL_ERROR) +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) +# cmake_policy(VERSION 3.19) ### MIGRATE-ACTION-COMPATIBILITY (migrate-3.05.03) - Uncomment to preseve compatibility with older CMake versions +find_package(cetmodules REQUIRED) project(larcorealg VERSION 09.05.00 LANGUAGES CXX) # cetbuildtools contains our cmake modules -find_package(cetbuildtools REQUIRED) include(CetCMakeEnv) cet_cmake_env() @@ -22,18 +23,18 @@ cet_set_compiler_flags(DIAGS CAUTIOUS EXTRA_FLAGS -pedantic -Wno-unused-local-typedefs ) -cet_report_compiler_flags() +cet_report_compiler_flags() ### MIGRATE-ACTION-RECOMMENDED (migrate-3.05.03) - add args: REPORT_THRESHOLD VERBOSE -find_package(cetlib_except REQUIRED PUBLIC) -find_package(cetlib REQUIRED PUBLIC) -find_package(messagefacility REQUIRED PUBLIC) -find_package(canvas REQUIRED PUBLIC) +find_package(cetlib_except REQUIRED EXPORT) +find_package(cetlib REQUIRED EXPORT) +find_package(messagefacility REQUIRED EXPORT) +find_package(canvas REQUIRED EXPORT) find_package(canvas_root_io REQUIRED) -find_package(CLHEP COMPONENTS Geometry Vector REQUIRED PUBLIC) +find_package(CLHEP COMPONENTS Geometry Vector REQUIRED EXPORT) find_package(Boost REQUIRED) -find_package(ROOT COMPONENTS Core Physics Geom GenVector REQUIRED PUBLIC) +find_package(ROOT COMPONENTS Core Physics Geom GenVector REQUIRED EXPORT) -find_ups_product( larcoreobj ) +find_package( larcoreobj REQUIRED ) # macros for artdaq_dictionary and simple_plugin include(ArtDictionary) @@ -47,7 +48,6 @@ add_subdirectory(larcorealg) add_subdirectory(test) # ups - table and config files -add_subdirectory(ups) # packaging utility -include(UseCPack) +cet_cmake_config() diff --git a/larcorealg/CoreUtils/CMakeLists.txt b/larcorealg/CoreUtils/CMakeLists.txt index 944fc7cd..0391543b 100644 --- a/larcorealg/CoreUtils/CMakeLists.txt +++ b/larcorealg/CoreUtils/CMakeLists.txt @@ -1,7 +1,7 @@ cet_make(LIBRARIES cetlib::cetlib cetlib_except::cetlib_except - ) + ) ### MIGRATE-ACTION-RECOMMENDED (migrate-3.05.03) - deprecated: use cet_make_library(), build_dictonary(), cet_plugin() with explicit source lists and plugin base types install_headers() install_source() diff --git a/larcorealg/GeoAlgo/CMakeLists.txt b/larcorealg/GeoAlgo/CMakeLists.txt index 4b0131d8..d35b4f10 100644 --- a/larcorealg/GeoAlgo/CMakeLists.txt +++ b/larcorealg/GeoAlgo/CMakeLists.txt @@ -2,7 +2,7 @@ cet_make(NO_DICTIONARY LIBRARIES ROOT::Core ROOT::Physics - ) + ) ### MIGRATE-ACTION-RECOMMENDED (migrate-3.05.03) - deprecated: use cet_make_library(), build_dictonary(), cet_plugin() with explicit source lists and plugin base types art_dictionary(DICTIONARY_LIBRARIES larcorealg_GeoAlgo) diff --git a/larcorealg/Geometry/CMakeLists.txt b/larcorealg/Geometry/CMakeLists.txt index c4d2158e..e41775f3 100644 --- a/larcorealg/Geometry/CMakeLists.txt +++ b/larcorealg/Geometry/CMakeLists.txt @@ -12,7 +12,7 @@ cet_make( ROOT::Geom ROOT::GenVector CLHEP::Geometry - ) + ) ### MIGRATE-ACTION-RECOMMENDED (migrate-3.05.03) - deprecated: use cet_make_library(), build_dictonary(), cet_plugin() with explicit source lists and plugin base types install_headers(SUBDIRS "details") install_fhicl(SUBDIRS "details") diff --git a/larcorealg/TestUtils/CMakeLists.txt b/larcorealg/TestUtils/CMakeLists.txt index 139a0e4f..894c537b 100644 --- a/larcorealg/TestUtils/CMakeLists.txt +++ b/larcorealg/TestUtils/CMakeLists.txt @@ -1,4 +1,4 @@ -cet_make(LIBRARIES canvas::canvas cetlib_except) +cet_make(LIBRARIES canvas::canvas cetlib_except) ### MIGRATE-ACTION-RECOMMENDED (migrate-3.05.03) - deprecated: use cet_make_library(), build_dictonary(), cet_plugin() with explicit source lists and plugin base types install_headers() install_source() diff --git a/ups/CMakeLists.txt b/ups/CMakeLists.txt deleted file mode 100644 index fe33cc71..00000000 --- a/ups/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ - -# create package configuration and version files - -process_ups_files() - -cet_cmake_config() diff --git a/ups/product-config.cmake.in b/ups/product-config.cmake.in deleted file mode 100644 index 4e22a3b3..00000000 --- a/ups/product-config.cmake.in +++ /dev/null @@ -1,12 +0,0 @@ - -set( @product@_VERSION @cet_dot_version@ ) -set( @product@_UPS_VERSION @version@ ) - -@PACKAGE_INIT@ - -@CONFIG_FIND_UPS_COMMANDS@ - -@CONFIG_FIND_LIBRARY_COMMANDS@ - -check_required_components(@product@) - diff --git a/ups/product_deps b/ups/product_deps index 3ef8640a..740cd89b 100644 --- a/ups/product_deps +++ b/ups/product_deps @@ -1,40 +1,335 @@ -# The parent line must be the first non-comment line in the file -# This line defines the product name and version -parent larcorealg v09_05_00 +######################################################################## +# product_deps +# +# Define attributes of a package to be built and distributed as a UPS +# product. +# +# This file is parsed as a consequence of sourcing the +# setup_for_development or setup_deps shell-agnostic scripts. +# +# Generated by cetmodules 3.05.03 at Tue Feb 15 14:35:28 CST 2022 +######################################################################## + +#################################### +# Basic information. + +################## +# parent +################## +# +# The parent line - if present - must be the first non-comment line in +# the file, defining the product's name and version. Any information not +# specified will be taken from the CMake project( VERSION +# ) call in the CMakeLists.txt in the parent directory to +# the one containing this file. +# +# Recommended: +# +#> parent +# +# Deprecated (will produce a warning): +# +#> parent []... + +################## +# chain[s] +################## +# +# List the UPS chains ("-c", -t, "new," "current," "old...") to be defined +# for the package. The trailing `s' is optional and without meaning. +# Multiple chains may be specified with one or more declarations. +# +#> chains ... + +################## +# defaultqual +################## +# +# The default colon-delimited qualifier set used if one is not provided +# to setup_for_development. Build type (debug, opt or prof) is optional. +# +# Deprecated - a qualifier should generally be provided to the +# invocation of setup_for_development or setup_deps. +# +#> defaultqual + +################## +# noarch +################## +# +# Specify this keyword if the package is architecture-independent. This +# does not necessarily imply a lack of qualifiers or of a +# fully-qualified (fq) subdirectory in the installed package. +# +#> noarch + +################## +# no_fq_dir +################## +# +# Specify this keyword if the UPS package should not have a +# fully-qualified (fq) subdirectory in the installed package. This does +# not necessarily imply noarch or a lack of qualifiers, but caution +# should be observed if using this keyword for architecture-dependent +# packages or those with qualifiers to avoid overwritten files when +# multiple different variants of the package are installed in the same +# UPS area. +# +#> no_fq_dir + +################## +# define_pythonpath +################## +# +# If define_pythonpath is enabled, the appropriate path will be appended +# to PYTHONPATH. +# +#> define_pythonpath +#################################### +parent larcorealg defaultqual e20 +#################################### + +#################################### +# Directory specifications. +# +# These optional definitions specify the installed directories where +# various files headers, libraries, and executables will be found. Some +# have defaults; others must be specified if files of that type are to +# be installed. Minimize configuration complexity by using only those +# definitions necessary for the package. +# +################## +# Notes: +# +# * Use directory specifications only if the defaults are inappropriate +# for your product. +# +# * A specification with defaults may be obviated by specifying a base +# of `-' as the only argument. +# +# * A directory will be created and appropriate UPS table file entries +# made *if and only if* files of that type are installed using the +# appropriate directive. +# +################## +# Format: +# +#> [] +# +# may be `-' (negate defaults), "product_dir", or "fq_dir" as +# desired. +# +# Available s and defaults: +# +#> bindir fq_dir bin +# +# Built binaries for public use. +# +#> cmakemoduledir product_dir Modules +# +# CMake modules. +# +#> fcldir product_dir fcl +# +# FHiCL framework configuration files. +# +#> fwdir +# +# Framework data. +# +#> gdmldir product_dir gdml +# +# GDML geometry description files. +# +#> incdir product_dir include +# +# Headers. +# +#> libdir fq_dir lib +# +# Compiled and other libraries. +# +#> perllib product_dir perl5lib +# +# Perl modules, etc. +# +#> set_fwdir +# +# An additional location for framework data to be added to +# FW_SEARCH_PATH; may be specified multiple times. +# +#> set_wpdir +# +# An additional location for wirecell data to be added to +# WIRECELL_PATH; may be specified multiple times. +# +#> testdir product_dir test +# +# Tests. +# +#> wpdir +# +# Wirecell data. +# +#################################### +fcldir product_dir job +gdmldir product_dir +#################################### -# These optional lines define the installed directories where -# headers, libraries, and executables will be found -# Use them only if your product does not conform to the defaults -# Format: directory_type directory_path directory_name -# The only recognized values of the first field are fcldir, incdir, libdir, and bindir -# The only recognized values of the second field are product_dir, fq_dir, and - -# The third field is not constrained. -# Defaults: -# incdir product_dir include -# fcldir product_dir fcl -# libdir fq_dir lib -# bindir fq_dir bin - -fcldir product_dir job -gdmldir product_dir -# -product version -larcoreobj v09_04_00 -cetbuildtools v8_18_09 - only_for_build +#################################### +# Product table. +# +# Table defining *all* direct UPS package dependencies. +# +################## +# Format: +# +#> product version qual [""] +#> [] [] +#>... +#> end_product_list +# +# may be a UPS version, a chain option (-c, -t, etc.) or a +# chain name with a preceding `-'. +# +# Valid values: +# +# * [!] +# +# A single qualifier whose presence in the parent's qualifier will +# trigger the setup of the specified version of the product. A prefix +# of `!' will negate the match. +# +# * |- +# +# The specified version of the product will always be set up +# regardless of the parent's qualifiers. Use `-' as a placeholder if +# is to be specified. +# +# * -nq- +# +# Specify explicitly that this product should be set up when the +# parent is unqualified. +# +# * -default- +# +# The specified version of the product will be set up if no other +# product table entry for this product is applicable to the parent's +# qualifiers. +# +# Valid values: +# +# * only_for_build +# +# The specified product will be set up for building only, and will not +# be added to the table file. +# +# * optional +# +# It will not be an error if the specified product is not available to +# be set up. +# +################## +# Notes. +# +# * Under older versions of the product table format ("" +# or unspecified), -nq- had the same meaning as `-' above. When +# updating a product_deps file these entries should be reviewed when +# is selected. +# +# * "" is a valid alias for "". +# +# * Under most circumstances (the parent is anything other than +# cetmodules), an entry for cetmodules is required. +# +# * It is an error for more than one non-( == "-default-") +# entry to match for a given product. +# +#################################### +product version qual flags +larcoreobj v09_04_00 - +cetmodules v3_05_03 - only_for_build end_product_list +#################################### -qualifier larcoreobj notes -e20:debug e20:debug -e20:prof e20:prof -e19:debug e19:debug -e19:prof e19:prof +#################################### +# Qualifier table. +# +# For each valid qualifer set of the parent, specify how dependencies +# should be set up. +# +# Format: +# +#> qualifier ... [] +#> ... [] +#>... +#> end_qualifier_list +# +# may be a product name or "compiler." +# +# may be a colon-delimited qualifier set, or "-nq-" as a +# column placeholder in the case of no parent qualifiers. +# +# Unless is "compiler", may be a colon-delimited +# qualifier set, or: +# +# * - +# +# The dependency is not required for this and will not +# be set up. +# +# * -nq- +# +# The dependency will be set up without qualifiers. +# +# * -b- (deprecated) +# +# A build-only dependency for this . If the dependency is +# set up in this way, it will be set up without qualifiers. For more +# flexibility, use the product table to specify the only_for_build +# nature of the dependency and the qualifier table to specifiy how it +# should be set up. +# +# If is "compiler", must be `-' (no compiler +# required) or the name of the UPS product for the desired compiler. Any +# qualifiers required to set up the compiler should be specified in the +# appropriate column for that product. +# +################## +# Notes. +# +# * A column for every product in the product table (see above) is +# *required* unless the only_for_build flag is specified, in which +# case it is optional. +# +#################################### +qualifier larcoreobj notes c7:debug c7:debug c7:prof c7:prof +e19:debug e19:debug +e19:prof e19:prof +e20:debug e20:debug +e20:prof e20:prof end_qualifier_list +#################################### + +#################################### +# Table fragment. +# +#################################### +#################################### + +#################################### +# Backmatter. +# +# Comments and editor-specific metadata. # Preserve tabs and formatting in emacs and vi / vim: ### Local Variables: +### mode: sh ### tab-width: 8 ### End: + +# vi:set ts=8 noexpandtab: diff --git a/ups/setup_deps b/ups/setup_deps deleted file mode 100644 index 72c2e321..00000000 --- a/ups/setup_deps +++ /dev/null @@ -1,89 +0,0 @@ -# NO USER-SERVICEABLE PARTS BELOW. -# -# There should be as little as possible here, -# with most of the heavy lifting done by other small scripts -# -# When sourcing this file from a script, you may have to tell this -# source file where it is via the fw_db shell (or env) variable. -# I.e.: -# set fw_db=/some/path; source /some/path/this_file -# or fw_db=/some/path; . /some/path/this_file - -test $?shell = 1 && set ss=csh || ss=sh -#echo Shell type is $ss. - -# make some things similar. need to use set_ because sh builtin set would hide function set -# Note: perhaps the trickiest thing in this file is the sh set_ function tries to return the same status -# as at the start of the function (which most likely is the result of a back-tick expression -test "$ss" = csh && alias set_ set && alias vecho_ 'if ($?vv == 1) echo \!*' || eval 'vecho_() { test -n "${vv-}" && echo "$@"; return 0; }' -test "$ss" = sh && eval 'set_() { sts=$?;for xx in "$@";do var=`expr "$xx" : "\([^=]*\)"`;val=`expr "$xx" : "[^=]*=\(.*\)"`;eval "$var=\"$val\"";done;return $sts; }' -test "$ss" = sh && eval 'setenv() { export $1;eval "$1=\"\${2-}\""; }; source() { file=$1; shift; . $file "$@"; }; unsetenv_() { unset "$@"; }' -test "$ss" = sh && eval 'tnotnull() { eval "test -n \"\${$1-}\""; }' && eval 'nullout() { "$@" >/dev/null 2>&1; }' -test "$ss" = csh && alias tnotnull "eval '"'test $?'"\!* -eq 1' && eval '"'test -n "$'"\!*"'"'"'" && alias nullout "\!* >& /dev/null" && alias unsetenv_ unsetenv -test "$ss" = csh && alias return exit - -set_ msg1='ERROR: You MUST setup ups' -test -z $UPS_DIR && ( echo ""; echo "$msg1"; echo "" ) && return - -set_ msg3='ERROR: You MUST specify either -o, -p, or -d' -set_ msg4='Usage: setup_deps <-d|-o|-p> ' -test -z "$1" && ( echo ""; echo "$msg4"; echo "$msg3"; echo "" ) && return - -# make sure we know where this script lives -# now if we were passed a path or if not, we can figure it out (maybe if we are interactive) -# bash, zsh, ksh and tcsh pass params to a source file, csh does not. but someone will be writing csh scripts -set_ msg2='Please set shell or env. variable fw_db (to be the path to the framework source code). Fix this and other errors may go away.' -tnotnull fw_db && set_ db=`sh -c "cd $fw_db >/dev/null 2>&1 && pwd"` && vecho_ 'setting db from fw_db variable' || set_ db= - -test -z "$db" && tnotnull BASH_SOURCE && set_ me=`dirname $BASH_SOURCE` && set_ db=`sh -c "cd $me >/dev/null 2>&1 && pwd"` && vecho_ 'setting db via BASH_SOURCE' - -# history is applicable only for interactive t/csh -test -z "$db" -a "$ss" = csh && test $?history = 0 && set history=5 # make sure history 1 works -test -z "$db" -a "$ss" = csh && set me=`history 1|sed 's/^[ 0-9:]*//'` && test -n "$me" && set me=`dirname $me[2]` \ - && set db=`sh -c "cd $me >/dev/null 2>&1 && pwd"` && vecho_ 'setting db via interactive history' -#echo This script lives in $db - -test -z "$db" && echo "$msg2" || vecho_ "db=$db" -test -n "$db" && setenv CETPKG_SOURCE `dirname $db` - -# make sure we know the current directory -set_ myname=`whoami` -setenv CETPKG_BUILD /tmp/$myname/setup_deps -rm -rf $CETPKG_BUILD -mkdir -p $CETPKG_BUILD -#echo Build directory is $CETPKG_BUILD - -echo The source code directory is $CETPKG_SOURCE - -set_ msg5='ERROR: setup of required products has failed' - -echo ----------- check this block for errors ----------------------- -set_ setup_fail="false" -set_ exit_now="false" -set_ cetb=` grep -e '^[ \t]*cetbuildtools' $CETPKG_SOURCE/ups/product_deps | grep only_for_build| awk '{ print $1 }' ` -set_ cetv=` grep -e '^[ \t]*cetbuildtools' $CETPKG_SOURCE/ups/product_deps | grep only_for_build| awk '{ print $2 }' ` -#echo Found $cetb $cetv -setup -B $cetb $cetv -test "$?" = 0 || set_ setup_fail="true" -# now get the rest of the products -set_ cmd="$CETBUILDTOOLS_DIR/bin/set_dev_products $CETPKG_SOURCE $CETPKG_BUILD $*" -#echo Ready to run $cmd -source `$cmd` -test "$?" = 0 || set_ setup_fail="true" -#echo "$cmd returned $setup_fail" -test "$setup_fail" = "true" && echo "$msg5" -test "$setup_fail" = "true" && set_ exit_now="true" -test -e "$CETPKG_BUILD/diag_report" && cat $CETPKG_BUILD/diag_report -echo ---------------------------------------------------------------- - -test "${exit_now}" = "true" && test "$ss" = csh && unalias tnotnull nullout set_ vecho_ return -test "${exit_now}" = "true" && unset ss db me thisdir msg1 msg2 msg3 msg4 msg5 setup_fail set_ setenv unsetenv_ tnotnull nullout vecho_ -test "${exit_now}" = "true" && return 1 - -# final sanity check and report -source $CETBUILDTOOLS_DIR/bin/set_dep_check_report - -# cleanup before exiting -test "$ss" = csh && unalias tnotnull nullout set_ vecho_ return -unset ss db me thisdir msg1 msg2 msg3 msg4 msg5 setup_fail -unset set_ setenv unsetenv_ tnotnull nullout vecho_ diff --git a/ups/setup_for_development b/ups/setup_for_development index 8c5bedf1..2a186be1 100644 --- a/ups/setup_for_development +++ b/ups/setup_for_development @@ -1,96 +1,260 @@ -# NO USER-SERVICEABLE PARTS BELOW. +######################################################################## +# This script is shell-agnostic, which involves much acrobatics to avoid +# causing errors in one interpreter or another (*stares in csh*). # -# There should be as little as possible here, -# with most of the heavy lifting done by other small scripts +# There should be as little as possible here, with most of the heavy +# lifting done by other small scripts. # # When sourcing this file from a script, you may have to tell this -# source file where it is via the fw_db shell (or env) variable. -# I.e.: +# source file where it is via the fw_db shell (or env) variable, i.e. # set fw_db=/some/path; source /some/path/this_file # or fw_db=/some/path; . /some/path/this_file +# +# Generated by cetmodules 3.05.03 at Tue Feb 15 14:35:28 CST 2022 +######################################################################## + +######################################################################## +# NO USER-SERVICEABLE PARTS BELOW. +######################################################################## + +# Determine shell flavor. +true && test $?shell = 1 && set _cetpkg_shell_flavor=csh || _cetpkg_shell_flavor=sh + +#################################### +# A common set of commands to use to hide as many shell flavor +# differences as possible. + +################## +# IMPORTANT NOTE: +# +# Following extensive tests in multiple shells, I have reached the +# conclusion that it is not actually possible for a function to mirror +# the semantics of an assignment with respect to the status code of `` +# and compound statements joined with "||" or "&&". To handle this, we +# write a large chunk of shell code to a temporary file in the current +# directory a.k.a. CETPKG_BUILD with shell variable assignments correct +# according to the shell flavor, and then source it. This also allows us +# to deal with the fact that some shells don't pass arguments to sourced +# scripts *stares harder in csh*. +# +# 2020-06-24 CHG. +################## + +# If we're C-flavored, set up the commands using alias. +test "$_cetpkg_shell_flavor" = csh && \ + set _cetpkg_nobuild="" && \ + set _cetpkg_shell_var_set=set\\1 && \ + set _cetpkg_to_stderr="| sh -c 'cat 1>\\&2'" && \ + alias vecho_ 'if ($?vv == 1) echo \>\> \!*' && \ + alias unsetenv_ unsetenv && \ + alias tnotnull "eval '"'test $?'"\!* -eq 1' && eval '"'test -n "$'"\!*"'"'"'" && \ + alias nullout "\!* >& /dev/null" && \ + alias __TOP_EOF__ '' && \ + alias return exit + +# For Bourne-flavored shells, use functions. +test "$_cetpkg_shell_flavor" = sh && \ + _cetpkg_nobuild="" && \ + _cetpkg_shell_var_set= && \ + _cetpkg_to_stderr='1>\&2' && \ + eval 'vecho_() { test -n "${vv-}" && echo ">> $*"; return 0; }' && \ + eval 'setenv() { eval "$1=\"\${2-}\"; export $1"; }' && \ + eval 'unsetenv_() { unset "$@"; }' && \ + eval 'source() { . "$@"; }' && \ + eval 'tnotnull() { eval "test -n \"\${$1-}\""; }' && \ + eval 'nullout() { "$@" >/dev/null 2>&1; }' +#################################### + +################## +# Check for UPS (uses alias for return in C-flavored shells). +test -z "$UPS_DIR" && \ + ( echo ""; echo "ERROR: you MUST set up UPS"; echo "" ) && \ + return 1 || true +################## + +#################################### +# Need to find ourselves to set CETPKG_SOURCE. + +# Define empty variables for C-flavor shells to make things easier. +test "$_cetpkg_shell_flavor" = csh && \ + set _cetpkg_fw_db= _cetpkg_myself= _cetpkg_mydir= + +# If user has set fw_db, identify our top-level source directory now. +test "$_cetpkg_shell_flavor" = csh && tnotnull fw_db && \ + set _cetpkg_fw_db=`sh -c "cd $fw_db:q >/dev/null 2>&1 && /bin/pwd -P"` && \ + vecho_ "found ourselves through fw_db" || true +test "$_cetpkg_shell_flavor" = sh && tnotnull fw_db && \ + _cetpkg_fw_db=`sh -c "cd \"$fw_db\" >/dev/null 2>&1 && /bin/pwd -P"` && \ + vecho_ "found ourselves through fw_db" || true + +################## +# For Bash and zsh, identify ourselves now so we don't have to go +# through acrobatics later in the sourced script. +test "$_cetpkg_shell_flavor" = sh && tnotnull BASH_SOURCE && \ + _cetpkg_myself="$BASH_SOURCE" && test -n "$BASH_SOURCE" && \ + vecho_ "found ourselves through BASH_SOURCE" || true +test "$_cetpkg_shell_flavor" = sh -a -z "$_cetpkg_myself" && \ + tnotnull ZSH_VERSION && eval '_cetpkg_myself="${(%):-%x}"' && \ + test -n "$_cetpkg_myself" && \ + vecho_ "found ourselves through ZSH prompt logic" || true +test "$_cetpkg_shell_flavor" = sh && tnotnull _cetpkg_myself && \ + _cetpkg_mydir=`dirname "$_cetpkg_myself"` && \ + _cetpkg_fw_db=`sh -c "cd $_cetpkg_mydir >/dev/null 2>&1 && /bin/pwd -P"` || true +################## + +################## +# History is applicable only for interactive t/csh. +test -z "$_cetpkg_fw_db" -a "$_cetpkg_shell_flavor" = csh -a $?history = 0 && \ + set history=5 || true +test -z "$_cetpkg_fw_db" -a "$_cetpkg_shell_flavor" = csh && \ + set _cetpkg_mydir=`history 1|sed -Ee 's/^[[:space:][:digit:]:]*.*\bsource[[:space:]]+//'` && \ + test -n "$_cetpkg_mydir" && set _cetpkg_mydir=`dirname $_cetpkg_mydir[1]:q` && \ + set _cetpkg_fw_db=`sh -c "cd $_cetpkg_mydir:q >/dev/null 2>&1 && /bin/pwd -P"` && \ + vecho_ 'setting db via interactive history' || true +################## + +# Set CETPKG_SOURCE. +test -n "$_cetpkg_fw_db" && \ + vecho_ "_cetpkg_fw_db=$_cetpkg_fw_db" && \ + setenv CETPKG_SOURCE `dirname $_cetpkg_fw_db` || \ + printf "WARNING: please set shell or env. variable fw_db (to be the path to the\n\ + framework source code). Fix this and other errors may go away.\n" +#################################### + +################## +# Set CETPKG_BUILD. +setenv CETPKG_BUILD `/bin/pwd -P` +################## + +######################################################################## +# Write the rest of ourselves to a file and source it to handle status +# code semantics for variable assignments. +# +# Note that even here we have to play a trick or two due to the fact +# that we have to deal with the difference in the way sh- and csh-flavor +# shells handle a quoted delimiter word for a HERE document: the latter +# expect the delimiter to include the quoting; the former do not. This +# is the reason for the C-flavored __TOP_EOF__ alias, and the explicit +# return at the end of the sourced script. +# +######################################################################## + +sed -Ee 's&(^|[^[:alnum:]_])__SET__([[:space:]]+)&'$_cetpkg_shell_var_set'&g' \ + -e 's&__SETUP_ARGS__&'"$*"'&g' \ + -e 's&__TO_STDERR__&'"$_cetpkg_to_stderr"'&g' \ + > ./setup_common.$_cetpkg_shell_flavor <<\__TOP_EOF__ +######################################################################## + +#################################### +# Personality check: are we setup_deps or setup_for_development? +# +# If we're sourcing setup.in directly (e.g. for cetmodules itself) then +# we select "setup_for_development" behavior, otherwise _cetpkg_nobuild +# will be set appropriately by CMake's CONFIGURE() command for +# setup_for_development or setup_deps. + +test -z "$_cetpkg_nobuild" -o "$_cetpkg_nobuild" = "--nobuild" || \ + __SET__ _cetpkg_nobuild="" || true +#################################### + +#################################### +# Initial info. + +printf "\n"; +test -z "$_cetpkg_nobuild" && \ + echo "The working build directory is $CETPKG_BUILD" || true +cat <= 2.00.00" || true +test -n "$_cetpkg_status" -o -z "$_cetpkg_cetmsetup" || setup -B $_cetpkg_cetmsetup +test $? != 0 && __SET__ _cetpkg_status=1 && \ + echo "ERROR: setup of $_cetpkg_cetmsetup has failed" || true +test -z "$_cetpkg_status$_cetpkg_cetmsetup" && setenv PATH `dropit -sfe "$CETPKG_SOURCE/bin"` && __SET__ _cetpkg_cettop="$CETPKG_SOURCE" || true +test -z "$_cetpkg_status$_cetpkg_cettop" -a -n "$CETMODULES_DIR" && __SET__ _cetpkg_cettop="$CETMODULES_DIR" +#################################### + +######################################################################## +# A bootstrapped Perl environment is only needed if we're building +# cetmodules itself. + +test -n "$_cetpkg_status" || test -n "$CETMODULES_DIR" || \ + setup cetpkgsupport +test $? != 0 && __SET__ _cetpkg_status=1 && \ + echo "ERROR: setup of cetpkgsupport has failed" || true +test -n "$_cetpkg_status" || test -n "$CETMODULES_DIR" || \ + "$_cetpkg_cettop/libexec/bootstrap-perl-env" > \ + "$CETPKG_BUILD/bootstrap.log" +test $? != 0 && __SET__ _cetpkg_status=1 && \ + echo "ERROR: bootstrap of Perl environment for cetmodules has failed: see $CETPKG_BUILD/bootstrap.log" || true +test -n "$_cetpkg_status" || test -n "$CETMODULES_DIR" || \ + eval "`perl -I\"$CETPKG_BUILD/$CET_SUBDIR/CPAN/lib/perl5\" -Mlocal::lib=\"$CETPKG_BUILD/$CET_SUBDIR/CPAN\",\"$CETPKG_BUILD/$CET_SUBDIR/cpan_build\"\`test \$?shell = 1 && printf \",--shelltype=csh\"\``" +test $? != 0 && __SET__ _cetpkg_status=1 && \ + echo "ERROR: setup of Perl environment for cetmodules has failed" || true + +#################################### +# Generate the setup script to set up dependencies. + +test -n "$_cetpkg_status" || \ + __SET__ _cetpkg_setup="`${_cetpkg_cettop}/libexec/set_dev_products $_cetpkg_nobuild __SETUP_ARGS__`" +test $? != 0 -o -z "$_cetpkg_setup" && __SET__ _cetpkg_status=1 && \ + echo "ERROR: generation of setup script has failed" || true +#################################### + +#################################### +# Source the setup script to set up dependencies. + +test -n "$_cetpkg_status" || source "$_cetpkg_setup" +test $? != 0 && __SET__ _cetpkg_status=1 && \ + echo "ERROR: setup of required products has failed" || true +__SET__ _cetpkg_setup_errlog="$CETPKG_BUILD/cetpkg_setup.err" +test -s "$_cetpkg_setup_errlog" && cat "$_cetpkg_setup_errlog" || \ + rm -f "$_cetpkg_setup_errlog" +#################################### + +cat </dev/null 2>&1; }' -test "$ss" = csh && alias tnotnull "eval '"'test $?'"\!* -eq 1' && eval '"'test -n "$'"\!*"'"'"'" && alias nullout "\!* >& /dev/null" && alias unsetenv_ unsetenv -test "$ss" = csh && alias return exit - -set_ msg1='ERROR: You MUST setup ups' -test -z $UPS_DIR && ( echo ""; echo "$msg1"; echo "" ) && return - -set_ msg3='ERROR: You MUST specify either -o, -p, or -d' -set_ msg4='Usage: setup_for_development <-d|-o|-p> ' -test -z "$1" && ( echo ""; echo "$msg4"; echo "$msg3"; echo "" ) && return - -# make sure we know where this script lives -# now if we were passed a path or if not, we can figure it out (maybe if we are interactive) -# bash, zsh, ksh and tcsh pass params to a source file, csh does not. but someone will be writing csh scripts -set_ msg2='Please set shell or env. variable fw_db (to be the path to the framework source code). Fix this and other errors may go away.' -tnotnull fw_db && set_ db=`sh -c "cd $fw_db >/dev/null 2>&1 && pwd"` && vecho_ 'setting db from fw_db variable' || set_ db= - -test -z "$db" && tnotnull BASH_SOURCE && set_ me=`dirname $BASH_SOURCE` && set_ db=`sh -c "cd $me >/dev/null 2>&1 && pwd"` && vecho_ 'setting db via BASH_SOURCE' - -# history is applicable only for interactive t/csh -test -z "$db" -a "$ss" = csh && test $?history = 0 && set history=5 # make sure history 1 works -test -z "$db" -a "$ss" = csh && set me=`history 1|sed 's/^[ 0-9:]*//'` && test -n "$me" && set me=`dirname $me[2]` \ - && set db=`sh -c "cd $me >/dev/null 2>&1 && pwd"` && vecho_ 'setting db via interactive history' -#echo This script lives in $db - -test -z "$db" && echo "$msg2" || vecho_ "db=$db" -test -n "$db" && setenv CETPKG_SOURCE `dirname $db` - -# make sure we know the current directory -setenv CETPKG_BUILD `pwd` -#echo Build directory is $CETPKG_BUILD - -echo The working build directory is $CETPKG_BUILD -echo The source code directory is $CETPKG_SOURCE - -set_ msg5='ERROR: setup of required products has failed' - -echo ----------- check this block for errors ----------------------- -set_ setup_fail="false" -set_ exit_now="false" -set_ cetb=` grep -e '^[ \t]*cetbuildtools' $CETPKG_SOURCE/ups/product_deps | grep only_for_build| awk '{ print $1 }' ` -set_ cetv=` grep -e '^[ \t]*cetbuildtools' $CETPKG_SOURCE/ups/product_deps | grep only_for_build| awk '{ print $2 }' ` -#echo Found $cetb $cetv -setup -B $cetb $cetv -test "$?" = 0 || set_ setup_fail="true" -# now get the rest of the products -set_ cmd="$CETBUILDTOOLS_DIR/bin/set_dev_products $CETPKG_SOURCE $CETPKG_BUILD $*" -#echo Ready to run $cmd -source `$cmd` -test "$?" = 0 || set_ setup_fail="true" -#echo "$cmd returned $setup_fail" -test "$setup_fail" = "true" && echo "$msg5" -test "$setup_fail" = "true" && set_ exit_now="true" -test -e "$CETPKG_BUILD/diag_report" && cat $CETPKG_BUILD/diag_report -echo ---------------------------------------------------------------- - -test "${exit_now}" = "true" && test "$ss" = csh && unalias tnotnull nullout set_ vecho_ return -test "${exit_now}" = "true" && unset ss db me thisdir msg1 msg2 msg3 msg4 msg5 setup_fail set_ setenv unsetenv_ tnotnull nullout vecho_ -test "${exit_now}" = "true" && return 1 - -# add lib to LD_LIBRARY_PATH -source $CETBUILDTOOLS_DIR/bin/set_dev_lib -# add bin to path -source $CETBUILDTOOLS_DIR/bin/set_dev_bin -# set FHICL_FILE_PATH -source $CETBUILDTOOLS_DIR/bin/set_dev_fhicl -# set FW_SEARCH_PATH -source $CETBUILDTOOLS_DIR/bin/set_dev_fwsearch - -# final sanity check and report -source $CETBUILDTOOLS_DIR/bin/set_dev_check_report - -# cleanup before exiting -test "$ss" = csh && unalias tnotnull nullout set_ vecho_ return -unset ss db me thisdir msg1 msg2 msg3 msg4 msg5 setup_fail -unset set_ setenv unsetenv_ tnotnull nullout vecho_ +source ./setup_common.$_cetpkg_shell_flavor