@ -1,43 +1,12 @@
@@ -1,43 +1,12 @@
%bcond_with compat_build
%bcond_with bundle_compat_lib
%bcond_without check
%global maj_ver 13
%global maj_ver 14
%global min_ver 0
%global patch_ver 1
#global rc_ver 4
%global patch_ver 6
%global clang_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global clang_tools_binaries \
%{_bindir}/clang-apply-replacements \
%{_bindir}/clang-change-namespace \
%{_bindir}/clang-check \
%{_bindir}/clang-doc \
%{_bindir}/clang-extdef-mapping \
%{_bindir}/clang-format \
%{_bindir}/clang-include-fixer \
%{_bindir}/clang-move \
%{_bindir}/clang-offload-bundler \
%{_bindir}/clang-offload-wrapper \
%{_bindir}/clang-query \
%{_bindir}/clang-refactor \
%{_bindir}/clang-rename \
%{_bindir}/clang-reorder-fields \
%{_bindir}/clang-repl \
%{_bindir}/clang-scan-deps \
%{_bindir}/clang-tidy \
%{_bindir}/clangd \
%{_bindir}/diagtool \
%{_bindir}/hmaptool \
%{_bindir}/pp-trace
%global clang_binaries \
%{_bindir}/clang \
%{_bindir}/clang++ \
%{_bindir}/clang-%{maj_ver} \
%{_bindir}/clang++-%{maj_ver} \
%{_bindir}/clang-cl \
%{_bindir}/clang-cpp \
%if %{with compat_build}
%global pkg_name clang%{maj_ver}
# Install clang to same prefix as llvm, so that apps that use llvm-config
@ -56,22 +25,12 @@
@@ -56,22 +25,12 @@
%global pkg_libdir %{_libdir}
%endif
%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without python3
%else
%bcond_with python3
%endif
%bcond_with bundle_compat_lib
%if %{with bundle_compat_lib}
%global compat_maj_ver 12
%global compat_maj_ver 13
%global compat_ver %{compat_maj_ver}.0.1
%endif
%global build_install_prefix %{buildroot}%{install_prefix}
%ifarch ppc64le aarch64
# Too many threads on ppc64 systems causes OOM errors.
%global _smp_mflags -j8
@ -112,15 +71,24 @@ Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
@@ -112,15 +71,24 @@ Patch1: 0002-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
Patch2: 0003-PATCH-clang-Don-t-install-static-libraries.patch
Patch3: 0001-Driver-Add-a-gcc-equivalent-triple-to-the-list-of-tr.patch
Patch4: 0001-cmake-Allow-shared-libraries-to-customize-the-soname.patch
Patch5: 0001-PATCH-clang-Fix-scan-build-py-executable-lookup-path.patch
# Patches for clang-tools
Patch201: 0001-Confusable-identifiers-detection.patch
Patch202: 0002-Misleading-bidirectional-detection.patch
Patch203: 0003-Misleading-unicode-identifier-detection-pass.patch
BuildRequires: gcc
BuildRequires: gcc-c++
# This patch can be dropped once gcc-12.0.1-0.5.fc36 is in the repo.
Patch5: 0001-Work-around-gcc-miscompile.patch
Patch7: 0010-PATCH-clang-Produce-DWARF4-by-default.patch
Patch8: disable-recommonmark.patch
# Patches for clang-tools-extra
# See https://reviews.llvm.org/D120301
Patch201: llvm-hello.patch
# See https://github.com/llvm/llvm-project/issues/54116
Patch202: remove-test.patch
# RHEL only: We build LLVM with clang, which now defaults to using the
# libstdc++ from gcc-toolset-12. Since we're linking some clang
# tools statically to some static libraries from LLVM, we
# need to use libstdc++12 as well. So, use gcc-toolset-12
# to compile clang.
BuildRequires: gcc-toolset-12-gcc-c++
BuildRequires: gcc-toolset-12-annobin-plugin-gcc
BuildRequires: cmake
BuildRequires: ninja-build
%if %{with compat_build}
@ -148,7 +116,7 @@ BuildRequires: python3-lit
@@ -148,7 +116,7 @@ BuildRequires: python3-lit
BuildRequires: python3-sphinx
BuildRequires: libatomic
# We need python3-devel for pathfix.py.
# We need python3-devel for %%py3_shebang_fix
BuildRequires: python3-devel
# For reproducible pyc file generation
@ -188,8 +156,7 @@ Requires: gcc-c++
@@ -188,8 +156,7 @@ Requires: gcc-c++
Provides: clang(major) = %{maj_ver}
Conflicts: compiler-rt < %{version}
Conflicts: compiler-rt > %{version}
Conflicts: compiler-rt < 11.0.0
%description
clang: noun
@ -208,12 +175,18 @@ libomp-devel to enable -fopenmp.
@@ -208,12 +175,18 @@ libomp-devel to enable -fopenmp.
%package libs
Summary: Runtime library for clang
Requires: %{name}-resource-filesystem%{?_isa} = %{version}
Requires: gcc-toolset-12-gcc-c++
Recommends: compiler-rt%{?_isa} = %{version}
# libomp-devel is required, so clang can find the omp.h header when compiling
# with -fopenmp.
Recommends: libomp-devel%{_isa} = %{version}
Recommends: libomp%{_isa} = %{version}
# Use lld as the default linker on ARM due to rhbz#1918924
%ifarch %{arm}
Requires: lld
%endif
%description libs
Runtime library for clang.
@ -297,11 +270,17 @@ Requires: python3
@@ -297,11 +270,17 @@ Requires: python3
%setup -T -q -b 1 -n %{clang_tools_srcdir}
%autopatch -m200 -p2
# This test is broken upstream. It is a clang-tidy unittest
# that includes a file from clang, breaking standalone builds.
# https://github.com/llvm/llvm-project/issues/54116
rm unittests/clang-tidy/ReadabilityModuleTest.cpp
# failing test case
rm test/clang-tidy/checkers/altera-struct-pack-align.cpp
pathfix.py -i %{__python3} -pn \
clang-tidy/tool/*.py \
%py3_shebang_fix \
clang-tidy/tool/ \
clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
%setup -q -n %{clang_srcdir}
@ -310,8 +289,8 @@ pathfix.py -i %{__python3} -pn \
@@ -310,8 +289,8 @@ pathfix.py -i %{__python3} -pn \
# failing test case
rm test/CodeGen/profile-filter.c
pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
%py3_shebang_fix \
tools/clang-format/ \
tools/clang-format/git-clang-format \
utils/hmaptool/hmaptool \
tools/scan-view/bin/scan-view \
@ -322,7 +301,6 @@ pathfix.py -i %{__python3} -pn \
@@ -322,7 +301,6 @@ pathfix.py -i %{__python3} -pn \
%endif
%build
# We run the builders out of memory on armv7 and i686 when LTO is enabled
%ifarch %{arm} i686
%define _lto_cflags %{nil}
@ -346,6 +324,10 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
@@ -346,6 +324,10 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
%set_build_flags
CXXFLAGS="$CXXFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"
CFLAGS="$CFLAGS -Wno-address -Wno-nonnull -Wno-maybe-uninitialized"
%if %{with bundle_compat_lib}
mv ../clang-%{compat_ver}.src ../clang
@ -361,7 +343,7 @@ mv ../clang-%{compat_ver}.src ../clang
@@ -361,7 +343,7 @@ mv ../clang-%{compat_ver}.src ../clang
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON \
-DCMAKE_INSTALL_RPATH:BOOL=";"
-DCMAKE_SKIP_RPATH:BOOL=ON
%ninja_build -C ../clang-compat-libs libclang.so
%ninja_build -C ../clang-compat-libs libclang-cpp.so
@ -369,25 +351,23 @@ mv ../clang-%{compat_ver}.src ../clang
@@ -369,25 +351,23 @@ mv ../clang-%{compat_ver}.src ../clang
%endif
# -DCMAKE_INSTALL_RPATH=";" is a workaround for llvm manually setting the
# rpath of libraries and binaries. llvm will skip the manual setting
# if CAMKE_INSTALL_RPATH is set to a value, but cmake interprets this value
# as nothing, so it sets the rpath to "" when installing.
# -DLLVM_ENABLE_NEW_PASS_MANAGER=ON can be removed once this patch is committed:
# https://reviews.llvm.org/D107628
%cmake -G Ninja \
-DCMAKE_C_COMPILER=/opt/rh/gcc-toolset-12/root/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/opt/rh/gcc-toolset-12/root/usr/bin/g++ \
-DLLVM_PARALLEL_LINK_JOBS=1 \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPYTHON_EXECUTABLE=%{__python3} \
-DCMAKE_INSTALL_RPATH:BOOL=";" \
-DCMAKE_SKIP_RPATH:BOOL=ON \
%ifarch s390 s390x %{arm} %ix86 ppc64le
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
%if %{with compat_build}
-DCLANG_BUILD_TOOLS:BOOL=OFF \
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver} \
-DLLVM_CONFIG:FILEPATH=%{pkg_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DCLANG_INCLUDE_TESTS:BOOL=OFF \
%else
@ -424,11 +404,14 @@ mv ../clang-%{compat_ver}.src ../clang
@@ -424,11 +404,14 @@ mv ../clang-%{compat_ver}.src ../clang
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCLANG_REPOSITORY_STRING="%{?fedora:Fedora}%{?rhel:Red Hat} %{version}-%{release}" \
-DCLANG_DEFAULT_UNWINDLIB=libgcc
%ifarch %{arm}
-DCLANG_DEFAULT_LINKER=lld \
%endif
-DCLANG_DEFAULT_UNWINDLIB=libgcc \
-DGCC_INSTALL_PREFIX=/opt/rh/gcc-toolset-12/root/usr
%cmake_build
%install
%cmake_install
@ -444,6 +427,8 @@ install -m 0755 ../clang-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{bu
@@ -444,6 +427,8 @@ install -m 0755 ../clang-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{bu
rm -Rf %{buildroot}%{install_bindir}
rm -Rf %{buildroot}%{install_prefix}/share
rm -Rf %{buildroot}%{install_prefix}/libexec
# Remove scanview-py helper libs
rm -Rf %{buildroot}%{install_prefix}/lib/{libear,libscanbuild}
%else
@ -482,7 +467,7 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
@@ -482,7 +467,7 @@ rm -vf %{buildroot}%{_datadir}/clang/clang-format-bbedit.applescript
rm -vf %{buildroot}%{_datadir}/clang/clang-format-sublime.py*
# TODO: Package html docs
rm -Rvf %{buildroot}%{_docdir}/clang/html
rm -Rvf %{buildroot}%{_docdir}/Clang/clang/html
rm -Rvf %{buildroot}%{_datadir}/clang/clang-doc-default-stylesheet.css
rm -Rvf %{buildroot}%{_datadir}/clang/index.js
@ -533,21 +518,25 @@ sed -i -e "s/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'/'ASAN_SYMBOLIZER_PAT
@@ -533,21 +518,25 @@ sed -i -e "s/'ASAN_SYMBOLIZER_PATH', 'MSAN_SYMBOLIZER_PATH'/'ASAN_SYMBOLIZER_PAT
%if %{with check}
# requires lit.py from LLVM utilities
# FIXME: Fix failing ARM tests
SOURCE_DATE_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \
%endif
SOURCE_DATA_EPOCH=1629181597 LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %{__ninja} check-all -C %{__cmake_builddir} || \
%ifarch %{arm}
:
%else
false
%endif
%endif
%endif
%if %{without compat_build}
%files
%license LICENSE.TXT
%{clang_binaries}
%{_bindir}/clang
%{_bindir}/clang++
%{_bindir}/clang-%{maj_ver}
%{_bindir}/clang++-%{maj_ver}
%{_bindir}/clang-cl
%{_bindir}/clang-cpp
%{_mandir}/man1/clang.1.gz
%{_mandir}/man1/clang++.1.gz
%{_mandir}/man1/clang-%{maj_ver}.1.gz
@ -612,7 +601,29 @@ false
@@ -612,7 +601,29 @@ false
%files tools-extra
%{clang_tools_binaries}
%{_bindir}/clang-apply-replacements
%{_bindir}/clang-change-namespace
%{_bindir}/clang-check
%{_bindir}/clang-doc
%{_bindir}/clang-extdef-mapping
%{_bindir}/clang-format
%{_bindir}/clang-include-fixer
%{_bindir}/clang-move
%{_bindir}/clang-offload-bundler
%{_bindir}/clang-offload-wrapper
%{_bindir}/clang-linker-wrapper
%{_bindir}/clang-nvlink-wrapper
%{_bindir}/clang-query
%{_bindir}/clang-refactor
%{_bindir}/clang-rename
%{_bindir}/clang-reorder-fields
%{_bindir}/clang-repl
%{_bindir}/clang-scan-deps
%{_bindir}/clang-tidy
%{_bindir}/clangd
%{_bindir}/diagtool
%{_bindir}/hmaptool
%{_bindir}/pp-trace
%{_bindir}/c-index-test
%{_bindir}/find-all-symbols
%{_bindir}/modularize
@ -638,6 +649,15 @@ false
@@ -638,6 +649,15 @@ false
%endif
%changelog
* Tue Jul 19 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.6-1
- Update to 14.0.6
* Mon Jun 20 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.5-1
- Update to 14.0.5
* Fri Apr 22 2022 Timm Bäder <tbaeder@redhat.com> - 14.0.0-1
- 14.0.0 Release
* Thu Feb 03 2022 Tom Stellard <tstellar@redhat.com> - 13.0.1-1
- 13.0.1 Release