/
pgi-compilers-2016-165_install
executable file
·82 lines (69 loc) · 2.74 KB
/
pgi-compilers-2016-165_install
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
75
76
77
78
79
80
81
#!/usr/bin/env bash
set -o errexit -o nounset
for i in ${includes_dir:=$(dirname $0 2>/dev/null)/includes}/{module_maker,require}_inc.sh; do . $i; done
package_name="pgi"
package_version="16.5"
src_urls=/shared/ucl/apps/pkg-store/pgilinux-20${package_version:0:2}-${package_version:0:2}${package_version##*\.}-x86_64.tar.gz
# Optional:
# package_variant=""
package_description="The PGI Compilers are primarily installed to build Gaussian, which is not compatible with other compilers. Please do not use these over the Intel or GNU compilers unless you have a good reason for doing so."
actual_file_name=$src_urls
actual_file_md5=a40e8852071b5d600cb42f31631b3de1
actual_file_sha=8bfeaaf9b0ca9bb9c710ac2654432aad7bab2f3e
module purge
require gcc-libs/4.9.2
require compilers/gnu/4.9.2
# This isn't needed during install, just to create the modulefile
LM_LICENSE_FILE=27000@lic-pgi.ucl.ac.uk
_env_setup() {
owd=$(pwd)
package_label="${package_name}/${package_version}${package_variant:+-${package_variant}}/${COMPILER_TAG}"
install_prefix=${INSTALL_PREFIX:-/shared/ucl/apps/$package_label}
build_dir=${BUILD_DIR:-$(mktemp -d -t ${package_name}-build.XXXXXXXX)}
module_dir=${MODULE_DIR:-$(mktemp -d -t ${package_name}-modules.XXXXXXXX)}
basename=${basename:-$(basename -s .tar.gz $(cut -f 1 -d ' ' <<<$src_urls))}
cd $build_dir
}
_fetch_files() {
echo -n "Checking MD5: "
md5sum -c <<<"$actual_file_md5 $actual_file_name"
echo -n "Checking SHA: "
shasum -c <<<"$actual_file_sha $actual_file_name"
}
_setup_files() {
cd $build_dir
tar -xpf $actual_file_name
}
_build() {
cd $build_dir
export PGI_SILENT=true
export PGI_ACCEPT_EULA=accept
export PGI_INSTALL_TYPE=network
export PGI_INSTALL_DIR=$install_prefix
export PGI_INSTALL_LOCAL_DIR=$install_prefix
./install
echo "Installed to: $install_prefix"
}
_prepare_module() {
mkdir -p $module_dir/compilers/pgi/20${package_version}
cp -v $install_prefix/modulefiles/pgi64/${package_version} $module_dir/compilers/pgi/20${package_version}/${COMPILER_TAG}
echo "# Customisation below" >> $module_dir/compilers/pgi/20${package_version}/${COMPILER_TAG}
echo "setenv COMPILER_TAG pgi-20${package_version}" >> $module_dir/compilers/pgi/20${package_version}/${COMPILER_TAG}
echo "conflict compilers" >> $module_dir/compilers/pgi/20${package_version}/${COMPILER_TAG}
echo "prereq gcc-libs/4.9.2" >> $module_dir/compilers/pgi/20${package_version}/${COMPILER_TAG}
echo "setenv LM_LICENSE_FILE $LM_LICENSE_FILE" >> $module_dir/compilers/pgi/20${package_version}/${COMPILER_TAG}
echo "Module files put in: $module_dir" >&2
chmod a+rx $module_dir
}
_clean_up() {
cd $owd
if [ -n "$build_dir" ]; then
rm -Rf ${build_dir}
fi
}
_env_setup
_fetch_files
_setup_files
_build
_prepare_module
_clean_up