forked from alisw/alidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lhapdf.sh
74 lines (67 loc) · 2.09 KB
/
lhapdf.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package: lhapdf
version: "%(tag_basename)s"
tag: alice/v6.1.5
source: https://github.com/alisw/LHAPDF
requires:
- yaml-cpp
- boost
- Python-modules
build_requires:
- autotools
env:
LHAPATH: "$LHAPDF_ROOT/share/LHAPDF"
---
#!/bin/bash -ex
case $ARCHITECTURE in
osx*)
# If we preferred system tools, we need to make sure we can pick them up.
[[ ! $YAML_CPP_ROOT ]] && YAML_CPP_ROOT=`brew --prefix yaml-cpp`
[[ ! $BOOST_ROOT ]] && BOOST_ROOT=`brew --prefix boost`
[[ ! $AUTOTOOLS_ROOT ]] && PATH=$PATH:`brew --prefix gettext`/bin
;;
*)
EXTRA_LD_FLAGS="-Wl,--no-as-needed"
;;
esac
rsync -a --exclude '**/.git' $SOURCEDIR/ ./
case $PKGVERSION in
v6.0*) WITH_YAML_CPP="--with-yaml-cpp=${YAML_CPP_ROOT}"
esac
if [[ "$BOOST_ROOT" != '' ]]; then
export LDFLAGS="$EXTRA_LD_FLAGS -L${BOOST_ROOT}/lib"
export CXXFLAGS="-I${BOOST_ROOT}/include"
fi
export LIBRARY_PATH="$LD_LIBRARY_PATH"
autoreconf -ivf
./configure --prefix=$INSTALLROOT \
${BOOST_ROOT:+--with-boost="$BOOST_ROOT"} \
$WITH_YAML_CPP
make ${JOBS+-j $JOBS} all
make install
PDFSETS="cteq6l1"
$INSTALLROOT/bin/lhapdf install $PDFSETS
# Check if PDF sets were really installed
for P in $PDFSETS; do
ls $INSTALLROOT/share/LHAPDF/$P
done
# 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 ${YAML_CPP_VERSION:+yaml-cpp/$YAML_CPP_VERSION-$YAML_CPP_REVISION} ${BOOST_VERSION:+boost/$BOOST_VERSION-$BOOST_REVISION}
# Our environment
setenv LHAPDF_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
setenv LHAPATH \$::env(LHAPDF_ROOT)/share/LHAPDF
prepend-path PATH $::env(LHAPDF_ROOT)/bin
prepend-path LD_LIBRARY_PATH $::env(LHAPDF_ROOT)/lib
$([[ ${ARCHITECTURE:0:3} == osx ]] && echo "prepend-path DYLD_LIBRARY_PATH $::env(LHAPDF_ROOT)/lib")
EoF