Skip to content

Commit fb97e02

Browse files
authored
Merge pull request #9896 from cms-sw/llvm-tool-cleanup
created clang++.cfg and clang.cfg files and dropped --gcc-toolchain from toolfile
2 parents 9dfd4e5 + 84e512f commit fb97e02

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

llvm.spec

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## INITENV +PATH PYTHON3PATH %{i}/lib64/python%{cms_python3_major_minor_version}/site-packages
44

55
BuildRequires: 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
3535
mkdir -p %{_builddir}/build
3636
cd %{_builddir}/build
3737

38+
host_triple=$(gcc -dumpmachine)
3839
cmake %{_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;RISCV;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

6263
ninja -v %{makeprocesses}
6364
ninja -v %{makeprocesses} check-clang-tools
@@ -67,6 +68,9 @@ bin/clang-tidy --checks=* --list-checks | grep cms-handle
6768
cd ../build
6869
ninja -v %{makeprocesses} install
6970

71+
#Create libomp symlink
72+
host_triple=$(gcc -dumpmachine)
73+
7074
BINDINGS_PATH=%{i}/lib64/python%{cms_python3_major_minor_version}/site-packages
7175
PKG_INFO_FILE=$BINDINGS_PATH/clang-%{realversion}-py%{cms_python3_major_minor_version}.egg-info/PKG-INFO
7276
mkdir -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
8690
rm -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
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
<tool name="llvm-ccompiler" version="@TOOL_VERSION@" type="compiler" revision="1">
1+
<tool name="llvm-ccompiler" version="@TOOL_VERSION@" type="compiler" revision="2">
22
<use name="gcc-ccompiler"/>
33
<client>
44
<environment name="LLVM_CCOMPILER_BASE" default="@TOOL_ROOT@"/>
55
<environment name="CC" value="$LLVM_CCOMPILER_BASE/bin/clang"/>
66
</client>
7-
%if 0%{!?use_system_gcc:1}
8-
<flags CFLAGS="--gcc-toolchain=@GCC_ROOT@"/>
9-
%endif
107
</tool>

scram-tools.file/tools/llvm/llvm-cxxcompiler.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<tool name="llvm-cxxcompiler" version="@TOOL_VERSION@" type="compiler" revision="1">
1+
<tool name="llvm-cxxcompiler" version="@TOOL_VERSION@" type="compiler" revision="2">
22
<use name="gcc-cxxcompiler"/>
33
<client>
44
<environment name="LLVM_CXXCOMPILER_BASE" default="@TOOL_ROOT@"/>
@@ -33,9 +33,6 @@
3333
<flags CXXFLAGS="-Wno-tautological-type-limit-compare"/>
3434
<flags CXXFLAGS="-Wno-vla-cxx-extension"/>
3535
<flags CXXFLAGS="-fsized-deallocation"/>
36-
%if 0%{!?use_system_gcc:1}
37-
<flags CXXFLAGS="--gcc-toolchain=@GCC_ROOT@"/>
38-
%endif
3936
<runtime name="@OS_RUNTIME_LDPATH_NAME@" value="$LLVM_CXXCOMPILER_BASE/lib64" type="path"/>
4037
<runtime name="PATH" value="$LLVM_CXXCOMPILER_BASE/bin" type="path"/>
4138
</tool>

0 commit comments

Comments
 (0)