Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions easybuild/easyblocks/c/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def extra_options():
'build_lld': [False, "Build the LLVM lld linker", CUSTOM],
'default_openmp_runtime': [None, "Default OpenMP runtime for clang (for example, 'libomp')", CUSTOM],
'enable_rtti': [False, "Enable Clang RTTI", CUSTOM],
'python_bindings': [False, "Install python bindings", CUSTOM],
'libcxx': [False, "Build the LLVM C++ standard library", CUSTOM],
'static_analyzer': [True, "Install the static analyser of Clang", CUSTOM],
'skip_all_tests': [False, "Skip running of tests", CUSTOM],
Expand Down Expand Up @@ -460,6 +461,15 @@ def install_step(self):
except OSError as err:
raise EasyBuildError("Failed to copy static analyzer dirs to install dir: %s", err)

def post_install_step(self):
"""Install python bindings."""
# do it 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, "tools", "clang", "bindings", "python")
python_bindins_target_dir = os.path.join(self.installdir, 'lib', 'python')

shutil.copytree(python_bindings_source_dir, python_bindins_target_dir)

def sanity_check_step(self):
"""Custom sanity check for Clang."""
shlib_ext = get_shared_lib_ext()
Expand Down Expand Up @@ -509,6 +519,10 @@ def sanity_check_step(self):
"lib/libomptarget.rtl.%s.%s" % (arch, shlib_ext)])

custom_commands = ['clang --help', 'clang++ --help', 'llvm-config --cxxflags']
if self.cfg['python_bindings']:
custom_paths['files'].extend([os.path.join("lib", "python", "clang", "cindex.py")])
custom_commands.extend(["python -c 'import clang'"])

super(EB_Clang, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands)

def make_module_extra(self):
Expand All @@ -517,4 +531,6 @@ def make_module_extra(self):
# we set the symbolizer path so that asan/tsan give meanfull output by default
asan_symbolizer_path = os.path.join(self.installdir, 'bin', 'llvm-symbolizer')
txt += self.module_generator.set_environment('ASAN_SYMBOLIZER_PATH', asan_symbolizer_path)
if self.cfg['python_bindings']:
txt += self.module_generator.prepend_paths('PYTHONPATH', os.path.join("lib", "python"))
return txt