33## INITENV +PATH PYTHON3PATH %{i}/lib64/python%{cms_python3_major_minor_version}/site-packages
44
55BuildRequires: cmake ninja
6- Requires: gcc zlib python3 libxml2 zstd
6+ Requires: gcc zlib python3 libxml2 zstd libunwind
77%{! ?without_cuda:Requires: cuda}
88
99%define llvmCommit 02c7568fc9f555b2c72fc169c8c68e2116d97382
@@ -35,13 +35,14 @@ rm -rf %{_builddir}/build
3535mkdir -p %{_builddir }/build
3636cd %{_builddir }/build
3737
38+ host_triple= $(gcc -dumpmachine)
3839cmake %{_builddir }/llvm-%{realversion }-%{llvmCommit }/llvm \
3940 -G Ninja \
4041%if 0%{!?use_system_gcc:1 }
41- -DGCC_INSTALL_PREFIX= "${GCC_ROOT}" \
4242 -DLLVM_BINUTILS_INCDIR:STRING= "${GCC_ROOT}/include" \
4343%endif
4444 -DLLVM_ENABLE_PROJECTS= "clang;clang-tools-extra;compiler-rt;lld;openmp" \
45+ -DLLVM_ENABLE_RUNTIMES= "libcxx;libcxxabi;libunwind" \
4546 -DCMAKE_INSTALL_PREFIX:PATH= "%{i }" \
4647 -DCMAKE_BUILD_TYPE:STRING= Release \
4748 -DLLVM_LIBDIR_SUFFIX:STRING= 64 \
@@ -50,14 +51,14 @@ cmake %{_builddir}/llvm-%{realversion}-%{llvmCommit}/llvm \
5051 -DLLVM_ENABLE_EH:BOOL= ON \
5152 -DLLVM_ENABLE_PIC:BOOL= ON \
5253 -DLLVM_ENABLE_RTTI:BOOL= ON \
53- -DLLVM_HOST_TRIPLE= $(gcc -dumpmachine) \
54+ -DLLVM_HOST_TRIPLE= ${host_triple} \
5455 -DLLVM_TARGETS_TO_BUILD:STRING= "X86;PowerPC;AArch64;RISC V;NVPTX" \
5556%if 0%{!?without_cuda:1 }
5657 -DLIBOMPTARGET_NVPTX_ALTERNATE_HOST_COMPILER= /usr/bin/gcc \
5758 -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES= "%omptarget_cuda_archs " \
5859%endif
5960 -DCMAKE_REQUIRED_INCLUDES= "${ZLIB_ROOT}/include" \
60- -DCMAKE_PREFIX_PATH= "${ZLIB_ROOT};${LIBXML2_ROOT};${ZSTD_ROOT}"
61+ -DCMAKE_PREFIX_PATH= "${ZLIB_ROOT};${LIBXML2_ROOT};${ZSTD_ROOT};${LIBUNWIND_ROOT} "
6162
6263ninja -v %{makeprocesses }
6364ninja -v %{makeprocesses } check-clang-tools
@@ -67,6 +68,9 @@ bin/clang-tidy --checks=* --list-checks | grep cms-handle
6768cd ../build
6869ninja -v %{makeprocesses } install
6970
71+ #Create libomp symlink
72+ host_triple= $(gcc -dumpmachine)
73+
7074BINDINGS_PATH= %{i }/lib64/python%{cms_python3_major_minor_version }/site-packages
7175PKG_INFO_FILE= $BINDINGS_PATH/clang-%{realversion }-py%{cms_python3_major_minor_version }.egg-info/PKG-INFO
7276mkdir -p $BINDINGS_PATH
@@ -85,7 +89,20 @@ rm -f %{i}/bin/FileRadar.scpt %{i}/bin/GetRadarVersion.scpt
8589# Avoid dependency on /usr/bin/python, Darwin + Xcode specific
8690rm -f %{i }/bin/set-xcode-analyzer
8791
92+ %if 0%{!?use_system_gcc:1 }
93+ pushd %{i }/bin
94+ [ -e clang++.cfg ] && exit 1
95+ [ -e clang.cfg ] && exit 1
96+ echo "--gcc-toolchain= $GCC_ROOT" > clang++.cfg
97+ echo "--target= $host_triple" >> clang++.cfg
98+ ln -s clang++.cfg clang.cfg
99+ popd
100+ %endif
101+
88102%post
89103%{relocateConfig }include/llvm/Config/llvm-config.h
90104%{relocateConfig }include/clang/Config/config.h
91105%{relocateConfig }lib64/cmake/llvm/LLVMConfig.cmake
106+ %if 0%{!?use_system_gcc:1 }
107+ %{relocateConfig }bin/clang++.cfg
108+ %endif
0 commit comments