11
11
from easybuild .tools .systemtools import AARCH64 , POWER , X86_64 , get_cpu_architecture , get_cpu_features
12
12
from easybuild .tools .toolchain .compiler import OPTARCH_GENERIC
13
13
14
+ # prefer importing LooseVersion from easybuild.tools, but fall back to distutils
15
+ # in case EasyBuild <= 4.7.0 is used
16
+ try :
17
+ from easybuild .tools import LooseVersion
18
+ except ImportError :
19
+ from distutils .version import LooseVersion
20
+
21
+
14
22
EESSI_RPATH_OVERRIDE_ATTR = 'orig_rpath_override_dirs'
15
23
16
24
@@ -56,11 +64,11 @@ def parse_hook(ec, *args, **kwargs):
56
64
PARSE_HOOKS [ec .name ](ec , eprefix )
57
65
58
66
59
- def pre_configure_hook (self , * args , ** kwargs ):
60
- """Main pre-configure hook: trigger custom functions based on software name."""
61
-
62
- if self .name in PRE_CONFIGURE_HOOKS :
63
- PRE_CONFIGURE_HOOKS [self .name ](self , * args , ** kwargs )
67
+ # def pre_configure_hook(self, *args, **kwargs):
68
+ # """Main pre-configure hook: trigger custom functions based on software name."""
69
+ #
70
+ # if self.name in PRE_CONFIGURE_HOOKS:
71
+ # PRE_CONFIGURE_HOOKS[self.name](self, *args, **kwargs)
64
72
65
73
66
74
def pre_prepare_hook (self , * args , ** kwargs ):
@@ -91,10 +99,11 @@ def pre_prepare_hook(self, *args, **kwargs):
91
99
mpi_family , rpath_override_dirs )
92
100
93
101
94
- def gcc_postprepare (self , * args , ** kwargs ):
102
+ def post_prepare_hook_gcc_prefixed_ld_rpath_wrapper (self , * args , ** kwargs ):
95
103
"""
96
104
Post-configure hook for GCCcore:
97
- - copy RPATH wrapper script for linker commands to also have a wrapper in place with system type prefix like 'x86_64-pc-linux-gnu'
105
+ - copy RPATH wrapper script for linker commands to also have a wrapper in
106
+ place with system type prefix like 'x86_64-pc-linux-gnu'
98
107
"""
99
108
if self .name == 'GCCcore' :
100
109
config_guess = obtain_config_guess ()
@@ -121,6 +130,7 @@ def gcc_postprepare(self, *args, **kwargs):
121
130
else :
122
131
raise EasyBuildError ("GCCcore-specific hook triggered for non-GCCcore easyconfig?!" )
123
132
133
+
124
134
def post_prepare_hook (self , * args , ** kwargs ):
125
135
"""Main post-prepare hook: trigger custom functions."""
126
136
@@ -134,7 +144,7 @@ def post_prepare_hook(self, *args, **kwargs):
134
144
POST_PREPARE_HOOKS [self .name ](self , * args , ** kwargs )
135
145
136
146
137
- def cgal_toolchainopts_precise (ec , eprefix ):
147
+ def parse_hook_cgal_toolchainopts_precise (ec , eprefix ):
138
148
"""Enable 'precise' rather than 'strict' toolchain option for CGAL on POWER."""
139
149
if ec .name == 'CGAL' :
140
150
if get_cpu_architecture () == POWER :
@@ -147,7 +157,7 @@ def cgal_toolchainopts_precise(ec, eprefix):
147
157
raise EasyBuildError ("CGAL-specific hook triggered for non-CGAL easyconfig?!" )
148
158
149
159
150
- def fontconfig_add_fonts (ec , eprefix ):
160
+ def parse_hook_fontconfig_add_fonts (ec , eprefix ):
151
161
"""Inject --with-add-fonts configure option for fontconfig."""
152
162
if ec .name == 'fontconfig' :
153
163
# make fontconfig aware of fonts included with compat layer
@@ -158,7 +168,7 @@ def fontconfig_add_fonts(ec, eprefix):
158
168
raise EasyBuildError ("fontconfig-specific hook triggered for non-fontconfig easyconfig?!" )
159
169
160
170
161
- def ucx_eprefix (ec , eprefix ):
171
+ def parse_hook_ucx_eprefix (ec , eprefix ):
162
172
"""Make UCX aware of compatibility layer via additional configuration options."""
163
173
if ec .name == 'UCX' :
164
174
ec .update ('configopts' , '--with-sysroot=%s' % eprefix )
@@ -174,7 +184,19 @@ def pre_configure_hook(self, *args, **kwargs):
174
184
PRE_CONFIGURE_HOOKS [self .name ](self , * args , ** kwargs )
175
185
176
186
177
- def libfabric_disable_psm3_x86_64_generic (self , * args , ** kwargs ):
187
+ def pre_configure_hook_openblas_optarch_generic (self , * args , ** kwargs ):
188
+ """
189
+ Pre-configure hook for OpenBLAS: add DYNAMIC_ARCH=1 to build/test/install options when using --optarch=GENERIC
190
+ """
191
+ if self .name == 'OpenBLAS' :
192
+ if build_option ('optarch' ) == OPTARCH_GENERIC :
193
+ for step in ('build' , 'test' , 'install' ):
194
+ self .cfg .update (f'{ step } opts' , "DYNAMIC_ARCH=1" )
195
+ else :
196
+ raise EasyBuildError ("OpenBLAS-specific hook triggered for non-OpenBLAS easyconfig?!" )
197
+
198
+
199
+ def pre_configure_hook_libfabric_disable_psm3_x86_64_generic (self , * args , ** kwargs ):
178
200
"""Add --disable-psm3 to libfabric configure options when building with --optarch=GENERIC on x86_64."""
179
201
if self .name == 'libfabric' :
180
202
if get_cpu_architecture () == X86_64 :
@@ -187,7 +209,7 @@ def libfabric_disable_psm3_x86_64_generic(self, *args, **kwargs):
187
209
raise EasyBuildError ("libfabric-specific hook triggered for non-libfabric easyconfig?!" )
188
210
189
211
190
- def metabat_preconfigure (self , * args , ** kwargs ):
212
+ def pre_configure_hook_metabat_filtered_zlib_dep (self , * args , ** kwargs ):
191
213
"""
192
214
Pre-configure hook for MetaBAT:
193
215
- take into account that zlib is a filtered dependency,
@@ -201,7 +223,7 @@ def metabat_preconfigure(self, *args, **kwargs):
201
223
raise EasyBuildError ("MetaBAT-specific hook triggered for non-MetaBAT easyconfig?!" )
202
224
203
225
204
- def wrf_preconfigure (self , * args , ** kwargs ):
226
+ def pre_configure_hook_wrf_aarch64 (self , * args , ** kwargs ):
205
227
"""
206
228
Pre-configure hook for WRF:
207
229
- patch arch/configure_new.defaults so building WRF with foss toolchain works on aarch64
@@ -217,17 +239,18 @@ def wrf_preconfigure(self, *args, **kwargs):
217
239
218
240
219
241
PARSE_HOOKS = {
220
- 'CGAL' : cgal_toolchainopts_precise ,
221
- 'fontconfig' : fontconfig_add_fonts ,
222
- 'UCX' : ucx_eprefix ,
242
+ 'CGAL' : parse_hook_cgal_toolchainopts_precise ,
243
+ 'fontconfig' : parse_hook_fontconfig_add_fonts ,
244
+ 'UCX' : parse_hook_ucx_eprefix ,
223
245
}
224
246
225
247
POST_PREPARE_HOOKS = {
226
- 'GCCcore' : gcc_postprepare ,
248
+ 'GCCcore' : post_prepare_hook_gcc_prefixed_ld_rpath_wrapper ,
227
249
}
228
250
229
251
PRE_CONFIGURE_HOOKS = {
230
- 'libfabric' : libfabric_disable_psm3_x86_64_generic ,
231
- 'MetaBAT' : metabat_preconfigure ,
232
- 'WRF' : wrf_preconfigure ,
252
+ 'libfabric' : pre_configure_hook_libfabric_disable_psm3_x86_64_generic ,
253
+ 'MetaBAT' : pre_configure_hook_metabat_filtered_zlib_dep ,
254
+ 'OpenBLAS' : pre_configure_hook_openblas_optarch_generic ,
255
+ 'WRF' : pre_configure_hook_wrf_aarch64 ,
233
256
}
0 commit comments