Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 24 additions & 127 deletions rivet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- GCC-Toolchain:(?!osx)
- Python
- make
- alibuild-recipe-tools
prepend_path:
PYTHONPATH: "$RIVET_ROOT/lib/python/site-packages"
---
Expand All @@ -23,109 +24,42 @@
#
# 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 <<EOF > 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
source $INSTALLROOT/etc/profile.d/init.sh
EOF

# Make back-up of original for debugging - disable execute bit
Expand Down Expand Up @@ -153,50 +87,18 @@
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" <<EoF
#%Module1.0
proc ModulesHelp { } {
global version
puts stderr "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
}
set version $PKGVERSION-@@PKGREVISION@$PKGHASH@@
module-whatis "ALICE Modulefile for $PKGNAME $PKGVERSION-@@PKGREVISION@$PKGHASH@@"
# Dependencies
module load BASE/1.0 YODA/$YODA_NEEDED fastjet/$FASTJET_NEEDED HepMC3/$HEPMC3_NEEDED
# Our environment
set RIVET_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
setenv RIVET_ROOT \$RIVET_ROOT
setenv RIVET_ANALYSIS_PATH \$RIVET_ROOT/lib/Rivet
setenv RIVET_DATA_PATH \$RIVET_ROOT/share/Rivet
prepend-path PYTHONPATH \$RIVET_ROOT/lib/$PYVER/site-packages
prepend-path PYTHONPATH \$RIVET_ROOT/lib64/$PYVER/site-packages
prepend-path PATH \$RIVET_ROOT/bin
prepend-path LD_LIBRARY_PATH \$RIVET_ROOT/lib
alibuild-generate-module --bin --lib > $MODULEFILE

Check notice on line 95 in rivet.sh

View workflow job for this annotation

GitHub Actions / alidistlint

Double quote to prevent globbing and word splitting. [SC2086]
cat >> "$MODULEFILE" <<EoF
setenv RIVET_ROOT \$PKG_ROOT
setenv RIVET_ANALYSIS_PATH \$PGK_ROOT/lib/Rivet
Comment thread
jackal1-66 marked this conversation as resolved.
Outdated
Comment thread
ktf marked this conversation as resolved.
Outdated
setenv RIVET_DATA_PATH \$PKG_ROOT/share/Rivet
prepend-path PYTHONPATH \$PKG_ROOT/lib/$PYVER/site-packages
prepend-path PYTHONPATH \$PKG_ROOT/lib64/$PYVER/site-packages

# Producing plots with (/rivet/bin/make-plots, in python) requires dedicated LaTeX packages
# which are not always there on the system (alidock, lxplus ...)
Expand All @@ -217,8 +119,3 @@
setenv LATEXINPUTS \$Old_TEXINPUTS:\$Extra_RivetTEXINPUTS
EoF


#
# EOF
#