5 # designed to work on Jenkins
6 # this is a proof of concept script
8 # Chris Hilgenberg 8 April 2021
9 # copied from garsoft build script, originally written by Tom Junk
11 echo "garana version: $GARANA_VERSION"
12 echo "target qualifier: $QUAL"
13 echo "build type: $BUILDTYPE"
14 echo "workspace: $WORKSPACE"
16 # Don't do ifdh build on macos.
18 #if uname | grep -q Darwin; then
19 # if ! echo $QUAL | grep -q noifdh; then
20 # echo "Ifdh build requested on macos. Quitting."
25 # Get number of cores to use.
27 if [ `uname` = Darwin ]; then
28 #ncores=`sysctl -n hw.ncpu`
29 #ncores=$(( $ncores / 4 ))
32 ncores=`cat /proc/cpuinfo 2>/dev/null | grep -c -e '^processor'`
34 if [ $ncores -lt 1 ]; then
37 echo "Building using $ncores cores."
39 # Environment setup, uses cvmfs.
41 echo "ls /cvmfs/dune.opensciencegrid.org/products/dune/"
42 ls /cvmfs/dune.opensciencegrid.org/products/dune/
45 echo "ls /cvmfs/larsoft.opensciencegrid.org/products/"
46 ls /cvmfs/larsoft.opensciencegrid.org/products/
49 echo "ls /cvmfs/fermilab.opensciencegrid.org/products/common/db"
50 ls /cvmfs/fermilab.opensciencegrid.org/products/common/db
53 if [ `uname` = Darwin -a -f /grid/fermiapp/products/dune/setup_dune_fermiapp.sh ]; then
54 source /grid/fermiapp/products/dune/setup_dune_fermiapp.sh || exit 1
55 elif [ -f /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh ]; then
56 if [ -x /cvmfs/grid.cern.ch/util/cvmfs-uptodate ]; then
57 /cvmfs/grid.cern.ch/util/cvmfs-uptodate /cvmfs/dune.opensciencegrid.org/products
59 source /cvmfs/dune.opensciencegrid.org/products/dune/setup_dune.sh || exit 1
61 echo "No setup file found."
65 # skip around a version of mrb that does not work on macOS
67 if [ `uname` = Darwin ]; then
68 if [[ x`which mrb | grep v1_17_02` != x ]]; then
70 setup mrb v1_16_02 || exit 1
74 # Use system git on macos.
76 if ! uname | grep -q Darwin; then
79 setup gitflow || exit 1
80 export MRB_PROJECT=dune
85 rm -rf $WORKSPACE/temp || exit 1
86 mkdir -p $WORKSPACE/temp || exit 1
87 mkdir -p $WORKSPACE/copyBack || exit 1
88 rm -f $WORKSPACE/copyBack/* || exit 1
89 cd $WORKSPACE/temp || exit 1
91 FQUAL=${QUAL}:${BUILDTYPE}
93 mrb newDev -v $GARANA_VERSION -q $FQUAL || exit 1
96 source localProducts*/setup || exit 1
98 #echo "Chris MRB_SOURCE: ${MRB_SOURCE}"
99 #echo "Chris MRB_BUILDDIR: ${MRB_BUILDDIR}"
101 # some shenanigans so we can use getopt v1_1_6
102 if [ `uname` = Darwin ]; then
104 # curl --fail --silent --location --insecure -O http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 || \
106 #ERROR: pull of http://scisoft.fnal.gov/scisoft/packages/getopt/v1_1_6/getopt-1.1.6-d13-x86_64.tar.bz2 failed
110 # tar xf getopt-1.1.6-d13-x86_64.tar.bz2 || exit 1
111 setup getopt v1_1_6 || exit 1
116 cd $MRB_SOURCE || exit 1
117 # check out a readonly version
118 #mrb g -r -t $GARANA_VERSION -d garana garana-garana || exit 1
119 #mrb g -r -t $GARANA_VERSION garana || exit 1
120 mrb g -r -t $GARANA_VERSION https://www.github.com/DUNE/garana || exit
121 cd $MRB_BUILDDIR || exit 1
124 mrb b -D BUILD_W_CET=ON -j$ncores || exit 1
125 mrb mp -n garana -- -j$ncores || exit 1
130 if uname | grep -q Darwin; then
139 mv *.bz2 $WORKSPACE/copyBack/ || exit 1
141 ls -l $WORKSPACE/copyBack/
142 cd $WORKSPACE || exit 1
143 rm -rf $WORKSPACE/temp || exit 1