Skip to content

Commit 56ada04

Browse files
authored
Merge pull request #81 from pescobar/hook-cmake-system
add hook to avoid requiring ncurses static libraries for CMake built with `system` toolchain
2 parents 91a8a1d + f940c71 commit 56ada04

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

eb_hooks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,24 @@ def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs):
943943
raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!")
944944

945945

946+
def pre_configure_hook_cmake_system(self, *args, **kwargs):
947+
"""
948+
pre-configure hook for CMake built with SYSTEM toolchain:
949+
- remove configure options that link to ncurses static libraries for CMake with system toolchain;
950+
see also https://github.com/EESSI/software-layer/issues/1175
951+
"""
952+
953+
if self.name == 'CMake':
954+
if is_system_toolchain(self.toolchain.name):
955+
self.log.info("Removing configure options that require ncurses static libraries...")
956+
self.log.info(f"Original configopts value: {self.cfg['configopts']}")
957+
regex = re.compile("-DCURSES_[A-Z]+_LIBRARY=\$EBROOTNCURSES/lib/lib[a-z]+\.a")
958+
self.cfg['configopts'] = regex.sub(self.cfg['configopts'], '')
959+
self.log.info(f"Updated configopts value: {self.cfg['configopts']}")
960+
else:
961+
raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!")
962+
963+
946964
def pre_test_hook(self, *args, **kwargs):
947965
"""Main pre-test hook: trigger custom functions based on software name."""
948966
if self.name in PRE_TEST_HOOKS:
@@ -1484,6 +1502,7 @@ def post_easyblock_hook(self, *args, **kwargs):
14841502
'LAMMPS': pre_configure_hook_LAMMPS_zen4,
14851503
'Score-P': pre_configure_hook_score_p,
14861504
'VSEARCH': pre_configure_hook_vsearch,
1505+
'CMake': pre_configure_hook_cmake_system,
14871506
}
14881507

14891508
PRE_TEST_HOOKS = {

0 commit comments

Comments
 (0)