diff --git a/rivet.sh b/rivet.sh index 77a680bb2b..ff60fc4d29 100644 --- a/rivet.sh +++ b/rivet.sh @@ -14,6 +14,7 @@ build_requires: - GCC-Toolchain:(?!osx) - Python - make + - alibuild-recipe-tools prepend_path: PYTHONPATH: "$RIVET_ROOT/lib/python/site-packages" --- @@ -23,109 +24,42 @@ prepend_path: # # aliBuild -a slc7_x86-64 --docker-image registry.cern.ch/alisw/slc7-builder:latest. Rivet # -rsync -a --exclude='**/.git' --delete --delete-excluded "$SOURCEDIR"/ ./ +rsync -a --chmod=ugo=rwX --delete --exclude '**/.git' --delete-excluded "$SOURCEDIR"/ ./ -( -unset PYTHON_VERSION autoreconf -ivf -# Write script to set-up variables to point to third-party tools -cat < rivet_3rdparty.sh -ret=true -env_err() { - echo "\${@}" > /dev/stderr - ret=false -} - -if hash HepMC3-config 2>/dev/null && test x\$HEPMC3_ROOT = x ; then - HEPMC3_ROOT=\`HepMC3-config --prefix\` -fi -if hash yoda-config 2>/dev/null && test x\$YODA_ROOT = x ; then - YODA_ROOT=\`yoda-config --prefix\` -fi -if hash fastjet-config 2> /dev/null && test x\$FASTJET_ROOT = x ; then - FASTJET_ROOT=\`fastjet-config --prefix\` -fi - -test x\$HEPMC3_ROOT = x && env_err HepMC3 not found -test x\$YODA_ROOT = x && env_err Yoda not found -test x\$FASTJET_ROOT = x && env_err FastJet not found - -\$ret -EOF - -# source our newly created script -source rivet_3rdparty.sh - -CGAL_LDFLAGS="-L${CGAL_ROOT}/lib" -GMP_LDFLAGS="-L${GMP_ROOT}/lib" -LOCAL_LDFLAGS="${CGAL_LDFLAGS} ${GMP_LDFLAGS}" case $ARCHITECTURE in osx*) - ./configure --prefix="$INSTALLROOT" \ - --disable-silent-rules \ - --disable-doxygen \ - --with-yoda="$YODA_ROOT" \ - --with-hepmc3="$HEPMC3_ROOT" \ - --with-fastjet="$FASTJET_ROOT" \ - LDFLAGS="${LOCAL_LDFLAGS}" + export HDF5_ROOT=${HDF5_ROOT:-$(brew --prefix hdf5)} ;; *) - LOCAL_LDFLAGS="${LOCAL_LDFLAGS} -Wl,--no-as-needed" - ./configure --prefix="$INSTALLROOT" \ - --disable-silent-rules \ - --disable-doxygen \ - --with-yoda="$YODA_ROOT" \ - --with-hepmc3="$HEPMC3_ROOT" \ - --with-fastjet="$FASTJET_ROOT" \ - LDFLAGS="${LOCAL_LDFLAGS}" \ - CYTHON="$PYTHON_MODULES_ROOT/bin/cython" - ;; + EXTRA_LDFLAGS="-Wl,--no-as-needed" + ;; esac -# Fix-up rivet-build to include LDFLAGS - needed _before_ bulding -# After 3.1.9 this will not be needed. -SED_EXPR="s|^myldflags=\"\(.*\)\"|myldflags=\"\1 ${LOCAL_LDFLAGS}\"|" -sed -e "${SED_EXPR}" bin/rivet-build > bin/rivet-build.0 -mv bin/rivet-build bin/rivet-build.orig -mv bin/rivet-build.0 bin/rivet-build -chmod 0755 bin/rivet-build +./configure --prefix="$INSTALLROOT" \ + --disable-silent-rules \ + --disable-doxygen \ + --with-yoda="$YODA_ROOT" \ + --with-hepmc3="$HEPMC3_ROOT" \ + --with-fastjet="$FASTJET_ROOT" \ + LDFLAGS="${CGAL_ROOT:+-L${CGAL_ROOT}/lib} ${GMP_ROOT:+-L${GMP_ROOT}/lib} ${HDF5_ROOT:+-L${HDF5_ROOT}/lib} ${EXTRA_LDFLAGS}" \ + CPPFLAGS="${CGAL_ROOT:+-I${CGAL_ROOT}/include} ${GMP_ROOT:+-I${GMP_ROOT}/include} ${HDF5_ROOT:+-I${HDF5_ROOT}/include}" \ + CYTHON="$PYTHON_MODULES_ROOT/bin/cython" + # Remove -L/usr/lib from pyext/build.py -sed -e 's,-L/usr/lib[^ /"]*,,g' pyext/build.py > pyext/build.py.0 -mv pyext/build.py pyext/build.py.orig -mv pyext/build.py.0 pyext/build.py -# Make pyext/build.py executable -chmod 0755 pyext/build.py +sed -i.bak -e 's,-L/usr/lib[^ /"]*,,g' pyext/build.py # Now build make ${JOBS+-j $JOBS} make install -) # Remove libRivet.la rm -f "$INSTALLROOT"/lib/libRivet.la -# Install shell-script fragment to set-up variables -cp rivet_3rdparty.sh "$INSTALLROOT"/etc/rivet_3rdparty.sh - -# Dependencies relocation: rely on runtime environment. That is, -# specific paths in the generated script are replaced by expansions of -# the relevant environment variables. -SED_EXPR="s!x!x!" # noop -for P in $REQUIRES $BUILD_REQUIRES; do - UPPER=$(echo "$P" | tr '[:lower:]' '[:upper:]' | tr '-' '_') - EXPAND=$(eval echo \$"${UPPER}"_ROOT) - if [ -z "$EXPAND" ]; then - echo "Environment variable ${UPPER}_ROOT not set" - fi - [[ $EXPAND ]] || continue - echo "Environment says ${UPPER} is at ${EXPAND}" - SED_EXPR="$SED_EXPR; s!$EXPAND!\$${UPPER}_ROOT!g" -done - # Create line to source 3rdparty.sh to be inserted into # rivet-config and rivet-build cat << EOF > source3rd -test -f \$prefix/etc/rivet_3rdparty.sh && source \$prefix/etc/rivet_3rdparty.sh +WORK_DIR=${WORK_DIR:-$INSTALLROOT/../../../} source $INSTALLROOT/etc/profile.d/init.sh EOF # Make back-up of original for debugging - disable execute bit @@ -153,50 +87,18 @@ pushd "$INSTALLROOT"/lib || exit 1 ln -s "${PYVER}" python popd || exit 1 -# Make sure we get the YODA version we need -if test "x$YODA_VERSION" != "x" && test "x$YODA_REVISION" != "x" ; then - YODA_NEEDED=${YODA_VERSION}-${YODA_REVISION} -else - YODA_NEEDED=$(basename "$YODA_ROOT") -fi - -# Make sure we get the FASTJET version we need -if test "x$FASTJET_VERSION" != "x" && test "x$FASTJET_REVISION" != "x" ; then - FASTJET_NEEDED=${FASTJET_VERSION}-${FASTJET_REVISION} -else - FASTJET_NEEDED=$(basename "$FASTJET_ROOT") -fi - -# Make sure we get the HEPMC3 version we need -if test "x$HEPMC3_VERSION" != "x" && test "x$HEPMC3_REVISION" != "x" ; then - HEPMC3_NEEDED=${HEPMC3_VERSION}-${HEPMC3_REVISION} -else - HEPMC3_NEEDED=$(basename "$HEPMC3_ROOT") -fi # Modulefile MODULEDIR="$INSTALLROOT/etc/modulefiles" MODULEFILE="$MODULEDIR/$PKGNAME" mkdir -p "$MODULEDIR" -cat > "$MODULEFILE" < $MODULEFILE +cat >> "$MODULEFILE" <