forked from habanero-rice/hclib
-
Notifications
You must be signed in to change notification settings - Fork 15
/
install.sh
executable file
·78 lines (60 loc) · 1.49 KB
/
install.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
75
76
77
78
#!/bin/bash
set -e
export CRAYPE_LINK_TYPE=dynamic
# Cmake, Make and Install
#
# Defining some variables
#
PROJECT_NAME=hclib
INSTALL_PREFIX=${INSTALL_PREFIX:=${PWD}/${PROJECT_NAME}-install}
: ${NPROC:=1}
#
# Cmake
#
echo "[${PROJECT_NAME}] Cmake..."
REPO_ROOT=$PWD
COMPTREE=$PWD/build
rm -rf ${COMPTREE}
mkdir -p ${COMPTREE}
cd ${COMPTREE}
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} $* ..
#
# Make
#
echo "[${PROJECT_NAME}] Make..."
make VERBOSE=1 -j${NPROC}
#
# Make install
#
# if install root has been specified, perform make install
echo "[${PROJECT_NAME}] Make install... to ${INSTALL_PREFIX}"
make -j${NPROC} install
echo "[${PROJECT_NAME}] Building system module..."
cd ../modules/system
rm -rf build
mkdir build; cd build
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} $* ..
make VERBOSE=1
make install
#
# Create environment setup script
#
# if install root has been specified, perform make install
HCLIB_ENV_SETUP_SCRIPT=${INSTALL_PREFIX}/bin/hclib_setup_env.sh
mkdir -p `dirname ${HCLIB_ENV_SETUP_SCRIPT}`
cat > "${HCLIB_ENV_SETUP_SCRIPT}" <<EOI
# HClib environment setup
export HCLIB_ROOT='${INSTALL_PREFIX}'
MY_OS=\$(uname -s)
if [ \${MY_OS} = "Darwin" ]; then
export DYLD_LIBRARY_PATH=\${HCLIB_ROOT}/lib:\$DYLD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=\${HCLIB_ROOT}/lib:\$LD_LIBRARY_PATH
fi
EOI
cat <<EOI
[${PROJECT_NAME}] Installation complete.
${PROJECT_NAME} installed to: ${INSTALL_PREFIX}
Add the following to your .bashrc (or equivalent):
source ${HCLIB_ENV_SETUP_SCRIPT}
EOI