Skip to content

Commit ab688f8

Browse files
committed
Added hook to restore filtered deps for LLVM builds
1 parent 7a579c3 commit ab688f8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

eb_hooks.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_cpu_features
1515
from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC
1616
from easybuild.tools.version import VERSION as EASYBUILD_VERSION
17+
from easybuild.tools.modules import get_software_root_env_var_name
1718

1819
# prefer importing LooseVersion from easybuild.tools, but fall back to distuils in case EasyBuild <= 4.7.0 is used
1920
try:
@@ -654,6 +655,27 @@ def pre_configure_hook_gromacs(self, *args, **kwargs):
654655
raise EasyBuildError("GROMACS-specific hook triggered for non-GROMACS easyconfig?!")
655656

656657

658+
def pre_configure_hook_llvm(self, *args, **kwargs):
659+
"""Adjust internal configure options for the LLVM EasyBlock to reinstate filtered out dependencies.
660+
In the LLVM EasyBlock, most checks concerning loaded modules are performed at the configure_step.
661+
The EB uses a global `general_opts` dict to keep track of options that needs to be reused across stages.
662+
The way the EB is structured does allow to inject a CMAKE option through `self._cfgopts` which is a splitted list
663+
of the `configure_opts` passed through the EC, but does not allow to override as the `general_opts` dict will
664+
take precedence over the `self._cfgopts` list.
665+
666+
We can instead set the environment variable that EasyBuild uses for `get_software_root` to trick the EB into
667+
into pointing to the compat layer.
668+
"""
669+
if self.name == 'LLVM':
670+
eprefix = get_eessi_envvar('EPREFIX')
671+
672+
for software in ('zlib', 'ncurses'):
673+
var_name = get_software_root_env_var_name(software)
674+
env.setvar(var_name, os.path.join(eprefix, 'usr'))
675+
else:
676+
raise EasyBuildError("LLVM-specific hook triggered for non-LLVM easyconfig?!")
677+
678+
657679
def pre_configure_hook_openblas_optarch_generic(self, *args, **kwargs):
658680
"""
659681
Pre-configure hook for OpenBLAS: add DYNAMIC_ARCH=1 to build/test/install options when using --optarch=GENERIC
@@ -1227,6 +1249,7 @@ def post_module_hook(self, *args, **kwargs):
12271249
'Extrae': pre_configure_hook_extrae,
12281250
'GROMACS': pre_configure_hook_gromacs,
12291251
'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic,
1252+
'LLVM': pre_configure_hook_llvm,
12301253
'MetaBAT': pre_configure_hook_metabat_filtered_zlib_dep,
12311254
'OpenBLAS': pre_configure_hook_openblas_optarch_generic,
12321255
'WRF': pre_configure_hook_wrf_aarch64,

0 commit comments

Comments
 (0)