!4 [sync] PR-1: 引入clang 15.0.6,并且支持多版本共存
From: @openeuler-sync-bot Reviewed-by: @cf-zhao Signed-off-by: @cf-zhao
This commit is contained in:
commit
ca256cd3a4
BIN
clang-15.0.6.src.tar.xz
Normal file
BIN
clang-15.0.6.src.tar.xz
Normal file
Binary file not shown.
BIN
clang-tools-extra-15.0.6.src.tar.xz
Normal file
BIN
clang-tools-extra-15.0.6.src.tar.xz
Normal file
Binary file not shown.
376
clang.spec
Normal file
376
clang.spec
Normal file
@ -0,0 +1,376 @@
|
||||
%global maj_ver 15
|
||||
%global min_ver 0
|
||||
%global patch_ver 6
|
||||
%global clang_version %{maj_ver}.%{min_ver}.%{patch_ver}
|
||||
|
||||
%global pkg_name clang%{maj_ver}
|
||||
%global bin_suffix -%{maj_ver}
|
||||
%global install_prefix %{_libdir}/llvm%{maj_ver}
|
||||
%global install_bindir %{install_prefix}/bin
|
||||
%global install_includedir %{install_prefix}/include
|
||||
%global install_libdir %{install_prefix}/lib
|
||||
%global install_libexecdir %{install_prefix}/libexec
|
||||
%global install_sharedir %{install_prefix}/share
|
||||
%global install_docdir %{install_sharedir}/doc
|
||||
|
||||
%global pkg_bindir %{install_bindir}
|
||||
%global pkg_includedir %{install_includedir}
|
||||
%global pkg_libdir %{install_libdir}
|
||||
%global pkg_libexecdir %{install_libexecdir}
|
||||
%global pkg_sharedir %{install_sharedir}
|
||||
%global pkg_docdir %{install_sharedir}/doc
|
||||
|
||||
%global clang_srcdir clang-%{clang_version}.src
|
||||
%global clang_tools_srcdir clang-tools-extra-%{clang_version}.src
|
||||
%global max_link_jobs 2
|
||||
|
||||
Name: %pkg_name
|
||||
Version: %{clang_version}
|
||||
Release: 1
|
||||
Summary: A C language family front-end for LLVM
|
||||
|
||||
License: NCSA
|
||||
URL: http://llvm.org
|
||||
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}/%{clang_srcdir}.tar.xz
|
||||
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{clang_version}/%{clang_tools_srcdir}.tar.xz
|
||||
|
||||
Patch0: fedora-PATCH-clang-Reorganize-gtest-integration.patch
|
||||
Patch1: fedora-PATCH-clang-Don-t-install-static-libraries.patch
|
||||
|
||||
Patch201: fedora-clang-tools-extra-Make-test-dependency-on-LLVMHello-.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: cmake
|
||||
BuildRequires: emacs
|
||||
BuildRequires: libatomic
|
||||
BuildRequires: llvm%{maj_ver}-devel = %{version}
|
||||
BuildRequires: llvm%{maj_ver}-static = %{version}
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: multilib-rpm-config
|
||||
BuildRequires: ninja-build
|
||||
BuildRequires: ncurses-devel
|
||||
BuildRequires: perl-generators
|
||||
BuildRequires: python3-lit = %{version}
|
||||
BuildRequires: python3-sphinx
|
||||
BuildRequires: python3-recommonmark
|
||||
BuildRequires: python3-devel
|
||||
|
||||
BuildRequires: perl(Digest::MD5)
|
||||
BuildRequires: perl(File::Copy)
|
||||
BuildRequires: perl(File::Find)
|
||||
BuildRequires: perl(File::Path)
|
||||
BuildRequires: perl(File::Temp)
|
||||
BuildRequires: perl(FindBin)
|
||||
BuildRequires: perl(Hash::Util)
|
||||
BuildRequires: perl(lib)
|
||||
BuildRequires: perl(Term::ANSIColor)
|
||||
BuildRequires: perl(Text::ParseWords)
|
||||
BuildRequires: perl(Sys::Hostname)
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
|
||||
Requires: libstdc++-devel
|
||||
Requires: gcc-c++
|
||||
|
||||
Provides: clang(major) = %{maj_ver}
|
||||
|
||||
Conflicts: compiler-rt < 11.0.0
|
||||
|
||||
%description
|
||||
clang: noun
|
||||
1. A loud, resonant, metallic sound.
|
||||
2. The strident call of a crane or goose.
|
||||
3. C-language family front-end toolkit.
|
||||
|
||||
The goal of the Clang project is to create a new C, C++, Objective C
|
||||
and Objective C++ front-end for the LLVM compiler. Its tools are built
|
||||
as libraries and designed to be loosely-coupled and extensible.
|
||||
|
||||
Install compiler-rt if you want the Blocks C language extension or to
|
||||
enable sanitization and profiling options when building, and
|
||||
libomp-devel to enable -fopenmp.
|
||||
|
||||
%package libs
|
||||
Summary: Runtime library for clang
|
||||
Requires: %{name}-resource-filesystem%{?_isa} = %{version}
|
||||
Recommends: compiler-rt%{?_isa} = %{version}
|
||||
Recommends: libatomic%{?_isa}
|
||||
Recommends: libomp-devel%{_isa} = %{version}
|
||||
Recommends: libomp%{_isa} = %{version}
|
||||
|
||||
%description libs
|
||||
Runtime library for clang.
|
||||
|
||||
%package devel
|
||||
Summary: Development header files for clang
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
Development header files for clang.
|
||||
|
||||
%package resource-filesystem
|
||||
Summary: Filesystem package that owns the clang resource directory
|
||||
Provides: %{name}-resource-filesystem(major) = %{maj_ver}
|
||||
|
||||
%description resource-filesystem
|
||||
This package owns the clang resouce directory: $libdir/clang/$version/
|
||||
|
||||
|
||||
%package analyzer
|
||||
Summary: A source code analysis framework
|
||||
License: NCSA and MIT
|
||||
BuildArch: noarch
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description analyzer
|
||||
The Clang Static Analyzer consists of both a source code analysis
|
||||
framework and a standalone tool that finds bugs in C and Objective-C
|
||||
programs. The standalone tool is invoked from the command-line, and is
|
||||
intended to run in tandem with a build of a project or code base.
|
||||
|
||||
%package tools-extra
|
||||
Summary: Extra tools for clang
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
Requires: emacs-filesystem
|
||||
|
||||
%description tools-extra
|
||||
A set of extra tools built using Clang's tooling API.
|
||||
|
||||
%package -n git-clang-format
|
||||
Summary: Integration of clang-format for git
|
||||
Requires: %{name}-tools-extra = %{version}-%{release}
|
||||
Requires: git
|
||||
Requires: python3
|
||||
|
||||
%description -n git-clang-format
|
||||
clang-format integration for git.
|
||||
|
||||
%prep
|
||||
%setup -T -q -b 1 -n %{clang_tools_srcdir}
|
||||
%autopatch -m200 -p2
|
||||
|
||||
|
||||
# failing test case
|
||||
rm test/clang-tidy/checkers/altera/struct-pack-align.cpp
|
||||
|
||||
pathfix.py -i %{__python3} -pn \
|
||||
clang-tidy/tool/ \
|
||||
clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
|
||||
|
||||
%setup -q -n %{clang_srcdir}
|
||||
%autopatch -M200 -p2
|
||||
|
||||
# failing test case
|
||||
rm test/CodeGen/profile-filter.c
|
||||
|
||||
pathfix.py -i %{__python3} -pn \
|
||||
tools/clang-format/ \
|
||||
tools/clang-format/git-clang-format \
|
||||
utils/hmaptool/hmaptool \
|
||||
tools/scan-view/bin/scan-view \
|
||||
tools/scan-view/share/Reporter.py \
|
||||
tools/scan-view/share/startfile.py \
|
||||
tools/scan-build-py/bin/* \
|
||||
tools/scan-build-py/libexec/*
|
||||
|
||||
mv ../%{clang_tools_srcdir} tools/extra
|
||||
|
||||
%build
|
||||
mkdir -p _build
|
||||
cd _build
|
||||
%cmake .. -G Ninja \
|
||||
-DCLANG_DEFAULT_PIE_ON_LINUX=ON \
|
||||
-DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \
|
||||
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DPYTHON_EXECUTABLE=%{__python3} \
|
||||
-DCMAKE_SKIP_RPATH:BOOL=ON \
|
||||
-DCLANG_BUILD_TOOLS:BOOL=ON \
|
||||
-DLLVM_CONFIG:FILEPATH=%{pkg_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \
|
||||
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
|
||||
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
|
||||
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \
|
||||
-DLLVM_MAIN_SRC_DIR=%{_datadir}/llvm/src \
|
||||
-DLLVM_BUILD_UTILS:BOOL=ON \
|
||||
-DCLANG_ENABLE_ARCMT:BOOL=ON \
|
||||
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \
|
||||
-DCLANG_INCLUDE_DOCS:BOOL=ON \
|
||||
-DCLANG_PLUGIN_SUPPORT:BOOL=ON \
|
||||
-DENABLE_LINKER_BUILD_ID:BOOL=ON \
|
||||
-DLLVM_ENABLE_EH=ON \
|
||||
-DLLVM_ENABLE_RTTI=ON \
|
||||
-DLLVM_BUILD_DOCS=ON \
|
||||
-DLLVM_ENABLE_SPHINX=ON \
|
||||
-DCLANG_LINK_CLANG_DYLIB=ON \
|
||||
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
|
||||
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCLANG_REPOSITORY_STRING="%{?distro} %{version}-%{release}" \
|
||||
-DCLANG_DEFAULT_UNWINDLIB=libgcc
|
||||
|
||||
%ninja_build
|
||||
|
||||
%install
|
||||
|
||||
%ninja_install -C _build
|
||||
mkdir -p %{buildroot}/%{_bindir}
|
||||
|
||||
rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
|
||||
rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py*
|
||||
|
||||
rm -vf %{buildroot}%{install_sharedir}/clang/clang-format-bbedit.applescript
|
||||
rm -vf %{buildroot}%{install_sharedir}/clang/clang-format-sublime.py*
|
||||
|
||||
rm -Rvf %{buildroot}%{install_docdir}/Clang/clang/html
|
||||
rm -Rvf %{buildroot}%{install_sharedir}/clang/clang-doc-default-stylesheet.css
|
||||
rm -Rvf %{buildroot}%{install_sharedir}/clang/index.js
|
||||
rm -vf %{buildroot}%{install_sharedir}/clang/bash-autocomplete.sh
|
||||
|
||||
rm -Rvf %{buildroot}%{_docdir}/Clang/clang/html
|
||||
rm -Rvf %{buildroot}%{_datadir}/clang/clang-doc-default-stylesheet.css
|
||||
rm -Rvf %{buildroot}%{_datadir}/clang/index.js
|
||||
|
||||
for f in %{buildroot}/%{install_bindir}/*; do
|
||||
filename=`basename $f`
|
||||
if [ $filename != "clang-15" ]; then
|
||||
ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{bin_suffix}
|
||||
fi
|
||||
done
|
||||
|
||||
# Create Manpage symlinks
|
||||
mkdir -p %{buildroot}/%{_mandir}/man1
|
||||
for f in %{buildroot}%{install_prefix}/share/man/man1/*; do
|
||||
filename=`basename $f | cut -f 1 -d '.'`
|
||||
mv $f %{buildroot}%{_mandir}/man1/$filename%{bin_suffix}.1
|
||||
done
|
||||
|
||||
mkdir -p %{buildroot}%{pkg_libdir}/clang/%{version}/{include,lib,share}/
|
||||
|
||||
rm -Rvf %{buildroot}%{_includedir}/clang-tidy/
|
||||
|
||||
%check
|
||||
|
||||
%files
|
||||
%license LICENSE.TXT
|
||||
%{_bindir}/clang-%{maj_ver}
|
||||
%{_bindir}/clang++-%{maj_ver}
|
||||
%{_mandir}/man1/*
|
||||
%{_bindir}/clang-cl-%{maj_ver}
|
||||
%{_bindir}/clang-cpp-%{maj_ver}
|
||||
%{pkg_bindir}
|
||||
|
||||
%files libs
|
||||
%{pkg_libdir}/*.so.*
|
||||
%{pkg_libdir}/clang/%{version}
|
||||
|
||||
%files devel
|
||||
%{pkg_libdir}/*.so
|
||||
%{pkg_includedir}/clang/
|
||||
%{pkg_includedir}/clang-c/
|
||||
%{pkg_includedir}/clang-tidy/
|
||||
%{pkg_libdir}/cmake/
|
||||
|
||||
%files resource-filesystem
|
||||
%dir %{pkg_libdir}/clang/%{version}/
|
||||
%dir %{pkg_libdir}/clang/%{version}/include/
|
||||
%dir %{pkg_libdir}/clang/%{version}/lib/
|
||||
%dir %{pkg_libdir}/clang/%{version}/share/
|
||||
|
||||
%files analyzer
|
||||
%{_bindir}/scan-view%{bin_suffix}
|
||||
%{_bindir}/scan-build%{bin_suffix}
|
||||
%{_bindir}/analyze-build%{bin_suffix}
|
||||
%{_bindir}/intercept-build%{bin_suffix}
|
||||
%{_bindir}/scan-build-py%{bin_suffix}
|
||||
%{pkg_libexecdir}/ccc-analyzer
|
||||
%{pkg_libexecdir}/c++-analyzer
|
||||
%{pkg_libexecdir}/analyze-c++
|
||||
%{pkg_libexecdir}/analyze-cc
|
||||
%{pkg_libexecdir}/intercept-c++
|
||||
%{pkg_libexecdir}/intercept-cc
|
||||
%{pkg_bindir}/scan-view
|
||||
%{pkg_bindir}/scan-build
|
||||
%{_mandir}/man1/*
|
||||
%{pkg_libdir}/libear
|
||||
%{pkg_libdir}/libscanbuild
|
||||
%{pkg_sharedir}/scan-view
|
||||
%{pkg_sharedir}/scan-build
|
||||
|
||||
|
||||
%files tools-extra
|
||||
%{_bindir}/c-index-test%{bin_suffix}
|
||||
%{_bindir}/clang-apply-replacements%{bin_suffix}
|
||||
%{_bindir}/clang-change-namespace%{bin_suffix}
|
||||
%{_bindir}/clang-check%{bin_suffix}
|
||||
%{_bindir}/clang-doc%{bin_suffix}
|
||||
%{_bindir}/clang-extdef-mapping%{bin_suffix}
|
||||
%{_bindir}/clang-format%{bin_suffix}
|
||||
%{_bindir}/clang-include-fixer%{bin_suffix}
|
||||
%{_bindir}/clang-move%{bin_suffix}
|
||||
%{_bindir}/clang-offload-bundler%{bin_suffix}
|
||||
%{_bindir}/clang-offload-packager%{bin_suffix}
|
||||
%{_bindir}/clang-offload-wrapper%{bin_suffix}
|
||||
%{_bindir}/clang-linker-wrapper%{bin_suffix}
|
||||
%{_bindir}/clang-nvlink-wrapper%{bin_suffix}
|
||||
%{_bindir}/clang-pseudo%{bin_suffix}
|
||||
%{_bindir}/clang-query%{bin_suffix}
|
||||
%{_bindir}/clang-refactor%{bin_suffix}
|
||||
%{_bindir}/clang-rename%{bin_suffix}
|
||||
%{_bindir}/clang-reorder-fields%{bin_suffix}
|
||||
%{_bindir}/clang-repl%{bin_suffix}
|
||||
%{_bindir}/clang-scan-deps%{bin_suffix}
|
||||
%{_bindir}/clang-tidy%{bin_suffix}
|
||||
%{_bindir}/clangd%{bin_suffix}
|
||||
%{_bindir}/diagtool%{bin_suffix}
|
||||
%{_bindir}/hmaptool%{bin_suffix}
|
||||
%{_bindir}/pp-trace%{bin_suffix}
|
||||
%{_bindir}/find-all-symbols%{bin_suffix}
|
||||
%{_bindir}/modularize%{bin_suffix}
|
||||
%{_bindir}/run-clang-tidy%{bin_suffix}
|
||||
%{pkg_bindir}/c-index-test
|
||||
%{pkg_bindir}/clang-apply-replacements
|
||||
%{pkg_bindir}/clang-change-namespace
|
||||
%{pkg_bindir}/clang-check
|
||||
%{pkg_bindir}/clang-doc
|
||||
%{pkg_bindir}/clang-extdef-mapping
|
||||
%{pkg_bindir}/clang-format
|
||||
%{pkg_bindir}/clang-include-fixer
|
||||
%{pkg_bindir}/clang-move
|
||||
%{pkg_bindir}/clang-offload-bundler
|
||||
%{pkg_bindir}/clang-offload-packager
|
||||
%{pkg_bindir}/clang-offload-wrapper
|
||||
%{pkg_bindir}/clang-linker-wrapper
|
||||
%{pkg_bindir}/clang-nvlink-wrapper
|
||||
%{pkg_bindir}/clang-pseudo
|
||||
%{pkg_bindir}/clang-query
|
||||
%{pkg_bindir}/clang-refactor
|
||||
%{pkg_bindir}/clang-rename
|
||||
%{pkg_bindir}/clang-reorder-fields
|
||||
%{pkg_bindir}/clang-repl
|
||||
%{pkg_bindir}/clang-scan-deps
|
||||
%{pkg_bindir}/clang-tidy
|
||||
%{pkg_bindir}/clangd
|
||||
%{pkg_bindir}/diagtool
|
||||
%{pkg_bindir}/hmaptool
|
||||
%{pkg_bindir}/pp-trace
|
||||
%{pkg_bindir}/find-all-symbols
|
||||
%{pkg_bindir}/modularize
|
||||
%{pkg_bindir}/run-clang-tidy
|
||||
%{_mandir}/man1/diagtool%{bin_suffix}.1.*
|
||||
%{pkg_sharedir}/clang/clang-format.el
|
||||
%{pkg_sharedir}/clang/clang-rename.el
|
||||
%{pkg_sharedir}/clang/clang-include-fixer.el
|
||||
%{pkg_sharedir}/clang/clang-format.py
|
||||
%{pkg_sharedir}/clang/clang-format-diff.py
|
||||
%{pkg_sharedir}/clang/clang-include-fixer.py
|
||||
%{pkg_sharedir}/clang/clang-tidy-diff.py
|
||||
%{pkg_sharedir}/clang/run-find-all-symbols.py
|
||||
%{pkg_sharedir}/clang/clang-rename.py
|
||||
|
||||
%files -n git-clang-format
|
||||
%{_bindir}/git-clang-format%{bin_suffix}
|
||||
|
||||
%changelog
|
||||
* Mon Jan 2 2023 Chenxi Mao <chenxi.mao@suse.com> - 15.0.6-1
|
||||
- Package init
|
||||
26
fedora-PATCH-clang-Don-t-install-static-libraries.patch
Normal file
26
fedora-PATCH-clang-Don-t-install-static-libraries.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 88704fc2eabb9dd19a9c3eb81a9b3dc37d95651c Mon Sep 17 00:00:00 2001
|
||||
From: Tom Stellard <tstellar@redhat.com>
|
||||
Date: Fri, 31 Jan 2020 11:04:57 -0800
|
||||
Subject: [PATCH][clang] Don't install static libraries
|
||||
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
clang/cmake/modules/AddClang.cmake | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
|
||||
index 5752f4277444..0f52822d91f0 100644
|
||||
--- a/clang/cmake/modules/AddClang.cmake
|
||||
+++ b/clang/cmake/modules/AddClang.cmake
|
||||
@@ -113,7 +113,7 @@ macro(add_clang_library name)
|
||||
if(TARGET ${lib})
|
||||
target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
|
||||
|
||||
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
|
||||
+ if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN))
|
||||
get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries)
|
||||
install(TARGETS ${lib}
|
||||
COMPONENT ${lib}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
43
fedora-PATCH-clang-Reorganize-gtest-integration.patch
Normal file
43
fedora-PATCH-clang-Reorganize-gtest-integration.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From c6b921c8d833546946b70a8c2640032fd7c62461 Mon Sep 17 00:00:00 2001
|
||||
From: serge-sans-paille <sguelton@redhat.com>
|
||||
Date: Thu, 25 Feb 2021 14:04:52 +0100
|
||||
Subject: [PATCH 1/6] [PATCH][clang] Reorganize gtest integration
|
||||
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
---
|
||||
clang/CMakeLists.txt | 12 +++++-------
|
||||
1 file changed, 5 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
|
||||
index 9e74014..0185276 100644
|
||||
--- a/clang/CMakeLists.txt
|
||||
+++ b/clang/CMakeLists.txt
|
||||
@@ -153,12 +153,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
|
||||
set(LLVM_UTILS_PROVIDED ON)
|
||||
set(CLANG_TEST_DEPS FileCheck count not)
|
||||
endif()
|
||||
- set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
|
||||
- if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
|
||||
- AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
- AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
|
||||
- add_subdirectory(${UNITTEST_DIR} utils/unittest)
|
||||
- endif()
|
||||
else()
|
||||
# Seek installed Lit.
|
||||
find_program(LLVM_LIT
|
||||
@@ -537,7 +531,11 @@ endif()
|
||||
|
||||
|
||||
if( CLANG_INCLUDE_TESTS )
|
||||
- if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
|
||||
+ set(UNITTEST_DIR ${LLVM_MAIN_SRC_DIR}/utils/unittest)
|
||||
+ if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
|
||||
+ AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
+ AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
|
||||
+ add_subdirectory(${UNITTEST_DIR} utils/unittest)
|
||||
add_subdirectory(unittests)
|
||||
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
|
||||
list(APPEND CLANG_TEST_PARAMS
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
From 581300e447602b9b7a505b0f07e8461d58d041ca Mon Sep 17 00:00:00 2001
|
||||
From: Tom Stellard <tstellar@redhat.com>
|
||||
Date: Fri, 1 Jul 2022 21:24:17 -0700
|
||||
Subject: [PATCH] clang-tools-extra: Make test dependency on LLVMHello optional
|
||||
|
||||
This fixes clang + clang-tools-extra standalone build after
|
||||
Signed-off-by: Chenxi Mao <chenxi.mao@suse.com>
|
||||
36892727e4f19a60778e371d78f8fb09d8122c85.
|
||||
---
|
||||
clang-tools-extra/test/CMakeLists.txt | 10 +++++++++-
|
||||
clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp | 2 +-
|
||||
clang-tools-extra/test/lit.cfg.py | 3 +++
|
||||
clang-tools-extra/test/lit.site.cfg.py.in | 1 +
|
||||
4 files changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
|
||||
index f4c529ee8af2..1cfb4dd529aa 100644
|
||||
--- a/clang-tools-extra/test/CMakeLists.txt
|
||||
+++ b/clang-tools-extra/test/CMakeLists.txt
|
||||
@@ -7,10 +7,15 @@
|
||||
set(CLANG_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
||||
set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
|
||||
|
||||
+if (TARGET LLVMHello)
|
||||
+ set (LLVM_HAS_LLVM_HELLO 1)
|
||||
+endif()
|
||||
+
|
||||
llvm_canonicalize_cmake_booleans(
|
||||
CLANG_TIDY_ENABLE_STATIC_ANALYZER
|
||||
CLANG_PLUGIN_SUPPORT
|
||||
LLVM_INSTALL_TOOLCHAIN_ONLY
|
||||
+ LLVM_HAS_LLVM_HELLO
|
||||
)
|
||||
|
||||
configure_lit_site_cfg(
|
||||
@@ -86,7 +91,10 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
endif()
|
||||
|
||||
if(TARGET CTTestTidyModule)
|
||||
- list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
|
||||
+ list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule)
|
||||
+ if (TARGET LLVMHello)
|
||||
+ list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule)
|
||||
+ endif()
|
||||
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
|
||||
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
|
||||
set(LLVM_LINK_COMPONENTS
|
||||
diff --git a/clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp b/clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
|
||||
index c66a94f458cf..b4e7a5d691e5 100644
|
||||
--- a/clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
|
||||
+++ b/clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
|
||||
@@ -1,4 +1,4 @@
|
||||
-// REQUIRES: plugins
|
||||
+// REQUIRES: plugins, llvm-hello
|
||||
// RUN: clang-tidy -checks='-*,mytest*' --list-checks -load %llvmshlibdir/CTTestTidyModule%pluginext -load %llvmshlibdir/LLVMHello%pluginext | FileCheck --check-prefix=CHECK-LIST %s
|
||||
// CHECK-LIST: Enabled checks:
|
||||
// CHECK-LIST-NEXT: mytest1
|
||||
diff --git a/clang-tools-extra/test/lit.cfg.py b/clang-tools-extra/test/lit.cfg.py
|
||||
index 9b99bfd93440..3fca9f25fb48 100644
|
||||
--- a/clang-tools-extra/test/lit.cfg.py
|
||||
+++ b/clang-tools-extra/test/lit.cfg.py
|
||||
@@ -59,3 +59,6 @@ config.substitutions.append(
|
||||
# Plugins (loadable modules)
|
||||
if config.has_plugins and config.llvm_plugin_ext:
|
||||
config.available_features.add('plugins')
|
||||
+
|
||||
+if config.has_llvm_hello:
|
||||
+ config.available_features.add("llvm-hello")
|
||||
diff --git a/clang-tools-extra/test/lit.site.cfg.py.in b/clang-tools-extra/test/lit.site.cfg.py.in
|
||||
index 4eb830a1baf1..6e5559348454 100644
|
||||
--- a/clang-tools-extra/test/lit.site.cfg.py.in
|
||||
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
|
||||
@@ -11,6 +11,7 @@ config.target_triple = "@LLVM_TARGET_TRIPLE@"
|
||||
config.host_triple = "@LLVM_HOST_TRIPLE@"
|
||||
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
|
||||
config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
|
||||
+config.has_llvm_hello = @LLVM_HAS_LLVM_HELLO@
|
||||
# Support substitution of the tools and libs dirs with user parameters. This is
|
||||
# used when we can't determine the tool dir at configuration time.
|
||||
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user