diff --git a/eb_hooks.py b/eb_hooks.py index e855d99a..f14e36fb 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -943,6 +943,24 @@ def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs): raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!") +def pre_configure_hook_cmake_system(self, *args, **kwargs): + """ + pre-configure hook for CMake built with SYSTEM toolchain: + - remove configure options that link to ncurses static libraries for CMake with system toolchain; + see also https://github.com/EESSI/software-layer/issues/1175 + """ + + if self.name == 'CMake': + if is_system_toolchain(self.toolchain.name): + self.log.info("Removing configure options that require ncurses static libraries...") + self.log.info(f"Original configopts value: {self.cfg['configopts']}") + regex = re.compile("-DCURSES_[A-Z]+_LIBRARY=\$EBROOTNCURSES/lib/lib[a-z]+\.a") + self.cfg['configopts'] = regex.sub(self.cfg['configopts'], '') + self.log.info(f"Updated configopts value: {self.cfg['configopts']}") + else: + raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!") + + def pre_test_hook(self, *args, **kwargs): """Main pre-test hook: trigger custom functions based on software name.""" if self.name in PRE_TEST_HOOKS: @@ -1484,6 +1502,7 @@ def post_easyblock_hook(self, *args, **kwargs): 'LAMMPS': pre_configure_hook_LAMMPS_zen4, 'Score-P': pre_configure_hook_score_p, 'VSEARCH': pre_configure_hook_vsearch, + 'CMake': pre_configure_hook_cmake_system, } PRE_TEST_HOOKS = {