@@ -234,7 +234,6 @@ def __init__(self, *args, **kwargs):
234
234
"""Initialize LLVM-specific variables."""
235
235
super ().__init__ (* args , ** kwargs )
236
236
237
- self .llvm_src_dir = None
238
237
self .llvm_obj_dir_stage1 = None
239
238
self .llvm_obj_dir_stage2 = None
240
239
self .llvm_obj_dir_stage3 = None
@@ -463,6 +462,12 @@ def __init__(self, *args, **kwargs):
463
462
self ._cmakeopts = {}
464
463
self ._cfgopts = list (filter (None , self .cfg .get ('configopts' , '' ).split ()))
465
464
465
+ @property
466
+ def llvm_src_dir (self ):
467
+ """Return root source directory of LLVM (containing all components)"""
468
+ # LLVM is the first source so we already have this in start_dir. Might be changed later
469
+ return self .start_dir
470
+
466
471
def prepare_step (self , * args , ** kwargs ):
467
472
"""Prepare step, modified to ensure install dir is deleted before building"""
468
473
super (EB_LLVM , self ).prepare_step (* args , ** kwargs )
@@ -677,13 +682,6 @@ def configure_step(self):
677
682
# ensure this easyblock can be used as a Bundle component, see
678
683
# https://github.com/easybuilders/easybuild-easyblocks/issues/3680
679
684
general_opts ['CMAKE_INSTALL_PREFIX' ] = self .installdir
680
- start_dir = self .cfg ['start_dir' ]
681
- if start_dir :
682
- self .llvm_src_dir = os .path .join (self .builddir , start_dir )
683
- self .log .debug ("Using `%s` as the source dir from start_dir" , self .llvm_src_dir )
684
- else :
685
- self .llvm_src_dir = os .path .join (self .builddir , 'llvm-project-%s.src' % self .version )
686
- self .log .debug ("Using `%s` as the source dir from easyblock" , self .llvm_src_dir )
687
685
688
686
# Bootstrap
689
687
self .llvm_obj_dir_stage1 = os .path .join (self .builddir , 'llvm.obj.1' )
@@ -749,14 +747,14 @@ def configure_step(self):
749
747
self .disable_sanitizer_tests ()
750
748
751
749
# Remove python bindings tests causing uncaught exception in the build
752
- cmakelists_tests = os .path .join (self .llvm_src_dir , 'clang' , 'CMakeLists.txt' )
750
+ cmakelists_tests = os .path .join (self .start_dir , 'clang' , 'CMakeLists.txt' )
753
751
regex_subs = []
754
752
regex_subs .append ((r'add_subdirectory\(bindings/python/tests\)' , '' ))
755
753
apply_regex_substitutions (cmakelists_tests , regex_subs )
756
754
757
755
# Remove flags disabling the use of configuration files during compiler-rt tests as we in general rely on them
758
756
# (see https://github.com/easybuilders/easybuild-easyblocks/pull/3741#issuecomment-2939404304)
759
- lit_cfg_file = os .path .join (self .llvm_src_dir , 'compiler-rt' , 'test' , 'lit.common.cfg.py' )
757
+ lit_cfg_file = os .path .join (self .start_dir , 'compiler-rt' , 'test' , 'lit.common.cfg.py' )
760
758
regex_subs = [
761
759
(r'^if config.has_no_default_config_flag:' , '' ),
762
760
(r'^\s*config.environment\["CLANG_NO_DEFAULT_CONFIG"\] = "1"' , '' )
@@ -781,7 +779,7 @@ def configure_step(self):
781
779
self ._configure_general_build ()
782
780
self .add_cmake_opts ()
783
781
784
- src_dir = os .path .join (self .llvm_src_dir , 'llvm' )
782
+ src_dir = os .path .join (self .start_dir , 'llvm' )
785
783
output = super ().configure_step (builddir = self .llvm_obj_dir_stage1 , srcdir = src_dir )
786
784
787
785
# Get LLVM_HOST_TRIPLE (e.g. x86_64-unknown-linux-gnu) from the output
@@ -813,7 +811,7 @@ def configure_step(self):
813
811
814
812
def disable_sanitizer_tests (self ):
815
813
"""Disable the tests of all the sanitizers by removing the test directories from the build system"""
816
- cmakelists_tests = os .path .join (self .llvm_src_dir , 'compiler-rt' , 'test' , 'CMakeLists.txt' )
814
+ cmakelists_tests = os .path .join (self .start_dir , 'compiler-rt' , 'test' , 'CMakeLists.txt' )
817
815
regex_subs = [(r'compiler_rt_test_runtime.*san.*' , '' )]
818
816
apply_regex_substitutions (cmakelists_tests , regex_subs )
819
817
@@ -941,7 +939,6 @@ def build_with_prev_stage(self, prev_dir, stage_dir):
941
939
942
940
# Also runs of the intermediate step compilers should be made aware of the GCC installation
943
941
if LooseVersion (self .version ) >= LooseVersion ('19' ):
944
- self ._set_gcc_prefix ()
945
942
self ._create_compiler_config_file (prev_dir )
946
943
# also pre-create the CFG files in the `build_stage/bin` directory to enforce using the correct dynamic
947
944
# linker in case of sysroot builds, and to ensure the correct GCC installation is used also for the
@@ -952,7 +949,7 @@ def build_with_prev_stage(self, prev_dir, stage_dir):
952
949
953
950
change_dir (stage_dir )
954
951
self .log .debug ("Configuring %s" , stage_dir )
955
- cmd = ' ' .join (['cmake' , self .cfg ['configopts' ], os .path .join (self .llvm_src_dir , 'llvm' )])
952
+ cmd = ' ' .join (['cmake' , self .cfg ['configopts' ], os .path .join (self .start_dir , 'llvm' )])
956
953
run_shell_cmd (cmd )
957
954
958
955
self .log .debug ("Building %s" , stage_dir )
@@ -1135,7 +1132,6 @@ def test_step(self):
1135
1132
if not self .cfg ['skip_all_tests' ]:
1136
1133
# Also runs of test suite compilers should be made aware of the GCC installation
1137
1134
if LooseVersion (self .version ) >= LooseVersion ('19' ):
1138
- self ._set_gcc_prefix ()
1139
1135
self ._create_compiler_config_file (self .final_dir )
1140
1136
1141
1137
# For nvptx64 tests, find out if 'ptxas' exists in $PATH. If not, ignore all nvptx64 test failures
@@ -1184,17 +1180,16 @@ def install_step(self):
1184
1180
1185
1181
# copy Python bindings here in post-install step so that it is not done more than once in multi_deps context
1186
1182
if self .cfg ['python_bindings' ]:
1187
- python_bindings_source_dir = os .path .join (self .llvm_src_dir , 'clang' , 'bindings' , 'python' )
1183
+ python_bindings_source_dir = os .path .join (self .start_dir , 'clang' , 'bindings' , 'python' )
1188
1184
python_bindins_target_dir = os .path .join (self .installdir , 'lib' , 'python' )
1189
1185
copy_dir (python_bindings_source_dir , python_bindins_target_dir , dirs_exist_ok = True )
1190
1186
1191
- python_bindings_source_dir = os .path .join (self .llvm_src_dir , 'mlir' , 'python' )
1187
+ python_bindings_source_dir = os .path .join (self .start_dir , 'mlir' , 'python' )
1192
1188
copy_dir (python_bindings_source_dir , python_bindins_target_dir , dirs_exist_ok = True )
1193
1189
1194
1190
if LooseVersion (self .version ) >= LooseVersion ('19' ):
1195
1191
# For GCC aware installation create config files in order to point to the correct GCC installation
1196
1192
# Required as GCC_INSTALL_PREFIX was removed (see https://github.com/llvm/llvm-project/pull/87360)
1197
- self ._set_gcc_prefix ()
1198
1193
self ._create_compiler_config_file (self .installdir )
1199
1194
1200
1195
# This is needed as some older build system will select a different naming scheme for the library leading to
0 commit comments