Commit 5f3090e3 authored by Blaise Li's avatar Blaise Li
Browse files

Try to ignore environment modules absence.

parent 10a0f0e6
......@@ -14,6 +14,11 @@ function error_exit
exit 1
}
function try_load_gmp_module
{
(module --version 2> /dev/null && module load gmp) || :
}
config_file="${HOME}/.stack/config.yaml"
stack --version 2> /dev/null \
......@@ -22,7 +27,7 @@ stack --version 2> /dev/null \
if [ "${config_file}" ]
then
stack exec -- ghc --version > /dev/null \
|| (module load gmp \
|| (try_load_gmp_module \
&& stack setup \
&& INCLUDE_PATH=$(echo ${CMAKE_INCLUDE_PATH} | tr ":" ",") \
&& LIBRARY_PATH=$(echo ${CMAKE_LIBRARY_PATH} | tr ":" ",") \
......@@ -37,7 +42,7 @@ then
}
else
stack exec -- ghc --version > /dev/null \
|| (module load gmp && stack setup) \
|| (try_load_gmp_module && stack setup) \
|| error_exit "stack setup failed"
# https://unix.stackexchange.com/a/60690/55127
# Delay variable evaluation in order to adapt to loaded libraries
......@@ -50,13 +55,13 @@ fi
# cd ${HOME} to ignore local project stack config
hlint --version 2> /dev/null \
|| (module load gmp && (cd ${HOME} && make_stack_options && stack ${stack_options} install hlint)) \
|| (try_load_gmp_module && (cd ${HOME} && make_stack_options && stack ${stack_options} install hlint)) \
|| error_exit "hlint install failed"
scan --version 2> /dev/null \
|| (module load gmp && (cd ${HOME} && make_stack_options && stack ${stack_options} install scan)) \
|| (try_load_gmp_module && (cd ${HOME} && make_stack_options && stack ${stack_options} install scan)) \
|| error_exit "scan install failed"
doctest --version 2> /dev/null \
|| (module load gmp && (cd ${HOME} && make_stack_options && stack ${stack_options} install doctest)) \
|| (try_load_gmp_module && (cd ${HOME} && make_stack_options && stack ${stack_options} install doctest)) \
|| error_exit "doctest install failed"
make_stack_options
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment