Skip to content

Commit 6e27876

Browse files
authored
Merge pull request #148 from Crivella/feature-GraphvizHook
Add hook to restore filtered deps for Graphviz
2 parents edd0fe4 + d61aebf commit 6e27876

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

eb_hooks.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,37 @@ def pre_configure_hook_extrae(self, *args, **kwargs):
10541054
else:
10551055
raise EasyBuildError("Extrae-specific hook triggered for non-Extrae easyconfig?!")
10561056

1057+
def pre_configure_hook_graphviz(self, *args, **kwargs):
1058+
"""Pre-configure hook for Graphviz:
1059+
- avoid undefined $EBROOTZLIB and $EBROOTLIBTOOL env vars during configure step
1060+
"""
1061+
if self.name == 'Graphviz':
1062+
eprefix = get_eessi_envvar('EPREFIX')
1063+
usr_dir = os.path.join(eprefix, 'usr')
1064+
1065+
for software in ('zlib', 'libtool'):
1066+
var_name = get_software_root_env_var_name(software)
1067+
env.setvar(var_name, usr_dir)
1068+
1069+
old_configopts = self.cfg['configopts']
1070+
old_items = set(filter(None, old_configopts.split(' ')))
1071+
1072+
# Replace --with-ltdl-lib and --with-zlibdir options defined in the EC to point to compat layer
1073+
lib_dir = os.path.join(usr_dir, 'lib64')
1074+
new_items = set()
1075+
# Add to the new_items all the old items except the `--with-ltdl-lib` and `--with-ltdl-lib` for
1076+
# which we fix the lib dir to lib64 instead of lib
1077+
for item in old_items:
1078+
if item.startswith('--with-ltdl-lib'):
1079+
new_items.add(f'--with-ltdl-lib={lib_dir}')
1080+
elif item.startswith('--with-zlibdir'):
1081+
new_items.add(f'--with-zlibdir={lib_dir}')
1082+
else:
1083+
new_items.add(item)
1084+
1085+
self.cfg['configopts'] = ' '.join(new_items)
1086+
else:
1087+
raise EasyBuildError("Graphviz-specific hook triggered for non-Graphviz easyconfig?!")
10571088

10581089
def pre_configure_hook_gobject_introspection(self, *args, **kwargs):
10591090
"""
@@ -1815,6 +1846,7 @@ def post_easyblock_hook(self, *args, **kwargs):
18151846
'CUDA-Samples': pre_configure_hook_CUDA_Samples_test_remove,
18161847
'GObject-Introspection': pre_configure_hook_gobject_introspection,
18171848
'Extrae': pre_configure_hook_extrae,
1849+
'Graphviz': pre_configure_hook_graphviz,
18181850
'GRASS': pre_configure_hook_grass,
18191851
'libfabric': pre_configure_hook_libfabric_disable_psm3_x86_64_generic,
18201852
'LLVM': pre_configure_hook_llvm,

0 commit comments

Comments
 (0)