diff --git a/easybuild/easyblocks/l/llvm.py b/easybuild/easyblocks/l/llvm.py index 4fd479dc2c..5b188fe397 100644 --- a/easybuild/easyblocks/l/llvm.py +++ b/easybuild/easyblocks/l/llvm.py @@ -234,7 +234,6 @@ def __init__(self, *args, **kwargs): """Initialize LLVM-specific variables.""" super().__init__(*args, **kwargs) - self.llvm_src_dir = None self.llvm_obj_dir_stage1 = None self.llvm_obj_dir_stage2 = None self.llvm_obj_dir_stage3 = None @@ -463,6 +462,12 @@ def __init__(self, *args, **kwargs): self._cmakeopts = {} self._cfgopts = list(filter(None, self.cfg.get('configopts', '').split())) + @property + def llvm_src_dir(self): + """Return root source directory of LLVM (containing all components)""" + # LLVM is the first source so we already have this in start_dir. Might be changed later + return self.start_dir + def prepare_step(self, *args, **kwargs): """Prepare step, modified to ensure install dir is deleted before building""" super(EB_LLVM, self).prepare_step(*args, **kwargs) @@ -677,13 +682,6 @@ def configure_step(self): # ensure this easyblock can be used as a Bundle component, see # https://github.com/easybuilders/easybuild-easyblocks/issues/3680 general_opts['CMAKE_INSTALL_PREFIX'] = self.installdir - start_dir = self.cfg['start_dir'] - if start_dir: - self.llvm_src_dir = os.path.join(self.builddir, start_dir) - self.log.debug("Using `%s` as the source dir from start_dir", self.llvm_src_dir) - else: - self.llvm_src_dir = os.path.join(self.builddir, 'llvm-project-%s.src' % self.version) - self.log.debug("Using `%s` as the source dir from easyblock", self.llvm_src_dir) # Bootstrap self.llvm_obj_dir_stage1 = os.path.join(self.builddir, 'llvm.obj.1') @@ -749,14 +747,14 @@ def configure_step(self): self.disable_sanitizer_tests() # Remove python bindings tests causing uncaught exception in the build - cmakelists_tests = os.path.join(self.llvm_src_dir, 'clang', 'CMakeLists.txt') + cmakelists_tests = os.path.join(self.start_dir, 'clang', 'CMakeLists.txt') regex_subs = [] regex_subs.append((r'add_subdirectory\(bindings/python/tests\)', '')) apply_regex_substitutions(cmakelists_tests, regex_subs) # Remove flags disabling the use of configuration files during compiler-rt tests as we in general rely on them # (see https://github.com/easybuilders/easybuild-easyblocks/pull/3741#issuecomment-2939404304) - lit_cfg_file = os.path.join(self.llvm_src_dir, 'compiler-rt', 'test', 'lit.common.cfg.py') + lit_cfg_file = os.path.join(self.start_dir, 'compiler-rt', 'test', 'lit.common.cfg.py') regex_subs = [ (r'^if config.has_no_default_config_flag:', ''), (r'^\s*config.environment\["CLANG_NO_DEFAULT_CONFIG"\] = "1"', '') @@ -781,7 +779,7 @@ def configure_step(self): self._configure_general_build() self.add_cmake_opts() - src_dir = os.path.join(self.llvm_src_dir, 'llvm') + src_dir = os.path.join(self.start_dir, 'llvm') output = super().configure_step(builddir=self.llvm_obj_dir_stage1, srcdir=src_dir) # Get LLVM_HOST_TRIPLE (e.g. x86_64-unknown-linux-gnu) from the output @@ -813,7 +811,7 @@ def configure_step(self): def disable_sanitizer_tests(self): """Disable the tests of all the sanitizers by removing the test directories from the build system""" - cmakelists_tests = os.path.join(self.llvm_src_dir, 'compiler-rt', 'test', 'CMakeLists.txt') + cmakelists_tests = os.path.join(self.start_dir, 'compiler-rt', 'test', 'CMakeLists.txt') regex_subs = [(r'compiler_rt_test_runtime.*san.*', '')] apply_regex_substitutions(cmakelists_tests, regex_subs) @@ -941,7 +939,6 @@ def build_with_prev_stage(self, prev_dir, stage_dir): # Also runs of the intermediate step compilers should be made aware of the GCC installation if LooseVersion(self.version) >= LooseVersion('19'): - self._set_gcc_prefix() self._create_compiler_config_file(prev_dir) # also pre-create the CFG files in the `build_stage/bin` directory to enforce using the correct dynamic # 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): change_dir(stage_dir) self.log.debug("Configuring %s", stage_dir) - cmd = ' '.join(['cmake', self.cfg['configopts'], os.path.join(self.llvm_src_dir, 'llvm')]) + cmd = ' '.join(['cmake', self.cfg['configopts'], os.path.join(self.start_dir, 'llvm')]) run_shell_cmd(cmd) self.log.debug("Building %s", stage_dir) @@ -1135,7 +1132,6 @@ def test_step(self): if not self.cfg['skip_all_tests']: # Also runs of test suite compilers should be made aware of the GCC installation if LooseVersion(self.version) >= LooseVersion('19'): - self._set_gcc_prefix() self._create_compiler_config_file(self.final_dir) # 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): # copy Python bindings here in post-install step so that it is not done more than once in multi_deps context if self.cfg['python_bindings']: - python_bindings_source_dir = os.path.join(self.llvm_src_dir, 'clang', 'bindings', 'python') + python_bindings_source_dir = os.path.join(self.start_dir, 'clang', 'bindings', 'python') python_bindins_target_dir = os.path.join(self.installdir, 'lib', 'python') copy_dir(python_bindings_source_dir, python_bindins_target_dir, dirs_exist_ok=True) - python_bindings_source_dir = os.path.join(self.llvm_src_dir, 'mlir', 'python') + python_bindings_source_dir = os.path.join(self.start_dir, 'mlir', 'python') copy_dir(python_bindings_source_dir, python_bindins_target_dir, dirs_exist_ok=True) if LooseVersion(self.version) >= LooseVersion('19'): # For GCC aware installation create config files in order to point to the correct GCC installation # Required as GCC_INSTALL_PREFIX was removed (see https://github.com/llvm/llvm-project/pull/87360) - self._set_gcc_prefix() self._create_compiler_config_file(self.installdir) # This is needed as some older build system will select a different naming scheme for the library leading to