Skip to content
Snippets Groups Projects
Verified Commit 25fd2f35 authored by Alberto Miranda's avatar Alberto Miranda :hotsprings:
Browse files

dep_scripts: Allow install scripts to easily check the provided dependencies

parent 8a0867c8
No related branches found
No related tags found
1 merge request!111Resolve "Various issues with dependency scripts"
Pipeline #2095 passed
......@@ -330,6 +330,41 @@ determine_compiler() {
fi
}
# Check whether the loaded profile defines a particular dependency name.
# The function requires a valid bash regex argument to do the search. The
# function is meant to be used in a conditional context.
#
# Examples:
# 1. Check whether any flavor of 'libfabric' is defined by the profile:
#
# if profile_has_dependency "^libfabric%.*$"; then
# echo "libfabric found"
# fi
#
# 2. Check whether a specific flavor of 'libfabric' is defined by the profile:
#
# if profile_has_dependency "^libfabric%experimental$"; then
# echo "libfabric.experimental found"
# fi
profile_has_dependency() {
if [[ "$#" -ne 1 ]]; then
>&2 echo "FATAL: Missing argument in profile_has_dependency()"
exit 1
fi
regex="$1"
for name in "${PROFILE_DEP_LIST[@]}"; do
if [[ "${name}" =~ ${regex} ]]; then
return 0
fi
done
return 1
}
POSITIONAL=()
while [[ $# -gt 0 ]]; do
......
......@@ -45,8 +45,6 @@
pkg_install() {
set -x
# if the profile compiles bmi, enable it
if [[ -n "${PROFILE_DEP_NAMES['bmi']}" ]]; then
USE_BMI="-DNA_USE_BMI:BOOL=ON"
......@@ -54,8 +52,8 @@ pkg_install() {
USE_BMI="-DNA_USE_BMI:BOOL=OFF"
fi
# if the profile compiles libfabric, enable it
if [[ -n "${PROFILE_DEP_NAMES['libfabric']}" ]]; then
# if the profile provides any flavour of libfabric, enable it
if profile_has_dependency "^libfabric.*$"; then
USE_OFI="-DNA_USE_OFI:BOOL=ON"
else
USE_OFI="-DNA_USE_OFI:BOOL=OFF"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment