Skip to content

Commit c2077a3

Browse files
authored
Merge pull request #272 from nathanchance/handle-llvm_enable_terminfo-removal
tc_build: llvm: Handle removal of LLVM_ENABLE_TERMINFO
2 parents 26a242c + d7ece82 commit c2077a3

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

tc_build/llvm.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ def __init__(self):
3030
self.build_targets = ['all']
3131
self.ccache = False
3232
self.check_targets = []
33-
# Removes system dependency on terminfo to keep the dynamic library
34-
# dependencies slim. This can be unconditionally done as it does not
35-
# impact clang's ability to show colors for certain output like
36-
# warnings.
37-
self.cmake_defines = {'LLVM_ENABLE_TERMINFO': 'OFF'}
33+
self.cmake_defines = {}
3834
self.install_targets = []
3935
self.tools = None
4036
self.projects = []
@@ -252,6 +248,18 @@ def configure(self):
252248
self.cmake_defines['CMAKE_INSTALL_PREFIX'] = self.folders.install
253249

254250
self.cmake_defines['LLVM_ENABLE_PROJECTS'] = ';'.join(self.projects)
251+
# Remove system dependency on terminfo to keep the dynamic library
252+
# dependencies slim. This can be done unconditionally when the option
253+
# exists, as it does not impact clang's ability to show colors for
254+
# certain output like warnings. If the option does not exist, it means
255+
# that the linked change from clang-19 is present, which basically
256+
# makes LLVM_ENABLE_TERMINFO=OFF the default, so do not add it in that
257+
# case to avoid a cmake warning.
258+
# https://github.com/llvm/llvm-project/commit/6bf450c7a60fa62c642e39836566da94bb9bbc91
259+
llvm_cmakelists = Path(self.folders.source, 'llvm/CMakeLists.txt')
260+
llvm_cmakelists_txt = llvm_cmakelists.read_text(encoding='utf-8')
261+
if 'LLVM_ENABLE_TERMINFO' in llvm_cmakelists_txt:
262+
self.cmake_defines['LLVM_ENABLE_TERMINFO'] = 'OFF'
255263
# execinfo.h might not exist (Alpine Linux) but the GWP ASAN library
256264
# depends on it. Disable the option to avoid breaking the build, the
257265
# kernel does not depend on it.

0 commit comments

Comments
 (0)