-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathsetup_runtime.sh.in
More file actions
executable file
·93 lines (79 loc) · 2.44 KB
/
setup_runtime.sh.in
File metadata and controls
executable file
·93 lines (79 loc) · 2.44 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
# Everything beyond this point will be determined relatively
# from this path.
install_prefix="@CMAKE_INSTALL_PREFIX@"
function cleanup {
unset cleanup install_prefix library_paths python_paths executable_paths
}
# Try to prevent the user from sourcing twice,
# which can lead to errors.
if [ -n "${UVCDAT_SETUP_PATH}" ] ; then
if [ "${UVCDAT_SETUP_PATH}" = "${install_prefix}" ] ; then
echo "Nothing to do since UVCDAT is already setup at: ${UVCDAT_SETUP_PATH}" 1>&2
cleanup
return 0
else
echo "INFO: UVCDAT setup was previously sourced at: ${UVCDAT_SETUP_PATH}" 1>&2
echo "INFO: There is no need to run setup_runtime manually anymore." 1>&2
echo "INFO: Open a new shell in order to use a different install location." 1>&2
cleanup
return 0
fi
fi
# Check that the install prefix exists, otherwise stop.
if [ ! -d "${install_prefix}" ] ; then
echo "ERROR: ${install_prefix} is not a directory." 1>&2
cleanup
return 1
fi
# cmake set variables
library_paths=( @SETUP_LIBRARY_PATHS@ )
python_paths=( @SETUP_PYTHON_PATHS@ )
executable_paths=( @SETUP_EXECUTABLE_PATHS@ )
export UVCDAT_PROMPT_STRING=@UVCDAT_PROMPT_STRING@
if [ "$UVCDAT_ENABLE_PROMPT_BEGINNING" ] ; then
export PS1="[@UVCDAT_PROMPT_STRING@]$PS1"
fi
if [ "$UVCDAT_ENABLE_PROMPT_END" ] ; then
export PS1="$PS1[@UVCDAT_PROMPT_STRING@]"
fi
if [ -d '@QT_LIB_DIR@' ] ; then
LD_LIBRARY_PATH='@QT_LIB_DIR@:'"${LD_LIBRARY_PATH}"
fi
for d in "${library_paths[@]}" ; do
f="${install_prefix}/${d}"
if [ -d "${f}" ] ; then
LD_LIBRARY_PATH="${f}:${LD_LIBRARY_PATH}"
fi
done
if [ `uname` = 'Darwin' ] ; then
export DYLD_FALLBACK_LIBRARY_PATH="${LD_LIBRARY_PATH}"
fi
for d in "${python_paths[@]}" ; do
f="${install_prefix}/${d}"
if [ -d "${f}" ] ; then
PYTHONPATH="${f}:${PYTHONPATH}"
fi
unset f
done
for d in "${executable_paths[@]}" ; do
f="${install_prefix}/${d}"
if [ -d "${f}" ] ; then
PATH="${f}:${PATH}"
fi
unset f
done
if [ -d "${install_prefix}/Externals/lib/R" ] ; then
export R_HOME="${install_prefix}/Externals/lib/R"
fi
export OPAL_PREFIX="${install_prefix}/Externals"
export LIBOVERLAY_SCROLLBAR=0
export PATH
export LD_LIBRARY_PATH
export PYTHONPATH
export UVCDAT_SETUP_PATH="${install_prefix}"
cleanup
echo "Successfully updated your environment to use UVCDAT" 1>&2
echo "(changes are valid for this session/terminal only)" 1>&2
echo "Version: ${UVCDAT_PROMPT_STRING}" 1>&2
echo "Location: ${UVCDAT_SETUP_PATH}" 1>&2
return 0