forked from alisw/alidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluka_vmc.sh
71 lines (67 loc) · 2.19 KB
/
fluka_vmc.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
package: FLUKA_VMC
version: "%(tag_basename)s"
tag: "2011-3.0-vmc3"
source: https://gitlab.cern.ch/ALICEPrivateExternals/FLUKA_VMC.git
requires:
- "GCC-Toolchain:(?!osx)"
- ROOT
- FLUKA
build_requires:
- CMake
env:
FLUVMC: "$FLUKA_VMC_ROOT"
FLUPRO: "$FLUKA_VMC_ROOT"
prepend_path:
LD_LIBRARY_PATH: "$FLUKA_VMC_ROOT/lib64"
ROOT_INCLUDE_PATH: "$FLUKA_VMC_ROOT/include/TFluka"
---
#!/bin/bash -e
cmake $SOURCEDIR -DCMAKE_INSTALL_PREFIX=$INSTALLROOT \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
${CXXSTD:+-DCMAKE_CXX_STANDARD=$CXXSTD} \
-DCMAKE_SKIP_RPATH=TRUE \
-DFLUKA_ROOT=$FLUKA_ROOT \
-DFLUKAWITHDPMJET=TRUE
make ${JOBS:+-j $JOBS} install
[[ ! -d $INSTALLROOT/lib64 ]] && ln -sf lib $INSTALLROOT/lib64
rsync -av "$FLUKA_ROOT"/data "$INSTALLROOT/"
# Test load library
cat > loadFluka.C <<\EOF
#include <iostream>
#include <TSystem.h>
int loadFluka() {
const char *libs[] = { "libVMC", "libPhysics", "libEG", "libflukavmc" };
for (auto &lib : libs) {
if (gSystem->Load(lib) < 0) {
std::cout << "Cannot load library " << lib << std::endl;
return 1;
}
};
return 0;
}
EOF
export LD_LIBRARY_PATH=$INSTALLROOT/lib:$LD_LIBRARY_PATH
export ROOT_HIST=0
root -l -b -q -n loadFluka.C++
# 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 ${ROOT_REVISION:+ROOT/$ROOT_VERSION-$ROOT_REVISION} ${GCC_TOOLCHAIN_ROOT:+GCC-Toolchain/$GCC_TOOLCHAIN_VERSION-$GCC_TOOLCHAIN_REVISION}
# Our environment
set FLUKA_VMC_ROOT \$::env(BASEDIR)/$PKGNAME/\$version
setenv FLUKA_VMC_ROOT \$FLUKA_VMC_ROOT
setenv FLUVMC \$::env(BASEDIR)/$PKGNAME/\$version
setenv FLUPRO \$::env(BASEDIR)/$PKGNAME/\$version
setenv FLUKADATA \$::env(BASEDIR)/$PKGNAME/\$version/data
prepend-path LD_LIBRARY_PATH \$FLUKA_VMC_ROOT/lib
EoF