llvm-toolset-19/llvm-toolset-19.spec
liyunfei ed1f75f8a7 package init
(cherry picked from commit a7d9e26ab7e5c946aee5ecc5b998fb8810ef1671)
2025-02-17 10:06:41 +08:00

2804 lines
91 KiB
RPMSpec

#region globals
#region version
%global maj_ver 19
%global min_ver 1
%global patch_ver 7
%global os_version %{lua: print(tonumber(rpm.expand("%{dist}"):match("oe(%d+)") or 9999))}
# Build sys_llvm packages or compat packages
%bcond_with sys_llvm
%bcond_with check
%if %{os_version} <= 2203
%bcond_with toolchain_clang
%else
%bcond_without toolchain_clang
%endif
# mlir requires pybind11-2.9 but 22.03 only have pybind11-2.8
%if %{os_version} <= 2203
%bcond_with mlir
%else
%bcond_without mlir
%endif
%bcond_without lldb
%bcond_without libcxx
%if %{with toolchain_clang}
%global toolchain clang
%endif
%undefine __cmake_in_source_build
%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}.src
#region LLVM globals
%if %{with sys_llvm}
%global pkg_name_llvm llvm
%global install_prefix /usr
%global install_bindir %{_bindir}
%global install_datadir %{_datadir}
%global install_libdir %{_libdir}
%global install_includedir %{_includedir}
%global install_libexecdir %{_libexecdir}
%global install_docdir %{_docdir}
%global unprefixed_libdir %{_lib}
%global pkg_datadir %{_datadir}
%global pkg_suffix %{nil}
%global exec_suffix %{nil}
%else
%global _scl_prefix /opt/openEuler
%{?scl:%scl_package %scl}
%{!?scl:%global scl_prefix llvm-toolset-%{maj_ver}-}
%{!?scl:%global pkg_name %{name}}
%{!?scl:%global _scl_root %{_scl_prefix}/llvm-toolset-%{maj_ver}/root}
%{!?scl:%global _scl_scripts %{_scl_prefix}/llvm-toolset-%{maj_ver}}
%global pkg_name_llvm %{?scl_prefix}llvm
%global pkg_suffix %{maj_ver}
%global exec_suffix -%{maj_ver}
%global install_prefix %{!?scl:%{_scl_prefix}/llvm-toolset-%{maj_ver}/root}%{_prefix}
%global install_bindir %{install_prefix}/bin
%global install_includedir %{install_prefix}/include
%global install_libdir %{install_prefix}/%{_lib}
%global install_datadir %{install_prefix}/share
%global install_libexecdir %{install_prefix}/libexec
%global install_docdir %{install_datadir}/doc
%global unprefixed_libdir %{_lib}
%global pkg_includedir %{_includedir}/%{pkg_name_llvm}
%global pkg_datadir %{install_prefix}/share
%endif
%global targets_to_build "all"
%global experimental_targets_to_build ""
%global build_install_prefix %{buildroot}%{install_prefix}
%global max_link_jobs %{_smp_build_ncpus}
%global llvm_triple %{_host}
%global build_src_dir %{_builddir}/%{src_tarball_dir}
%if %{os_version} <= 2203
%global build_dir _build
%else
%global build_dir llvm/%{_vpath_builddir}
%endif
%global build_libdir %{build_src_dir}/%{build_dir}/%{_lib}
# Disable LTO as this causes crash if gcc lto enabled.
%define _lto_cflags %{nil}
#endregion LLVM globals
#region CLANG globals
%global pkg_name_clang %{?scl_prefix}clang
#endregion CLANG globals
#region COMPILER-RT globals
%global pkg_name_compiler_rt %{?scl_prefix}compiler-rt
%global optflags %(echo %{optflags} | sed 's/-fgcc-compatible//')
%global optflags %(echo %{optflags} | sed 's/-specs=\/usr\/lib\/rpm\/generic-hardened-cc1//')
%ifnarch x86_64
%global optflags %(echo %{optflags} | sed 's/-fstack-clash-protection//')
# may affect cmake check for fpic
%endif
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
# export ASMFLAGS=$CFLAGS
#endregion COMPILER-RT globals
#region LLD globals
%global pkg_name_libomp %{?scl_prefix}libomp
%global so_suffix %{maj_ver}.%{min_ver}
%ifarch ppc64le
%global libomp_arch ppc64
%else
%global libomp_arch %{_arch}
%endif
#endregion LLD globals
#region LLD globals
%global pkg_name_lld %{?scl_prefix}lld
#endregion LLD globals
#region LLDB globals
%global pkg_name_lldb %{?scl_prefix}lldb
#endregion LLDB globals
#endregion globals
#region MLIR globals
%global pkg_name_mlir %{?scl_prefix}mlir
#endregion MLIR globals
#region libcxx globals
%global pkg_name_libcxx %{?scl_prefix}libcxx
%global pkg_name_libcxxabi %{?scl_prefix}libcxxabi
%global pkg_name_llvm_libunwind %{?scl_prefix}llvm-libunwind
#endregion libcxx globals
#region packages
#region main package
Name: llvm-toolset-%{maj_ver}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 1
Summary: The Low Level Virtual Machine
License: NCSA
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{src_tarball_dir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{src_tarball_dir}.tar.xz.sig
# CMakeLists for libcxx build
%if %{maj_ver} == 17
Source2: CMakeLists.txt
%endif
Patch0001: 0001-PATCH-clang-Don-t-install-static-libraries.patch
Patch0002: 0002-Add-triples-for-X86_64-AArch64-Riscv64-openEuler-gcc.patch
Patch0003: 0003-Always-build-shared-libs-for-LLD.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: clang
BuildRequires: cmake
BuildRequires: chrpath
BuildRequires: ninja-build
BuildRequires: zlib-devel
BuildRequires: libzstd-devel
BuildRequires: libffi-devel
BuildRequires: ncurses-devel
BuildRequires: binutils-devel
BuildRequires: libedit-devel
BuildRequires: multilib-rpm-config
BuildRequires: python3-devel
BuildRequires: python3-psutil
BuildRequires: python3-sphinx
BuildRequires: python3-setuptools
%if %{maj_ver} >= 18
BuildRequires: python3-myst-parser
%endif
%if %{with toolchain_clang}
BuildRequires: clang
BuildRequires: llvm
%endif
# LLVM's LineEditor library will use libedit if it is available.
BuildRequires: libedit-devel
BuildRequires: swig
BuildRequires: libxml2-devel
BuildRequires: doxygen
# For clang-offload-packager
BuildRequires: elfutils-libelf-devel
BuildRequires: perl
BuildRequires: perl-Data-Dumper
BuildRequires: perl-Encode
BuildRequires: libffi-devel
BuildRequires: perl-generators
# According to https://fedoraproject.org/wiki/Packaging:Emacs a package
# should BuildRequires: emacs if it packages emacs integration files.
BuildRequires: emacs
BuildRequires: libatomic
# scan-build uses these perl modules so they need to be installed in order
# to run the tests.
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)
%if %{with mlir}
BuildRequires: python%{python3_pkgversion}-numpy
BuildRequires: python%{python3_pkgversion}-pybind11
BuildRequires: python%{python3_pkgversion}-pyyaml
%if %{maj_ver} >= 20
BuildRequires: python%{python3_pkgversion}-nanobind-devel
%endif
%endif
BuildRequires: graphviz
# This is required because we need "ps" when running LLDB tests
BuildRequires: procps-ng
Requires: %{pkg_name_llvm} = %{version}-%{release}
Requires: %{pkg_name_clang} = %{version}-%{release}
Requires: %{pkg_name_lld} = %{version}-%{release}
%description
LLVM is a compiler infrastructure designed for compile-time, link-time,
runtime, and idle-time optimization of programs from arbitrary programming
languages. The compiler infrastructure includes mirror sets of programming
tools as well as libraries with equivalent functionality.
#endregion main package
#region LLVM packages
%package -n %{pkg_name_llvm}
Summary: The Low Level Virtual Machine
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
Provides: llvm(major) = %{maj_ver}
%description -n %{pkg_name_llvm}
LLVM is a compiler infrastructure designed for compile-time, link-time,
runtime, and idle-time optimization of programs from arbitrary programming
languages. The compiler infrastructure includes mirror sets of programming
tools as well as libraries with equivalent functionality.
%package -n %{pkg_name_llvm}-devel
Summary: Libraries and header files for LLVM
Requires: %{pkg_name_llvm}%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
# The installed LLVM cmake files will add -ledit to the linker flags for any
# app that requires the libLLVMLineEditor, so we need to make sure
# libedit-devel is available.
Requires: libedit-devel
Requires: libzstd-devel
# The installed cmake files reference binaries from llvm-test, llvm-static, and
# llvm-gtest. We tried in the past to split the cmake exports for these binaries
# out into separate files, so that llvm-devel would not need to Require these packages,
# but this caused bugs (rhbz#1773678) and forced us to carry two non-upstream
# patches.
Requires: %{pkg_name_llvm}-static%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_llvm}-test%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_llvm}-googletest%{?_isa} = %{version}-%{release}
Requires(post): %{_sbindir}/alternatives
Requires(postun): %{_sbindir}/alternatives
Provides: llvm-devel(major) = %{maj_ver}
%description -n %{pkg_name_llvm}-devel
This package contains library and header files needed to develop new native
programs that use the LLVM infrastructure.
%package -n %{pkg_name_llvm}-doc
Summary: Documentation for LLVM
BuildArch: noarch
Requires: %{pkg_name_llvm} = %{version}-%{release}
Provides: %{pkg_name_llvm}-help = %{version}-%{release}
Obsoletes: %{pkg_name_llvm}-help < %{version}-%{release}
%description -n %{pkg_name_llvm}-doc
Documentation for the LLVM compiler infrastructure.
%package -n %{pkg_name_llvm}-libs
Summary: LLVM shared libraries
%description -n %{pkg_name_llvm}-libs
Shared libraries for the LLVM compiler infrastructure.
%package -n %{pkg_name_llvm}-static
Summary: LLVM static libraries
Conflicts: %{pkg_name_llvm}-devel < 8
Provides: llvm-static(major) = %{maj_ver}
%description -n %{pkg_name_llvm}-static
Static libraries for the LLVM compiler infrastructure.
%package -n %{pkg_name_llvm}-cmake-utils
Summary: CMake utilities shared across LLVM subprojects
%description -n %{pkg_name_llvm}-cmake-utils
CMake utilities shared across LLVM subprojects.
This is for internal use by LLVM packages only.
%package -n %{pkg_name_llvm}-test
Summary: LLVM regression tests
Requires: %{pkg_name_llvm}%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
Provides: llvm-test(major) = %{maj_ver}
%description -n %{pkg_name_llvm}-test
LLVM regression tests.
%package -n %{pkg_name_llvm}-googletest
Summary: LLVM's modified googletest sources
%description -n %{pkg_name_llvm}-googletest
LLVM's modified googletest sources.
#endregion LLVM packages
#region CLANG packages
%package -n %{pkg_name_clang}
Summary: A C language family front-end for LLVM
Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release}
# clang requires gcc, clang++ requires libstdc++-devel
# - https://bugzilla.redhat.com/show_bug.cgi?id=1021645
# - https://bugzilla.redhat.com/show_bug.cgi?id=1158594
Requires: libstdc++-devel
Requires: gcc-c++
Provides: clang(major) = %{maj_ver}
Conflicts: compiler-rt < 11.0.0
%description -n %{pkg_name_clang}
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 -n %{pkg_name_clang}-libs
Summary: Runtime library for clang
Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release}
Recommends: %{pkg_name_compiler_rt}%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_llvm}-libs = %{version}-%{release}
# atomic support is not part of compiler-rt
Recommends: libatomic%{?_isa}
# libomp-devel is required, so clang can find the omp.h header when compiling
# with -fopenmp.
Recommends: %{pkg_name_libomp}-devel%{_isa} = %{version}-%{release}
Recommends: %{pkg_name_libomp}%{_isa} = %{version}-%{release}
%description -n %{pkg_name_clang}-libs
Runtime library for clang.
%package -n %{pkg_name_clang}-devel
Summary: Development header files for clang
Requires: %{pkg_name_clang}-libs = %{version}-%{release}
Requires: %{pkg_name_clang}%{?_isa} = %{version}-%{release}
# The clang CMake files reference tools from clang-tools-extra.
Requires: %{pkg_name_clang}-tools-extra%{?_isa} = %{version}-%{release}
Provides: clang-devel(major) = %{maj_ver}
# For the clangd language server contained in this subpackage,
# add a Provides so users can just run "dnf install clangd."
# This Provides is only present in the primary, unversioned clang package.
# Users who want the compat versions can install them using the full name.
%if %{with sys_llvm}
Provides: clangd = %{version}-%{release}
%endif
%description -n %{pkg_name_clang}-devel
Development header files for clang.
%package -n %{pkg_name_clang}-resource-filesystem
Summary: Filesystem package that owns the clang resource directory
Provides: clang-resource-filesystem(major) = %{maj_ver}
%description -n %{pkg_name_clang}-resource-filesystem
This package owns the clang resouce directory: $libdir/clang/$version/
%package -n %{pkg_name_clang}-analyzer
Summary: A source code analysis framework
License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT
BuildArch: noarch
Requires: %{pkg_name_clang} = %{version}-%{release}
%description -n %{pkg_name_clang}-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 -n %{pkg_name_clang}-tools-extra
Summary: Extra tools for clang
Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release}
Requires: emacs-filesystem
%description -n %{pkg_name_clang}-tools-extra
A set of extra tools built using Clang's tooling API.
%package -n %{pkg_name_clang}-tools-extra-devel
Summary: Development header files for clang tools
Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release}
%description -n %{pkg_name_clang}-tools-extra-devel
Development header files for clang tools.
# Put git-clang-format in its own package, because it Requires git
# and we don't want to force users to install all those dependenices if they
# just want clang.
%package -n %{?scl_prefix}git-clang-format%{?pkg_suffix}
Summary: Integration of clang-format for git
Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release}
Requires: git
Requires: python3
%description -n %{?scl_prefix}git-clang-format%{pkg_suffix}
clang-format integration for git.
%if %{with sys_llvm}
%package -n python3-clang
Summary: Python3 bindings for clang
Requires: %{pkg_name_clang}-devel%{?_isa} = %{version}-%{release}
Requires: python%{python3_pkgversion}
%description -n python%{python3_pkgversion}-clang
%{summary}.
%endif
#endregion CLANG packages
#region COMPILER-RT packages
%package -n %{pkg_name_compiler_rt}
Summary: LLVM "compiler-rt" runtime libraries
License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT
Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release}
Provides: compiler-rt(major) = %{maj_ver}
%description -n %{pkg_name_compiler_rt}
The compiler-rt project is a part of the LLVM project. It provides
implementation of the low-level target-specific hooks required by
code generation, sanitizer runtimes and profiling library for code
instrumentation, and Blocks C language extension.
#endregion COMPILER-RT packages
#region OPENMP packages
%package -n %{pkg_name_libomp}
Summary: OpenMP runtime for clang
URL: http://openmp.llvm.org
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
Requires: elfutils-libelf%{?_isa}
Provides: libomp(major) = %{maj_ver}
%description -n %{pkg_name_libomp}
OpenMP runtime for clang.
%package -n %{pkg_name_libomp}-devel
Summary: OpenMP header files
URL: http://openmp.llvm.org
Requires: %{pkg_name_libomp}%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_clang}-resource-filesystem%{?_isa} = %{version}-%{release}
Provides: libomp-devel(major) = %{maj_ver}
%description -n %{pkg_name_libomp}-devel
OpenMP header files.
URL: http://openmp.llvm.org
#endregion OPENMP packages
#region LLD packages
%package -n %{pkg_name_lld}
Summary: The LLVM Linker
Requires(post): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
Requires: %{pkg_name_lld}-libs = %{version}-%{release}
Provides: lld(major) = %{maj_ver}
%description -n %{pkg_name_lld}
The LLVM project linker.
%package -n %{pkg_name_lld}-devel
Summary: Libraries and header files for LLD
Requires: %{pkg_name_lld}-libs%{?_isa} = %{version}-%{release}
# %if %{with sys_llvm}
# lld tools are referenced in the cmake files, so we need to add lld as a
# dependency.
# Requires: %{pkg_name_lld}%{?_isa} = %{version}-%{release}
# %endif
Provides: lld-devel(major) = %{maj_ver}
%description -n %{pkg_name_lld}-devel
This package contains library and header files needed to develop new native
programs that use the LLD infrastructure.
%package -n %{pkg_name_lld}-libs
Summary: LLD shared libraries
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_lld}-libs
Shared libraries for LLD.
#endregion LLD packages
#region LLDB packages
%if %{with lldb}
%package -n %{pkg_name_lldb}
Summary: Next generation high-performance debugger
License: Apache-2.0 WITH LLVM-exception OR NCSA
URL: http://lldb.llvm.org/
Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release}
Requires: %{?scl_prefix}python3-lldb
%description -n %{pkg_name_lldb}
LLDB is a next generation, high-performance debugger. It is built as a set
of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.
%package -n %{pkg_name_lldb}-devel
Summary: Development header files for LLDB
Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_lldb}-devel
The package contains header files for the LLDB debugger.
%package -n %{?scl_prefix}python3-lldb
%{?python_provide:%python_provide python3-lldb}
Summary: Python module for LLDB
Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release}
%description -n %{?scl_prefix}python3-lldb
The package contains the LLDB Python module.
%endif
#endregion LLDB packages
#region MLIR packages
%if %{with mlir}
%package -n %{pkg_name_mlir}
Summary: Multi-Level Intermediate Representation Overview
License: Apache-2.0 WITH LLVM-exception
URL: http://mlir.llvm.org
%description -n %{pkg_name_mlir}
The MLIR project is a novel approach to building reusable and extensible
compiler infrastructure. MLIR aims to address software fragmentation,
improve compilation for heterogeneous hardware, significantly reduce
the cost of building domain specific compilers, and aid in connecting
existing compilers together.
%package -n %{pkg_name_mlir}-static
Summary: MLIR static files
Requires: %{pkg_name_mlir}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_mlir}-static
MLIR static files.
%package -n %{pkg_name_mlir}-devel
Summary: MLIR development files
Requires: %{pkg_name_mlir}%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_mlir}-static%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_mlir}-devel
MLIR development files.
%package -n %{?scl_prefix}python3-mlir
%{?python_provide:%python_provide python3-mlir}
Summary: MLIR python bindings
Requires: python3
Requires: python3-numpy
%description -n %{?scl_prefix}python3-mlir
MLIR python bindings.
%endif
#endregion MLIR packages
#region libcxx packages
%if %{with libcxx}
%package -n %{pkg_name_libcxx}
Summary: C++ standard library targeting C++11
License: Apache-2.0 WITH LLVM-exception OR MIT OR NCSA
URL: http://libcxx.llvm.org/
Requires: %{pkg_name_libcxxabi}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_libcxx}
libc++ is a new implementation of the C++ standard library, targeting C++11 and above.
%package -n %{pkg_name_libcxx}-devel
Summary: Headers and libraries for %{pkg_name_libcxx} devel
Requires: %{pkg_name_libcxx}%{?_isa} = %{version}-%{release}
Requires: %{pkg_name_libcxxabi}-devel
%description -n %{pkg_name_libcxx}-devel
Headers and libraries for %{pkg_name_libcxx} devel.
%package -n %{pkg_name_libcxx}-static
Summary: Static libraries for %{pkg_name_libcxx}
%description -n %{pkg_name_libcxx}-static
Static libraries for %{pkg_name_libcxx}.
%package -n %{pkg_name_libcxxabi}
Summary: Low level support for a standard C++ library
%description -n %{pkg_name_libcxxabi}
libcxxabi provides low level support for a standard C++ library.
%package -n %{pkg_name_libcxx}abi-devel
Summary: Headers and libraries for %{pkg_name_libcxxabi} devel
Requires: %{pkg_name_libcxxabi}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_libcxxabi}-devel
Headers and libraries for %{pkg_name_libcxxabi} devel.
%package -n %{pkg_name_libcxxabi}-static
Summary: Static libraries for %{pkg_name_libcxxabi}
%description -n %{pkg_name_libcxxabi}-static
Static libraries for %{pkg_name_libcxxabi}.
%package -n %{pkg_name_llvm_libunwind}
Summary: LLVM libunwind
%description -n %{pkg_name_llvm_libunwind}
LLVM libunwind is an implementation of the interface defined by the HP libunwind
project. It was contributed Apple as a way to enable clang++ to port to
platforms that do not have a system unwinder. It is intended to be a small and
fast implementation of the ABI, leaving off some features of HP's libunwind
that never materialized (e.g. remote unwinding).
%package -n %{pkg_name_llvm_libunwind}-devel
Summary: LLVM libunwind development files
Provides: %{pkg_name_llvm_libunwind}(major) = %{maj_ver}
Requires: %{pkg_name_llvm_libunwind}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_llvm_libunwind}-devel
Unversioned shared library for LLVM libunwind
%package -n %{pkg_name_llvm_libunwind}-static
Summary: Static library for LLVM libunwind
%description -n %{pkg_name_llvm_libunwind}-static
Static library for LLVM libunwind.
%package -n %{pkg_name_llvm_libunwind}-doc
Summary: libunwind documentation
License: BSD AND (Apache-2.0 WITH LLVM-exception OR NCSA OR MIT)
%description -n %{pkg_name_llvm_libunwind}-doc
Documentation for LLVM libunwind
%endif
#endregion libcxx packages
#endregion packages
#region prep
%prep
# -T : Do Not Perform Default Archive Unpacking (without this, the <n>th source would be unpacked twice)
# -b <n> : Unpack The nth Sources Before Changing Directory
# -n : Set Name of Build Directory
#
# see http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html
%autosetup -N -T -b 0 -n %{src_tarball_dir}
# Apply all patches with number < 500 (unconditionally)
# See https://rpm-software-management.github.io/rpm/manual/autosetup.html
%autopatch -M499 -p1
# automatically apply patches based on LLVM version
%autopatch -m%{maj_ver}00 -M%{maj_ver}99 -p1
# shebang_fix part removed
#endregion prep
#region build
%build
# TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le
# Decrease debuginfo verbosity to reduce memory consumption during final library linking.
%global reduce_debuginfo 0
%if %reduce_debuginfo == 1
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
%global projects clang;clang-tools-extra;lld
%if %{with lldb}
%global projects %{projects};lldb
%endif
%if %{with mlir}
%global projects %{projects};mlir
%endif
%global runtimes compiler-rt;openmp
%if %{maj_ver} >= 19
%global runtimes %{runtimes};offload
%endif
%if %{with libcxx}
%global runtimes %{runtimes};libcxx;libcxxabi;libunwind
%endif
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
export ASMFLAGS="%{build_cflags}"
# We set CLANG_DEFAULT_PIE_ON_LINUX=OFF and PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON to match the
# defaults used by Fedora's GCC.
#region cmake options
# Common cmake arguments used by both the normal build and bundle_compat_lib.
# Any ABI-affecting flags should be in here.
%global cmake_common_args \\\
-DLLVM_ENABLE_EH=ON \\\
-DLLVM_ENABLE_RTTI=ON \\\
-DLLVM_USE_PERF=ON \\\
-DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \\\
-DBUILD_SHARED_LIBS=OFF \\\
-DLLVM_BUILD_LLVM_DYLIB=ON
%global cmake_config_args %{cmake_common_args}
#region clang options
%global cmake_config_args %{cmake_config_args} \\\
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \\\
-DCLANG_CONFIG_FILE_SYSTEM_DIR=%{_sysconfdir}/%{pkg_name_clang}/ \\\
-DCLANG_DEFAULT_PIE_ON_LINUX=OFF \\\
-DCLANG_DEFAULT_UNWINDLIB=libgcc \\\
-DCLANG_ENABLE_ARCMT:BOOL=ON \\\
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \\\
-DCLANG_INCLUDE_DOCS:BOOL=ON \\\
-DCLANG_INCLUDE_TESTS:BOOL=ON \\\
-DCLANG_LINK_CLANG_DYLIB=ON \\\
-DCLANG_PLUGIN_SUPPORT:BOOL=ON \\\
-DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \\\
-DCLANG_RESOURCE_DIR=../%{_lib}/clang/%{maj_ver} \\\
-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra
#endregion clang options
#region compiler-rt options
%global cmake_config_args %{cmake_config_args} \\\
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF \\\
-DCOMPILER_RT_INSTALL_PATH=%{install_libdir}/clang/%{maj_ver}
#endregion compiler-rt options
#region docs options
# Add all *enabled* documentation targets (no doxygen but sphinx)
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\
-DLLVM_ENABLE_SPHINX:BOOL=ON \\\
-DLLVM_BUILD_DOCS:BOOL=ON
# Configure sphinx:
# Build man-pages but no HTML docs using sphinx
%global cmake_config_args %{cmake_config_args} \\\
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \\\
-DSPHINX_OUTPUT_HTML:BOOL=OFF \\\
-DSPHINX_OUTPUT_MAN:BOOL=ON \\\
-DSPHINX_WARNINGS_AS_ERRORS=OFF
#endregion docs options
#region lldb options
%if %{with lldb}
%global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_CURSES:BOOL=OFF
%global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_LIBEDIT:BOOL=OFF
%global cmake_config_args %{cmake_config_args} -DLLDB_DISABLE_PYTHON:BOOL=OFF
%ifarch ppc64le
%global cmake_config_args %{cmake_config_args} -DLLDB_TEST_USER_ARGS=--skip-category=watchpoint
%endif
%endif
#endregion lldb options
#region libcxx options
%if %{with libcxx}
%global cmake_config_args %{cmake_config_args} \\\
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \\\
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \\\
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \\\
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \\\
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \\\
-DLIBUNWIND_INSTALL_INCLUDE_DIR=%{install_includedir}/llvm-libunwind
# If we don't set the .._INSTALL_LIBRARY_DIR variables,
# the *.so files will be placed in a subdirectory that includes the triple
%global cmake_config_args %{cmake_config_args} \\\
-DLIBCXX_INSTALL_LIBRARY_DIR=%{install_libdir} \\\
-DLIBCXXABI_INSTALL_LIBRARY_DIR=%{install_libdir} \\\
-DLIBUNWIND_INSTALL_LIBRARY_DIR=%{install_libdir}
# If we don't adjust this, we will install into this unwanted location:
# /usr/include/i686-redhat-linux-gnu/c++/v1/__config_site
%global cmake_config_args %{cmake_config_args} \\\
-DLIBCXX_INSTALL_INCLUDE_TARGET_DIR=%{install_includedir}/c++/v1
%endif
#endregion libcxx options
#region llvm options
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_APPEND_VC_REV:BOOL=OFF \\\
-DLLVM_BUILD_EXAMPLES:BOsOL=OFF \\\
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \\\
-DLLVM_BUILD_RUNTIME:BOOL=ON \\\
-DLLVM_BUILD_TOOLS:BOOL=ON \\\
-DLLVM_BUILD_UTILS:BOOL=ON \\\
-DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \\\
-DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \\\
-DLLVM_DYLIB_COMPONENTS="all" \\\
-DLLVM_ENABLE_FFI:BOOL=ON \\\
-DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \\\
-DLLVM_ENABLE_PROJECTS="%{projects}" \\\
-DLLVM_ENABLE_RUNTIMES="%{runtimes}" \\\
-DLLVM_ENABLE_ZLIB:BOOL=FORCE_ON \\\
-DLLVM_ENABLE_ZSTD:BOOL=FORCE_ON \\\
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \\\
-DLLVM_INCLUDE_BENCHMARKS=OFF \\\
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \\\
-DLLVM_INCLUDE_TOOLS:BOOL=ON \\\
-DLLVM_INCLUDE_UTILS:BOOL=ON \\\
-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\
-DLLVM_INSTALL_UTILS:BOOL=ON \\\
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \\\
-DLLVM_PARALLEL_LINK_JOBS=1 \\\
-DLLVM_TOOLS_INSTALL_DIR:PATH=bin \\\
-DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \\\
-DLLVM_UTILS_INSTALL_DIR:PATH=bin
#endregion llvm options
#region mlir options
%if %{with mlir}
%global cmake_config_args %{cmake_config_args} \\\
-DMLIR_INCLUDE_DOCS:BOOL=ON \\\
-DMLIR_INCLUDE_TESTS:BOOL=ON \\\
-DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \\\
-DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \\\
-DMLIR_BUILD_MLIR_C_DYLIB=ON \\\
-DMLIR_ENABLE_BINDINGS_PYTHON:BOOL=ON
%endif
#endregion mlir options
#region openmp options
%global cmake_config_args %{cmake_config_args} \\\
-DOPENMP_INSTALL_LIBDIR=%{install_libdir} \\\
-DLIBOMP_INSTALL_ALIASES=OFF
%if 0%{?__isa_bits} == 64
%global cmake_config_args %{cmake_config_args} -DOPENMP_LIBDIR_SUFFIX=64
%else
%global cmake_config_args %{cmake_config_args} -DOPENMP_LIBDIR_SUFFIX=
%endif
#endregion openmp options
#region test options
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_BUILD_TESTS:BOOL=ON \\\
-DLLVM_INCLUDE_TESTS:BOOL=ON \\\
-DLLVM_INSTALL_GTEST:BOOL=ON \\\
-DLLVM_LIT_ARGS="-vv"
%if %{with lto_build}
%if 0%{?fedora} >= 41
%global cmake_config_args %{cmake_config_args} -DLLVM_UNITTEST_LINK_FLAGS="-fno-lto"
%else
%global cmake_config_args %{cmake_config_args} -DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0"
%endif
%endif
#endregion test options
#region misc options
%global cmake_config_args %{cmake_config_args} \\\
-DCMAKE_BUILD_TYPE=RelWithDebInfo \\\
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \\\
-DENABLE_LINKER_BUILD_ID:BOOL=ON \\\
-DOFFLOAD_INSTALL_LIBDIR=%{install_libdir} \\\
-DPython3_EXECUTABLE=%{__python3}
# During the build, we use both the system clang and the just-built clang, and
# they need to use the system and just-built shared objects respectively. If
# we use LD_LIBRARY_PATH to point to our build directory, the system clang
# may use the just-built shared objects instead, which may not be compatible
# even if the version matches (e.g. when building compat libs or different rcs).
# Instead, we make use of rpath during the build and only strip it on
# installation using the CMAKE_SKIP_INSTALL_RPATH option.
%global cmake_config_args %{cmake_config_args} -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON
%if %reduce_debuginfo == 1
%global cmake_config_args %{cmake_config_args} -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG"
%global cmake_config_args %{cmake_config_args} -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG"
%endif
%if 0%{?__isa_bits} == 64
%global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX=64
%else
%global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX=
%endif
%global cmake_config_args %{cmake_config_args} -DLLVM_BINUTILS_INCDIR=%{_includedir}
%ifarch x86_64
%global cmake_config_args %{cmake_config_args} -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS"
# removed -Wl,-z,cet-report=error, which cause error: missing IBT and SHSTK properties.
%endif
#endregion misc options
extra_cmake_args=''
#endregion cmake options
%if %{os_version} <= 2203
mkdir _build
cd _build
%define __cmake_in_source_build 1
%define build_tool %ninja_build
%define install_tool %ninja_install
%define cmake_target_opts %{nil}
%else
cd llvm
%define build_tool %cmake_build
%define install_tool %cmake_install
%define cmake_target_opts --target
%endif
%cmake ../llvm -G Ninja %cmake_config_args $extra_cmake_args
# Build libLLVM.so first. This ensures that when libLLVM.so is linking, there
# are no other compile jobs running. This will help reduce OOM errors on the
# builders without having to artificially limit the number of concurrent jobs.
%build_tool %cmake_target_opts LLVM
# Also build libclang-cpp.so separately to avoid OOM errors.
# This is to fix occasional OOM errors on the ppc64le COPR builders.
%build_tool %cmake_target_opts libclang-cpp.so
%build_tool
# If we don't build the runtimes target here, we'll have to wait for the %%check
# section until these files are available but they need to be installed.
#
# /usr/lib64/libomptarget.devicertl.a
# /usr/lib64/libomptarget-amdgpu-*.bc
# /usr/lib64/libomptarget-nvptx-*.bc
%if %{maj_ver} >= 18
%build_tool %cmake_target_opts runtimes
%else
# add fix for llvm17 runtimes build
#region libcxx build
cp %{SOURCE2} %{build_src_dir}
mkdir %{build_src_dir}/_build_libcxx
cd %{build_src_dir}/_build_libcxx
%cmake %{build_src_dir} -GNinja \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DLLVM_CMAKE_DIR=%{build_src_dir}/%{build_dir} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_DIR=%{build_src_dir}/%{build_dir}/%{_lib}/cmake/llvm/ \
-DCMAKE_MODULE_PATH="%{build_src_dir}/%{build_dir}/lib64/cmake/llvm;%{build_src_dir}/%{build_dir}/cmake/modules" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
%if 0%{?__isa_bits} == 64
-DLIBCXX_LIBDIR_SUFFIX:STRING=64 \
-DLIBCXXABI_LIBDIR_SUFFIX:STRING=64 \
-DLIBUNWIND_LIBDIR_SUFFIX:STRING=64 \
%endif
-DCMAKE_C_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang \
-DCMAKE_CXX_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang++ \
-DCMAKE_ASM_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang \
-DCMAKE_LINKER=%{build_src_dir}/%{build_dir}/bin/ld.lld \
-DCMAKE_AR=%{build_src_dir}/%{build_dir}/bin/llvm-ar \
-DCMAKE_RANLIB=%{build_src_dir}/%{build_dir}/bin/llvm-ranlib \
-DCMAKE_NM=%{build_src_dir}/%{build_dir}/bin/llvm-nm \
-DCMAKE_OBJDUMP=%{build_src_dir}/%{build_dir}/bin/llvm-objdump \
-DCMAKE_OBJCOPY=%{build_src_dir}/%{build_dir}/bin/llvm-objcopy \
-DCMAKE_STRIP=%{build_src_dir}/%{build_dir}/bin/llvm-strip \
-DCMAKE_READELF=%{build_src_dir}/%{build_dir}/bin/llvm-readelf \
-DLIBCXX_INCLUDE_BENCHMARKS=OFF \
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DLIBUNWIND_INCLUDE_DOCS=ON \
-DLIBUNWIND_INSTALL_INCLUDE_DIR=%{install_includedir}/llvm-libunwind \
-DLIBUNWIND_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \
-DCMAKE_SKIP_RPATH:BOOL=ON
%build_tool
#endregion libcxx build
#region libomp build
mkdir %{build_src_dir}/_build_openmp
cd %{build_src_dir}/_build_openmp
%cmake %{build_src_dir}/openmp -GNinja \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DLIBOMP_INSTALL_ALIASES=OFF \
-DLLVM_DIR=%{build_src_dir}/%{build_dir}/%{_lib}/cmake/llvm/ \
-DCMAKE_INSTALL_INCLUDEDIR=%{install_libdir}/clang/%{maj_ver}/include \
%if 0%{?__isa_bits} == 64
-DOPENMP_LIBDIR_SUFFIX=64 \
%else
-DOPENMP_LIBDIR_SUFFIX= \
%endif
-DCMAKE_C_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang \
-DCMAKE_CXX_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang++ \
-DCMAKE_ASM_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang \
-DCMAKE_LINKER=%{build_src_dir}/%{build_dir}/bin/ld.lld \
-DCMAKE_AR=%{build_src_dir}/%{build_dir}/bin/llvm-ar \
-DCMAKE_RANLIB=%{build_src_dir}/%{build_dir}/bin/llvm-ranlib \
-DCMAKE_NM=%{build_src_dir}/%{build_dir}/bin/llvm-nm \
-DCMAKE_OBJDUMP=%{build_src_dir}/%{build_dir}/bin/llvm-objdump \
-DCMAKE_OBJCOPY=%{build_src_dir}/%{build_dir}/bin/llvm-objcopy \
-DCMAKE_STRIP=%{build_src_dir}/%{build_dir}/bin/llvm-strip \
-DCMAKE_READELF=%{build_src_dir}/%{build_dir}/bin/llvm-readelf \
-DCMAKE_SKIP_RPATH:BOOL=ON
%build_tool
#endregion libomp build
#region compiler-rt build
mkdir %{build_src_dir}/_build_compiler-rt
cd %{build_src_dir}/_build_compiler-rt
%cmake %{build_src_dir}/compiler-rt \
-DLLVM_CMAKE_DIR=../_build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
%if 0%{?__isa_bits} == 64
-DLLVM_LIBDIR_SUFFIX=64 \
%else
-DLLVM_LIBDIR_SUFFIX= \
%endif
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF \
-DCOMPILER_RT_BUILD_BUILTINS=ON \
-DCOMPILER_RT_BUILD_SANITIZERS=ON \
-DCOMPILER_RT_BUILD_PROFILE=ON \
-DCOMPILER_RT_BUILD_XRAY=ON \
-DCOMPILER_RT_BUILD_ORC=ON \
-DCOMPILER_RT_BUILD_FUZZER=ON \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
-DCMAKE_C_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang \
-DCMAKE_CXX_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang++ \
-DCMAKE_ASM_COMPILER=%{build_src_dir}/%{build_dir}/bin/clang \
-DCMAKE_LINKER=%{build_src_dir}/%{build_dir}/bin/ld.lld \
-DCMAKE_AR=%{build_src_dir}/%{build_dir}/bin/llvm-ar \
-DCMAKE_RANLIB=%{build_src_dir}/%{build_dir}/bin/llvm-ranlib \
-DCMAKE_NM=%{build_src_dir}/%{build_dir}/bin/llvm-nm \
-DCMAKE_OBJDUMP=%{build_src_dir}/%{build_dir}/bin/llvm-objdump \
-DCMAKE_OBJCOPY=%{build_src_dir}/%{build_dir}/bin/llvm-objcopy \
-DCMAKE_STRIP=%{build_src_dir}/%{build_dir}/bin/llvm-strip \
-DCMAKE_READELF=%{build_src_dir}/%{build_dir}/bin/llvm-readelf \
-DCOMPILER_RT_INSTALL_PATH=%{install_libdir}/clang/%{maj_ver} \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on?
%if %{os_version} <= 2203
%make_build
%else
%build_tool
%endif
cd %{build_src_dir}
#endregion compiler-rt build
%endif
#endregion build
#region install
%install
#region LLVM installation
%if %{os_version} <= 2203
cd %{build_src_dir}/%{build_dir}
%else
cd %{build_src_dir}/llvm
%endif
%install_tool
%if %{maj_ver} <= 17
cd %{build_src_dir}/_build_libcxx
%install_tool
cd %{build_src_dir}/_build_openmp
%install_tool
cd %{build_src_dir}/_build_compiler-rt
%if %{os_version} > 2203
%install_tool
%else
%make_install
%endif
rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtbegin.o
rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtend.o
rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libclang_rt.builtins.a
%endif
cd %{build_src_dir}
mkdir -p %{buildroot}/%{_bindir}
# Install binaries needed for lit tests
%global test_binaries llvm-isel-fuzzer llvm-opt-fuzzer
for f in %{test_binaries}
do
install -m 0755 %{build_src_dir}/%{build_dir}/bin/$f %{buildroot}%{install_bindir}
chrpath --delete %{buildroot}%{install_bindir}/$f
done
# Install libraries needed for unittests
install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{install_libdir}
install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{install_libdir}
# Fix multi-lib
%multilib_fix_c_header --file %{install_includedir}/llvm/Config/llvm-config.h
%if %{with sys_llvm}
# Fix some man pages
ln -s llvm-config.1 %{buildroot}%{_mandir}/man1/llvm-config%{exec_suffix}-%{__isa_bits}.1
%if %{with gold}
# Add symlink to lto plugin in the binutils plugin directory.
%{__mkdir_p} %{buildroot}%{_libdir}/bfd-plugins/
ln -s -t %{buildroot}%{_libdir}/bfd-plugins/ ../LLVMgold.so
%endif
%else
# Create ld.so.conf.d entry
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf << EOF
%{install_libdir}
EOF
# Add version suffix to man pages and move them to mandir.
mkdir -p %{buildroot}/%{_mandir}/man1
for f in %{build_install_prefix}/share/man/man1/*; do
filename=`basename $f | cut -f 1 -d '.'`
mv $f %{buildroot}%{_mandir}/man1/$filename%{exec_suffix}.1
done
%endif
mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake
cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake
# Install a placeholder to redirect users of the formerly shipped
# HTML documentation to the upstream HTML documentation.
mkdir -pv %{buildroot}%{_pkgdocdir}/html
cat <<EOF > %{buildroot}%{_pkgdocdir}/html/index.html
<!doctype html>
<html lang=en>
<head>
<title>LLVM %{maj_ver}.%{min_ver} documentation</title>
</head>
<body>
<h1>
LLVM %{maj_ver}.%{min_ver} Documentation
</h1>
<ul>
<li>
<a href="https://releases.llvm.org/%{maj_ver}.%{min_ver}.0/docs/index.html">
Click here for the upstream documentation of LLVM %{maj_ver}.%{min_ver}.
</a>
</li>
<li>
<a href="https://llvm.org/docs/">
Click here for the latest upstream documentation of LLVM.
</a>
</li>
</ul>
</body>
</html>
EOF
#endregion LLVM installation
#region CLANG installation
# Add a symlink in /usr/bin to clang-format-diff
ln -s %{install_datadir}/clang/clang-format-diff.py %{buildroot}%{install_bindir}/clang-format-diff
# File in the macros file for other packages to use. We are not doing this
# in the compat package, because the version macros would # conflict with
# eachother if both clang and the clang compat package were installed together.
%if %{with sys_llvm}
# install clang python bindings
mkdir -p %{buildroot}%{python3_sitelib}/clang/
# If we don't default to true here, we'll see this error:
# install: omitting directory 'bindings/python/clang/__pycache__'
# NOTE: this only happens if we include the gdb plugin of libomp.
# Remove the plugin with command and we're good: rm -rf %{buildroot}/%{_datarootdir}/gdb
install -p -m644 clang/bindings/python/clang/* %{buildroot}%{python3_sitelib}/clang/
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/clang
# install scanbuild-py to python sitelib.
mv %{buildroot}%{install_libdir}/{libear,libscanbuild} %{buildroot}%{python3_sitelib}
# Cannot use {libear,libscanbuild} style expansion in py_byte_compile.
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libear
%py_byte_compile %{__python3} %{buildroot}%{python3_sitelib}/libscanbuild
# Move emacs integration files to the correct directory
mkdir -p %{buildroot}%{_emacs_sitestartdir}
for f in clang-format.el clang-include-fixer.el; do
mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/$f
done
%if %{maj_ver} < 20
mv %{buildroot}{%{_datadir}/clang,%{_emacs_sitestartdir}}/clang-rename.el
%endif
# Add clang++-{version} symlink
ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver}
%else
# Fix permission
chmod u-x %{buildroot}%{_mandir}/man1/scan-build%{exec_suffix}.1*
# Not sure where to put these python modules for the compat build.
rm -Rf %{buildroot}%{install_libdir}/{libear,libscanbuild}
%if %{maj_ver} >= 19
rm -Rf %{buildroot}%{install_prefix}/lib/{libear,libscanbuild}
%endif
# Not sure where to put the emacs integration files for the compat build.
rm -Rf %{buildroot}%{install_datadir}/clang/*.el
# Add clang++-{version} symlink
ln -s clang++ %{buildroot}%{install_bindir}/clang++-%{maj_ver}
%endif
# Create Manpage symlinks
ln -s clang%{exec_suffix}.1.gz %{buildroot}%{_mandir}/man1/clang++%{exec_suffix}.1.gz
%if %{with sys_llvm}
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang-%{maj_ver}.1.gz
ln -s clang.1.gz %{buildroot}%{_mandir}/man1/clang++-%{maj_ver}.1.gz
%endif
# Fix permissions of scan-view scripts
chmod a+x %{buildroot}%{install_datadir}/scan-view/{Reporter.py,startfile.py}
# multilib fix
%multilib_fix_c_header --file %{install_includedir}/clang/Config/config.h
# remove editor integrations (bbedit, sublime, emacs, vim)
rm -vf %{buildroot}%{install_datadir}/clang/clang-format-bbedit.applescript
rm -vf %{buildroot}%{install_datadir}/clang/clang-format-sublime.py*
# Remove unpackaged files
rm -Rvf %{buildroot}%{install_datadir}/clang-doc
rm -Rvf %{buildroot}%{install_datadir}/clang/clang-doc-default-stylesheet.css
rm -Rvf %{buildroot}%{install_datadir}/clang/index.js
# TODO: What are the Fedora guidelines for packaging bash autocomplete files?
rm -vf %{buildroot}%{install_datadir}/clang/bash-autocomplete.sh
# Create sub-directories in the clang resource directory that will be
# populated by other packages
mkdir -p %{buildroot}%{_libdir}/clang/%{maj_ver}/{bin,include,lib,share}/
#endregion CLANG installation
#region COMPILER-RT installation
# Triple where compiler-rt libs are installed. If it differs from llvm_triple, then there is
# also a symlink llvm_triple -> compiler_rt_triple.
%global compiler_rt_triple %{llvm_triple}
%ifarch ppc64le
# Fix install path on ppc64le so that the directory name matches the triple used
# by clang.
mv %{buildroot}%{_prefix}/%{lib}/clang/%{maj_ver}/lib/powerpc64le-redhat-linux-gnu %{buildroot}%{_prefix}/%{lib}/clang/%{maj_ver}/lib/%{llvm_triple}
%endif
%ifarch %{ix86}
# Fix install path on ix86 so that the directory name matches the triple used
# by clang on both actual ix86 (i686) and on x86_64 with -m32 (i386):
%global compiler_rt_triple i386-redhat-linux-gnu
%if "%{llvm_triple}" != "%{compiler_rt_triple}"
ln -s %{compiler_rt_triple} %{buildroot}%{_prefix}/%{lib}/clang/%{maj_ver}/lib/%{llvm_triple}
%endif
%endif
#endregion COMPILER-RT installation
#region OPENMP installation
# Remove static libraries with equivalent shared libraries
rm -rf %{buildroot}%{install_libdir}/libarcher_static.a
# Remove the openmp gdb plugin for now
rm -rf %{buildroot}/%{install_datadir}/gdb
# # TODO(kkleine): These was added to avoid a permission issue
# chmod go+w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so
# chmod +w %{buildroot}/%{_datarootdir}/gdb/python/ompd/ompdModule.so
%ifnarch %{ix86}
# Remove files that we don't package, yet.
%if %{os_version} > 2203
%if %{maj_ver} >= 20
rm %{buildroot}%{install_bindir}/llvm-offload-device-info
%else
rm %{buildroot}%{install_bindir}/llvm-omp-device-info
%endif
rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
%endif
%endif
#endregion OPENMP installation
#region LLD installation
%if %{with sys_llvm}
# Required when using update-alternatives:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Alternatives/
touch %{buildroot}%{_bindir}/ld
install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1
%endif
#endregion LLD installation
#region LLDB installation
%if %{with lldb}
%multilib_fix_c_header --file %{install_includedir}/lldb/Host/Config.h
# python: fix binary libraries location
liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so))
mkdir -p %{buildroot}%{python3_sitearch}
mv %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb %{buildroot}%{python3_sitearch}/lldb
ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so
%py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb
%endif
#endregion LLDB installation
#region mlir installation
%if %{with mlir}
mkdir -p %{buildroot}/%{python3_sitearch}
mv %{buildroot}%{install_prefix}/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch}
# These directories should be empty now.
rmdir %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages
# Unneeded files.
rm -rf %{buildroot}%{install_prefix}/src/python
%endif
#endregion mlir installation
#region libcxx installation
%if %{with libcxx}
# We can't install the unversionned path on default location because that would conflict with
# https://src.fedoraproject.org/rpms/libunwind
#
# The versionned path has a different soname (libunwind.so.1 compared to
# libunwind.so.8) so they can live together in %%{_libdir}
#
# ABI wise, even though llvm-libunwind's library is named libunwind, it doesn't
# have the exact same ABI as gcc's libunwind (it actually provides a subset).
rm %{buildroot}%{install_libdir}/libunwind.so
mkdir -p %{buildroot}/%{install_libdir}/llvm-unwind/
pushd %{buildroot}/%{install_libdir}/llvm-unwind
ln -s ../libunwind.so.1.0 libunwind.so
popd
%endif
#endregion libcxx installation
%if %{without sys_llvm}
# Add version suffix to binaries. Do this at the end so it includes any
# additional binaries that may be been added by other steps.
for f in %{buildroot}/%{install_bindir}/*; do
filename=`basename $f`
if echo $filename | grep -e '%{maj_ver}'; then
continue
fi
ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix}
done
%endif
# llvm-config special casing. llvm-config is managed by update-alternatives.
# the original file must remain available for compatibility with the CMake
# infrastructure. Without compat, cmake points to the symlink, with compat it
# points to the original file.
%if %{with sys_llvm}
mv %{buildroot}/%{install_bindir}/llvm-config %{buildroot}/%{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
# We still maintain a versionned symlink for consistency across llvm versions.
# This is specific to the non-compat build and matches the exec prefix for
# compat builds. An isa-agnostic versionned symlink is also maintained in the (un)install
# steps.
(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config%{exec_suffix}-%{__isa_bits} llvm-config-%{maj_ver}-%{__isa_bits} )
# ghost presence
touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver}
%else
rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config llvm-config%{exec_suffix}-%{__isa_bits} )
%endif
# ghost presence
touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
%if %{with bundle_compat_lib}
install -m 0755 ../llvm-compat-libs/lib/libLLVM.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
install -m 0755 ../llvm-compat-libs/lib/libclang.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
install -m 0755 ../llvm-compat-libs/lib/libclang-cpp.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
install -m 0755 ../llvm-compat-libs/lib/liblldb.so.%{compat_maj_ver}* %{buildroot}%{_libdir}
%endif
%if %{without sys_llvm}
cat <<EOF > %{buildroot}%{_scl_scripts}/enable
# General environment variables
export PATH=%{install_bindir}\${PATH:+:\${PATH}}
export MANPATH=%{install_datadir}:\${MANPATH}
export PCP_DIR=%{_scl_root}
# bz847911 workaround:
# we need to evaluate rpm's installed run-time % { _libdir }, not rpmbuild time
# or else /etc/ld.so.conf.d files?
rpmlibdir=\$(rpm --eval "%%{_libdir}")
# bz1017604: On 64-bit hosts, we should include also the 32-bit library path.
if [ "\$rpmlibdir" != "\${rpmlibdir/lib64/}" ]; then
rpmlibdir32=":%{_scl_root}\${rpmlibdir/lib64/lib}"
fi
export LD_LIBRARY_PATH=%{_scl_root}\$rpmlibdir\$rpmlibdir32\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
export LD_LIBRARY_PATH=%{_scl_root}\$rpmlibdir\$rpmlibdir32:%{_scl_root}\$rpmlibdir/dyninst\$rpmlibdir32/dyninst\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
EOF
chmod 755 %{buildroot}%{_scl_scripts}/enable
cat <<EOF > %{buildroot}%{install_bindir}/sudo
#! /bin/sh
# TODO: parse & pass-through sudo options from \$@
sudo_options="-E"
for arg in "\$@"
do
case "\$arg" in
*\'*)
arg=`echo "\$arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
cmd_options="\$cmd_options '\$arg'"
done
exec /usr/bin/sudo \$sudo_options LD_LIBRARY_PATH=\$LD_LIBRARY_PATH PATH=\$PATH scl enable %{scl} "\$cmd_options"
EOF
chmod 775 %{buildroot}%{install_bindir}/sudo
%endif
#endregion install
#region check
%check
# TODO(kkleine): Instead of deleting test files we should mark them as expected
# to fail. See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail
%ifarch ppc64le
# TODO: Re-enable when ld.gold fixed its internal error.
rm llvm/test/tools/gold/PowerPC/mtriple.ll
%endif
# non reproducible errors
# TODO(kkleine): Add this to XFAIL instead?
rm llvm/test/tools/dsymutil/X86/swift-interface.test
%if %{with check}
cd llvm
#region Helper functions
# Call this function before setting up a next component to test.
function reset_test_opts()
{
# Some libraries will not be found if we don't set this
export LD_LIBRARY_PATH="%{buildroot}/%{install_libdir}:%{buildroot}/%{_libdir}";
# See https://llvm.org/docs/CommandGuide/lit.html#general-options
export LIT_OPTS="-vv --time-tests"
# Set to mark tests as expected to fail.
# See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-xfail
unset LIT_XFAIL
# Set to mark tests to not even run.
# See https://llvm.org/docs/CommandGuide/lit.html#cmdoption-lit-filter-out
# Unfortunately LIT_FILTER_OUT is not accepting a list but a regular expression.
# To make this easily maintainable, we'll create an associate array in bash,
# to which you can append and later we'll join that array and escape dots (".")
# in your test paths. The following line resets this array.
# See also the function "test_list_to_regex".
test_list_filter_out=()
unset LIT_FILTER_OUT
# Set for filtering out unit tests.
# See http://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests
unset GTEST_FILTER
# Some test (e.g. mlir) require this to be set.
unset PYTHONPATH
}
# Convert array of test names into a regex.
# Call this function with an indexed array.
#
# Example:
#
# testlist=()
# testlist+=("foo")
# testlist+=("bar")
# export LIT_FILTER_OUT=$(test_list_to_regex testlist)
#
# Then $LIT_FILTER_OUT should evaluate to: (foo|bar)
function test_list_to_regex()
{
local -n arr=$1
# Prepare LIT_FILTER_OUT regex from index bash array
# Join each element with a pipe symbol (regex for "or")
arr=$(printf "|%s" "${arr[@]}")
# Remove the initial pipe symbol
arr=${arr:1}
# Properly escape path dots (".") for use in regular expression
arr=$(echo $arr | sed 's/\./\\./g')
# Add enclosing parenthesis
echo "($arr)"
}
# Similar to test_list_to_regex() except that this function exports
# the LIT_FILTER_OUT if there are tests in the given list.
# If there are no tests, the LIT_FILTER_OUT is unset in order to
# avoid issues with the llvm test system.
function adjust_lit_filter_out()
{
local -n arr=$1
local res=$(test_list_to_regex test_list_filter_out)
if [[ "$res" != "()" ]]; then
export LIT_FILTER_OUT=$res
else
unset LIT_FILTER_OUT
fi
}
#endregion Helper functions
#region Test LLVM lit
# It's fine to always run this, even if we're not shipping python-lit.
reset_test_opts
%cmake_build --target check-lit
#endregion Test LLVM lit
#region Test LLVM
reset_test_opts
# Xfail testing of update utility tools
export LIT_XFAIL="tools/UpdateTestChecks"
%cmake_build --target check-llvm
#endregion Test LLVM
#region Test CLANG
reset_test_opts
export LIT_XFAIL="$LIT_XFAIL;clang/test/CodeGen/profile-filter.c"
%cmake_build --target check-clang
#endregion Test Clang
#region Test Clang Tools
reset_test_opts
%ifarch %ix86
# Clang Tools :: clang-tidy/checkers/altera/struct-pack-align.cpp
export LIT_XFAIL="$LIT_XFAIL;clang-tidy/checkers/altera/struct-pack-align.cpp"
%endif
%cmake_build --target check-clang-tools
#endregion Test Clang Tools
#region Test OPENMP
reset_test_opts
# TODO(kkleine): OpenMP tests are currently not run on rawhide (see https://bugzilla.redhat.com/show_bug.cgi?id=2252966):
#
# + /usr/bin/cmake --build redhat-linux-build -j6 --verbose --target check-openmp
# Change Dir: '/builddir/build/BUILD/openmp-17.0.6.src/redhat-linux-build'
# Run Build Command(s): /usr/bin/ninja-build -v -j 6 check-openmp
# [1/1] cd /builddir/build/BUILD/openmp-17.0.6.src/redhat-linux-build && /usr/bin/cmake -E echo check-openmp\ does\ nothing,\ dependencies\ not\ found.
#
# We're marking the tests that are failing with the follwing error as expected to fail (XFAIL):
#
# gdb.error: No symbol "ompd_sizeof____kmp_gtid" in current context
#
# NOTE: It could be a different symbol in some tests.
export LIT_XFAIL="api_tests/test_ompd_get_curr_task_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_enclosing_parallel_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_generating_task_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_icv_from_scope.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_scheduling_task_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_state.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_task_frame.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_task_function.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_task_in_parallel.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_task_parallel_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_thread_id.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_thread_in_parallel.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_parallel_handle_compare.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_rel_parallel_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_rel_task_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_rel_thread_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_task_handle_compare.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_thread_handle_compare.c"
export LIT_XFAIL="$LIT_XFAIL;openmp_examples/ompd_icvs.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_curr_parallel_handle.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_display_control_vars.c"
export LIT_XFAIL="$LIT_XFAIL;api_tests/test_ompd_get_thread_handle.c"
# The following test is flaky and we'll filter it out
test_list_filter_out+=("libomp :: ompt/teams/distribute_dispatch.c")
test_list_filter_out+=("libomp :: affinity/kmp-abs-hw-subset.c")
test_list_filter_out+=("libomp :: parallel/bug63197.c")
test_list_filter_out+=("libomp :: tasking/issue-69733.c")
test_list_filter_out+=("libarcher :: races/task-taskgroup-unrelated.c")
# These tests fail more often than not, but not always.
test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_GELTGT_int.c")
test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_GTGEGT_int.c")
test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_many_LTLEGE_int.c")
test_list_filter_out+=("libomp :: worksharing/for/omp_collapse_one_int.c")
%ifarch s390x
test_list_filter_out+=("libomp :: flush/omp_flush.c")
test_list_filter_out+=("libomp :: worksharing/for/omp_for_schedule_guided.c")
%endif
%ifarch aarch64 s390x
# The following test has been failing intermittently on aarch64 and s390x.
# Re-enable it after https://github.com/llvm/llvm-project/issues/117773
# gets fixed.
test_list_filter_out+=("libarcher :: races/taskwait-depend.c")
%endif
# The following tests seem pass on ppc64le and x86_64 and aarch64 only:
%ifnarch ppc64le x86_64 s390x aarch64
# Passes on ppc64le:
# libomptarget :: powerpc64le-ibm-linux-gnu :: mapping/target_derefence_array_pointrs.cpp
# libomptarget :: powerpc64le-ibm-linux-gnu-LTO :: mapping/target_derefence_array_pointrs.cpp
# Passes on x86_64:
# libomptarget :: x86_64-pc-linux-gnu :: mapping/target_derefence_array_pointrs.cpp
# libomptarget :: x86_64-pc-linux-gnu-LTO :: mapping/target_derefence_array_pointrs.cpp
# Passes on s390x:
# libomptarget :: s390x-ibm-linux-gnu :: mapping/target_derefence_array_pointrs.cpp
# libomptarget :: s390x-ibm-linux-gnu-LTO :: mapping/target_derefence_array_pointrs.cpp
export LIT_XFAIL="$LIT_XFAIL;mapping/target_derefence_array_pointrs.cpp"
%endif
%ifnarch x86_64
# Passes on x86_64:
# libomptarget :: x86_64-pc-linux-gnu :: api/ompx_3d.c
# libomptarget :: x86_64-pc-linux-gnu :: api/ompx_3d.cpp
# libomptarget :: x86_64-pc-linux-gnu-LTO :: api/ompx_3d.c
# libomptarget :: x86_64-pc-linux-gnu-LTO :: api/ompx_3d.cpp
# libomptarget :: aarch64-unknown-linux-gnu ::
export LIT_XFAIL="$LIT_XFAIL;api/ompx_3d.c"
export LIT_XFAIL="$LIT_XFAIL;api/ompx_3d.cpp"
%endif
%ifarch ppc64le
export LIT_XFAIL="$LIT_XFAIL;barrier/barrier.c"
export LIT_XFAIL="$LIT_XFAIL;critical/critical.c"
export LIT_XFAIL="$LIT_XFAIL;critical/lock-nested.c"
export LIT_XFAIL="$LIT_XFAIL;critical/lock.c"
export LIT_XFAIL="$LIT_XFAIL;parallel/parallel-firstprivate.c"
export LIT_XFAIL="$LIT_XFAIL;parallel/parallel-nosuppression.c"
export LIT_XFAIL="$LIT_XFAIL;parallel/parallel-simple.c"
export LIT_XFAIL="$LIT_XFAIL;parallel/parallel-simple2.c"
export LIT_XFAIL="$LIT_XFAIL;races/critical-unrelated.c"
export LIT_XFAIL="$LIT_XFAIL;races/lock-nested-unrelated.c"
export LIT_XFAIL="$LIT_XFAIL;races/lock-unrelated.c"
export LIT_XFAIL="$LIT_XFAIL;races/parallel-simple.c"
export LIT_XFAIL="$LIT_XFAIL;races/task-dependency.c"
export LIT_XFAIL="$LIT_XFAIL;races/task-taskgroup-unrelated.c"
export LIT_XFAIL="$LIT_XFAIL;races/task-taskwait-nested.c"
export LIT_XFAIL="$LIT_XFAIL;races/task-two.c"
export LIT_XFAIL="$LIT_XFAIL;races/taskwait-depend.c"
export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction-nowait.c"
export LIT_XFAIL="$LIT_XFAIL;reduction/parallel-reduction.c"
export LIT_XFAIL="$LIT_XFAIL;task/omp_task_depend_all.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-barrier.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-create.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-dependency.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-taskgroup-nested.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-taskgroup.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-taskwait-nested.c"
export LIT_XFAIL="$LIT_XFAIL;task/task-taskwait.c"
export LIT_XFAIL="$LIT_XFAIL;task/task_early_fulfill.c"
export LIT_XFAIL="$LIT_XFAIL;task/task_late_fulfill.c"
export LIT_XFAIL="$LIT_XFAIL;task/taskwait-depend.c"
export LIT_XFAIL="$LIT_XFAIL;worksharing/ordered.c"
export LIT_XFAIL="$LIT_XFAIL;api/omp_dynamic_shared_memory.c"
export LIT_XFAIL="$LIT_XFAIL;jit/empty_kernel_lvl1.c"
export LIT_XFAIL="$LIT_XFAIL;jit/empty_kernel_lvl2.c"
export LIT_XFAIL="$LIT_XFAIL;jit/type_punning.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/barrier_fence.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/bug49334.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/default_thread_limit.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/ompx_bare.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/ompx_coords.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/ompx_saxpy_mixed.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/small_trip_count.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/small_trip_count_thread_limit.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/spmdization.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/target_critical_region.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/thread_limit.c"
export LIT_XFAIL="$LIT_XFAIL;api/omp_dynamic_shared_memory.c"
export LIT_XFAIL="$LIT_XFAIL;jit/empty_kernel_lvl1.c"
export LIT_XFAIL="$LIT_XFAIL;jit/empty_kernel_lvl2.c"
export LIT_XFAIL="$LIT_XFAIL;jit/type_punning.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/barrier_fence.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/bug49334.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/default_thread_limit.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/ompx_bare.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/ompx_coords.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/ompx_saxpy_mixed.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/small_trip_count.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/small_trip_count_thread_limit.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/spmdization.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/target_critical_region.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/thread_limit.c"
export LIT_XFAIL="$LIT_XFAIL;mapping/auto_zero_copy.cpp"
export LIT_XFAIL="$LIT_XFAIL;mapping/auto_zero_copy_globals.cpp"
export LIT_XFAIL="$LIT_XFAIL;offloading/workshare_chunk.c"
export LIT_XFAIL="$LIT_XFAIL;ompt/target_memcpy.c"
export LIT_XFAIL="$LIT_XFAIL;ompt/target_memcpy_emi.c"
%endif
%ifarch s390x ppc64le
export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_1.c"
export LIT_XFAIL="$LIT_XFAIL;offloading/thread_state_2.c"
%endif
adjust_lit_filter_out test_list_filter_out
%if 0%{?rhel}
# libomp tests are often very slow on s390x brew builders
%ifnarch s390x
%cmake_build --target check-openmp
%endif
%else
%cmake_build --target check-openmp
%endif
#endregion Test OPENMP
%if %{with lldb}
# Don't run LLDB tests on s390x because more than 150 tests are failing there
%ifnarch s390x
## TODO(kkleine): Come back and re-enable testing for LLDB
## #region LLDB unit tests
## reset_test_opts
## %%cmake_build --target check-lldb-unit
## #endregion LLDB unit tests
##
## #region LLDB SB API tests
## reset_test_opts
## %%cmake_build --target check-lldb-api
## #endregion LLDB SB API tests
##
## #region LLDB shell tests
## reset_test_opts
## %%cmake_build --target check-lldb-shell
## #endregion LLDB shell tests
%endif
%endif
#region test libcxx
# TODO(kkleine): Fedora rawhide didn't contain check runs. Evaluate if we want them here.
#endregion test libcxx
#region Test LLD
reset_test_opts
%cmake_build --target check-lld
#endregion Test LLD
#region Test MLIR
%if %{with mlir}
reset_test_opts
# The ml_dtypes python module required by mlir/test/python/execution_engine.py
# isn't packaged.
test_list_filter_out+=("MLIR :: python/execution_engine.py")
%ifarch s390x
# s390x does not support half-float
test_list_filter_out+=("MLIR :: python/ir/array_attributes.py")
%endif
adjust_lit_filter_out test_list_filter_out
export PYTHONPATH=%{buildroot}/%{python3_sitearch}
%cmake_build --target check-mlir
%endif
#endregion Test MLIR
%endif
#endregion check
#region misc
%ldconfig_scriptlets -n %{pkg_name-llvm}-libs
%if %{with sys_llvm}
%ldconfig_scriptlets -n %{pkg_name_lld}-libs
%endif
%post -n %{pkg_name_llvm}-devel
%{_sbindir}/update-alternatives --install %{_bindir}/llvm-config%{exec_suffix} llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits}
%if %{with sys_llvm}
%{_sbindir}/update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits}
# During the upgrade from LLVM 16 (F38) to LLVM 17 (F39), we found out the
# main llvm-devel package was leaving entries in the alternatives system.
# Try to remove them now.
for v in 14 15 16; do
if [[ -e %{_bindir}/llvm-config-$v
&& "x$(%{_bindir}/llvm-config-$v --version | awk -F . '{ print $1 }')" != "x$v" ]]; then
%{_sbindir}/update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
fi
done
%endif
%postun -n %{pkg_name_llvm}-devel
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
fi
%if %{with sys_llvm}
# When upgrading between minor versions (i.e. from x.y.1 to x.y.2), we must
# not remove the alternative.
# However, during a major version upgrade (i.e. from 16.x.y to 17.z.w), the
# alternative must be removed in order to give priority to a newly installed
# compat package.
if [[ $1 -eq 0
|| "x$(%{_bindir}/llvm-config%{exec_suffix} --version | awk -F . '{ print $1 }')" != "x%{maj_ver}" ]]; then
%{_sbindir}/update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
fi
%endif
%if %{with sys_llvm}
%post -n %{pkg_name_lld}
%{_sbindir}/update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1
%postun -n %{pkg_name_lld}
if [ $1 -eq 0 ] ; then
%{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld
fi
%endif
#endregion misc
#region files
#region LLVM lit files
%if %{with python_lit}
%files -n python%{python3_pkgversion}-lit
%license llvm/utils/lit/LICENSE.TXT
%doc llvm/utils/lit/README.rst
%{python3_sitelib}/lit/
%{python3_sitelib}/lit-*-info/
%{_bindir}/lit
%endif
#endregion LLVM lit files
#region LLVM files
%files -n %{pkg_name_llvm}
%license llvm/LICENSE.TXT
%{_scl_scripts}/enable
%{install_bindir}/sudo
%exclude %{_mandir}/man1/llvm-config*
%{_mandir}/man1/bugpoint%{exec_suffix}.1.gz
%{_mandir}/man1/clang-tblgen%{exec_suffix}.1.gz
%{_mandir}/man1/dsymutil%{exec_suffix}.1.gz
%{_mandir}/man1/FileCheck%{exec_suffix}.1.gz
%{_mandir}/man1/lit%{exec_suffix}.1.gz
%{_mandir}/man1/llc%{exec_suffix}.1.gz
%{_mandir}/man1/lldb-tblgen%{exec_suffix}.1.gz
%{_mandir}/man1/lli%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-addr2line%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-ar%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-as%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-bcanalyzer%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-cov%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-cxxfilt%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-cxxmap%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-debuginfo-analyzer%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-diff%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-dis%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-dwarfdump%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-dwarfutil%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-exegesis%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-extract%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-ifs%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-install-name-tool%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-lib%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-libtool-darwin%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-link%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-lipo%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-locstats%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-mc%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-mca%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-nm%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-objcopy%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-objdump%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-opt-report%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-otool%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-pdbutil%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-profdata%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-profgen%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-ranlib%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-readelf%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-readobj%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-reduce%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-remarkutil%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-size%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-stress%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-strings%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-strip%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-symbolizer%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-tblgen%{exec_suffix}.1.gz
%{_mandir}/man1/llvm-tli-checker%{exec_suffix}.1.gz
%{_mandir}/man1/mlir-tblgen%{exec_suffix}.1.gz
%{_mandir}/man1/opt%{exec_suffix}.1.gz
%{_mandir}/man1/tblgen%{exec_suffix}.1.gz
%if %{maj_ver} >= 20
%{_mandir}/man1/llvm-cgdata%{exec_suffix}.1.gz
%endif
%if %{maj_ver} <= 17
%{_mandir}/man1/llvm-remark-size-diff%{exec_suffix}.1.gz
%endif
%{install_bindir}/bugpoint
%{install_bindir}/dsymutil
%{install_bindir}/FileCheck
%{install_bindir}/llc
%{install_bindir}/lli
%{install_bindir}/llvm-addr2line
%{install_bindir}/llvm-ar
%{install_bindir}/llvm-as
%{install_bindir}/llvm-bcanalyzer
%{install_bindir}/llvm-bitcode-strip
%{install_bindir}/llvm-c-test
%{install_bindir}/llvm-cat
%{install_bindir}/llvm-cfi-verify
%{install_bindir}/llvm-cov
%{install_bindir}/llvm-cvtres
%{install_bindir}/llvm-cxxdump
%{install_bindir}/llvm-cxxfilt
%{install_bindir}/llvm-cxxmap
%{install_bindir}/llvm-debuginfo-analyzer
%{install_bindir}/llvm-debuginfod
%{install_bindir}/llvm-debuginfod-find
%{install_bindir}/llvm-diff
%{install_bindir}/llvm-dis
%{install_bindir}/llvm-dlltool
%{install_bindir}/llvm-dwarfdump
%{install_bindir}/llvm-dwarfutil
%{install_bindir}/llvm-dwp
%{install_bindir}/llvm-exegesis
%{install_bindir}/llvm-extract
%{install_bindir}/llvm-gsymutil
%{install_bindir}/llvm-ifs
%{install_bindir}/llvm-install-name-tool
%{install_bindir}/llvm-jitlink
%{install_bindir}/llvm-jitlink-executor
%{install_bindir}/llvm-lib
%{install_bindir}/llvm-libtool-darwin
%{install_bindir}/llvm-link
%{install_bindir}/llvm-lipo
%{install_bindir}/llvm-lto
%{install_bindir}/llvm-lto2
%{install_bindir}/llvm-mc
%{install_bindir}/llvm-mca
%{install_bindir}/llvm-ml
%{install_bindir}/llvm-modextract
%{install_bindir}/llvm-mt
%{install_bindir}/llvm-nm
%{install_bindir}/llvm-objcopy
%{install_bindir}/llvm-objdump
%{install_bindir}/llvm-opt-report
%{install_bindir}/llvm-otool
%{install_bindir}/llvm-pdbutil
%{install_bindir}/llvm-PerfectShuffle
%{install_bindir}/llvm-profdata
%{install_bindir}/llvm-profgen
%{install_bindir}/llvm-ranlib
%{install_bindir}/llvm-rc
%{install_bindir}/llvm-readelf
%{install_bindir}/llvm-readobj
%if %{maj_ver} >=18
%{install_bindir}/llvm-readtapi
%endif
%{install_bindir}/llvm-reduce
%{install_bindir}/llvm-remarkutil
%{install_bindir}/llvm-rtdyld
%{install_bindir}/llvm-sim
%{install_bindir}/llvm-size
%{install_bindir}/llvm-split
%{install_bindir}/llvm-stress
%{install_bindir}/llvm-strings
%{install_bindir}/llvm-strip
%{install_bindir}/llvm-symbolizer
%{install_bindir}/llvm-tblgen
%{install_bindir}/llvm-tli-checker
%{install_bindir}/llvm-undname
%{install_bindir}/llvm-windres
%{install_bindir}/llvm-xray
%{install_bindir}/obj2yaml
%{install_bindir}/opt
%{install_bindir}/sancov
%{install_bindir}/sanstats
%{install_bindir}/split-file
%{install_bindir}/UnicodeNameMappingGenerator
%{install_bindir}/verify-uselistorder
%{install_bindir}/yaml2obj
%if %{maj_ver} >= 20
%{install_bindir}/llvm-cgdata
%{install_bindir}/llvm-ctxprof-util
%endif
%if %{maj_ver} >= 19
%{install_bindir}/reduce-chunk-list
%endif
%if %{maj_ver} <= 17
%{install_bindir}/llvm-remark-size-diff
%{install_bindir}/llvm-tapi-diff
%endif
%if %{without sys_llvm}
# This is for all the binaries with the version suffix.
%{_bindir}/bugpoint%{exec_suffix}
%{_bindir}/dsymutil%{exec_suffix}
%{_bindir}/FileCheck%{exec_suffix}
%{_bindir}/llc%{exec_suffix}
%{_bindir}/lli%{exec_suffix}
%{_bindir}/llvm-addr2line%{exec_suffix}
%{_bindir}/llvm-ar%{exec_suffix}
%{_bindir}/llvm-as%{exec_suffix}
%{_bindir}/llvm-bcanalyzer%{exec_suffix}
%{_bindir}/llvm-bitcode-strip%{exec_suffix}
%{_bindir}/llvm-c-test%{exec_suffix}
%{_bindir}/llvm-cat%{exec_suffix}
%{_bindir}/llvm-cfi-verify%{exec_suffix}
%{_bindir}/llvm-cov%{exec_suffix}
%{_bindir}/llvm-cvtres%{exec_suffix}
%{_bindir}/llvm-cxxdump%{exec_suffix}
%{_bindir}/llvm-cxxfilt%{exec_suffix}
%{_bindir}/llvm-cxxmap%{exec_suffix}
%{_bindir}/llvm-debuginfo-analyzer%{exec_suffix}
%{_bindir}/llvm-debuginfod%{exec_suffix}
%{_bindir}/llvm-debuginfod-find%{exec_suffix}
%{_bindir}/llvm-diff%{exec_suffix}
%{_bindir}/llvm-dis%{exec_suffix}
%{_bindir}/llvm-dlltool%{exec_suffix}
%{_bindir}/llvm-dwarfdump%{exec_suffix}
%{_bindir}/llvm-dwarfutil%{exec_suffix}
%{_bindir}/llvm-dwp%{exec_suffix}
%{_bindir}/llvm-exegesis%{exec_suffix}
%{_bindir}/llvm-extract%{exec_suffix}
%{_bindir}/llvm-gsymutil%{exec_suffix}
%{_bindir}/llvm-ifs%{exec_suffix}
%{_bindir}/llvm-install-name-tool%{exec_suffix}
%{_bindir}/llvm-jitlink%{exec_suffix}
%{_bindir}/llvm-jitlink-executor%{exec_suffix}
%{_bindir}/llvm-lib%{exec_suffix}
%{_bindir}/llvm-libtool-darwin%{exec_suffix}
%{_bindir}/llvm-link%{exec_suffix}
%{_bindir}/llvm-lipo%{exec_suffix}
%{_bindir}/llvm-lto%{exec_suffix}
%{_bindir}/llvm-lto2%{exec_suffix}
%{_bindir}/llvm-mc%{exec_suffix}
%{_bindir}/llvm-mca%{exec_suffix}
%{_bindir}/llvm-ml%{exec_suffix}
%{_bindir}/llvm-modextract%{exec_suffix}
%{_bindir}/llvm-mt%{exec_suffix}
%{_bindir}/llvm-nm%{exec_suffix}
%{_bindir}/llvm-objcopy%{exec_suffix}
%{_bindir}/llvm-objdump%{exec_suffix}
%{_bindir}/llvm-opt-report%{exec_suffix}
%{_bindir}/llvm-otool%{exec_suffix}
%{_bindir}/llvm-pdbutil%{exec_suffix}
%{_bindir}/llvm-PerfectShuffle%{exec_suffix}
%{_bindir}/llvm-profdata%{exec_suffix}
%{_bindir}/llvm-profgen%{exec_suffix}
%{_bindir}/llvm-ranlib%{exec_suffix}
%{_bindir}/llvm-rc%{exec_suffix}
%{_bindir}/llvm-readelf%{exec_suffix}
%{_bindir}/llvm-readobj%{exec_suffix}
%if %{maj_ver} >=18
%{_bindir}/llvm-readtapi%{exec_suffix}
%endif
%{_bindir}/llvm-reduce%{exec_suffix}
%{_bindir}/llvm-remarkutil%{exec_suffix}
%{_bindir}/llvm-rtdyld%{exec_suffix}
%{_bindir}/llvm-sim%{exec_suffix}
%{_bindir}/llvm-size%{exec_suffix}
%{_bindir}/llvm-split%{exec_suffix}
%{_bindir}/llvm-stress%{exec_suffix}
%{_bindir}/llvm-strings%{exec_suffix}
%{_bindir}/llvm-strip%{exec_suffix}
%{_bindir}/llvm-symbolizer%{exec_suffix}
%{_bindir}/llvm-tblgen%{exec_suffix}
%{_bindir}/llvm-tli-checker%{exec_suffix}
%{_bindir}/llvm-undname%{exec_suffix}
%{_bindir}/llvm-windres%{exec_suffix}
%{_bindir}/llvm-xray%{exec_suffix}
%{_bindir}/obj2yaml%{exec_suffix}
%{_bindir}/opt%{exec_suffix}
%{_bindir}/sancov%{exec_suffix}
%{_bindir}/sanstats%{exec_suffix}
%{_bindir}/split-file%{exec_suffix}
%{_bindir}/UnicodeNameMappingGenerator%{exec_suffix}
%{_bindir}/verify-uselistorder%{exec_suffix}
%{_bindir}/yaml2obj%{exec_suffix}
%if %{maj_ver} >= 20
%{_bindir}/llvm-cgdata%{exec_suffix}
%{_bindir}/llvm-ctxprof-util%{exec_suffix}
%endif
%if %{maj_ver} >= 19
%{_bindir}/reduce-chunk-list%{exec_suffix}
%endif
%if %{maj_ver} <= 17
%{_bindir}/llvm-remark-size-diff%{exec_suffix}
%{_bindir}/llvm-tapi-diff%{exec_suffix}
%endif
%endif
%exclude %{_bindir}/llvm-config%{exec_suffix}
%exclude %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
%exclude %{_bindir}/llvm-config-%{maj_ver}
%exclude %{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits}
%exclude %{install_bindir}/not
%exclude %{install_bindir}/count
%exclude %{install_bindir}/yaml-bench
%exclude %{install_bindir}/lli-child-target
%exclude %{install_bindir}/llvm-isel-fuzzer
%exclude %{install_bindir}/llvm-opt-fuzzer
%{pkg_datadir}/opt-viewer
%files -n %{pkg_name_llvm}-libs
%license llvm/LICENSE.TXT
%{install_libdir}/libLLVM-%{maj_ver}%{?llvm_snapshot_version_suffix}.so
%if %{with gold}
%{install_libdir}/LLVMgold.so
%if %{with sys_llvm}
%{_libdir}/bfd-plugins/LLVMgold.so
%endif
%else
%if %{maj_ver} <= 19
%{install_libdir}/LLVMgold.so
%endif
%endif
%if %{maj_ver} >= 18
%{install_libdir}/libLLVM.so.%{maj_ver}.%{min_ver}%{?llvm_snapshot_version_suffix}
%else
%{install_libdir}/libLLVM-%{maj_ver}.%{min_ver}*.so
%endif
%{install_libdir}/libLTO.so*
%{install_libdir}/libRemarks.so*
%if %{without sys_llvm}
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf
%endif
%files -n %{pkg_name_llvm}-devel
%license llvm/LICENSE.TXT
%if %{with sys_llvm}
%ghost %{_bindir}/llvm-config
%{install_bindir}/llvm-config-%{__isa_bits}
%else
%{install_bindir}/llvm-config
%endif
%ghost %{_bindir}/llvm-config-%{maj_ver}
%{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits}
%{_mandir}/man1/llvm-config*
%{install_includedir}/llvm
%{install_includedir}/llvm-c
%{install_libdir}/libLLVM.so
%{install_libdir}/cmake/llvm
%files -n %{pkg_name_llvm}-doc
%license llvm/LICENSE.TXT
%doc %{_pkgdocdir}/html/index.html
%files -n %{pkg_name_llvm}-static
%license llvm/LICENSE.TXT
%{install_libdir}/libLLVM*.a
%exclude %{install_libdir}/libLLVMTestingSupport.a
%exclude %{install_libdir}/libLLVMTestingAnnotations.a
%files -n %{pkg_name_llvm}-cmake-utils
%license llvm/LICENSE.TXT
%{pkg_datadir}/llvm/cmake
%files -n %{pkg_name_llvm}-test
%license llvm/LICENSE.TXT
%{install_bindir}/not
%{install_bindir}/count
%{install_bindir}/yaml-bench
%{install_bindir}/lli-child-target
%{install_bindir}/llvm-isel-fuzzer
%{install_bindir}/llvm-opt-fuzzer
%if %{without sys_llvm}
%{_bindir}/not%{exec_suffix}
%{_bindir}/count%{exec_suffix}
%{_bindir}/yaml-bench%{exec_suffix}
%{_bindir}/lli-child-target%{exec_suffix}
%{_bindir}/llvm-isel-fuzzer%{exec_suffix}
%{_bindir}/llvm-opt-fuzzer%{exec_suffix}
%endif
%files -n %{pkg_name_llvm}-googletest
%license llvm/LICENSE.TXT
%{install_libdir}/libLLVMTestingSupport.a
%{install_libdir}/libLLVMTestingAnnotations.a
%{install_libdir}/libllvm_gtest.a
%{install_libdir}/libllvm_gtest_main.a
%{install_includedir}/llvm-gtest
%{install_includedir}/llvm-gmock
%if %{with snapshot_build}
%files -n %{pkg_name_llvm}-build-stats
%{pkg_datadir}/.ninja_log
%endif
#endregion LLVM files
#region CLANG files
%files -n %{pkg_name_clang}
%license clang/LICENSE.TXT
%{install_bindir}/clang
%{install_bindir}/clang++
%{install_bindir}/clang-%{maj_ver}
%{install_bindir}/clang++-%{maj_ver}
%{install_bindir}/clang-cl
%{install_bindir}/clang-cpp
%{_mandir}/man1/clang-%{maj_ver}.1.gz
%{_mandir}/man1/clang++-%{maj_ver}.1.gz
%if %{with sys_llvm}
%{_mandir}/man1/clang.1.gz
%{_mandir}/man1/clang++.1.gz
%else
%{_bindir}/clang-%{maj_ver}
%{_bindir}/clang++-%{maj_ver}
%{_bindir}/clang-cl-%{maj_ver}
%{_bindir}/clang-cpp-%{maj_ver}
%endif
%files -n %{pkg_name_clang}-libs
%license clang/LICENSE.TXT
%{install_libdir}/clang/%{maj_ver}/include/*
%{install_libdir}/libclang.so.%{maj_ver}*
%{install_libdir}/libclang-cpp.so.%{maj_ver}*
%files -n %{pkg_name_clang}-devel
%license clang/LICENSE.TXT
%{install_libdir}/libclang-cpp.so
%{install_libdir}/libclang.so
%{install_includedir}/clang/
%{install_includedir}/clang-c/
%{install_libdir}/cmake/clang
%{install_bindir}/clang-tblgen
%if %{without sys_llvm}
%{_bindir}/clang-tblgen-%{maj_ver}
%endif
%dir %{install_datadir}/clang/
%files -n %{pkg_name_clang}-resource-filesystem
%license clang/LICENSE.TXT
%dir %{_libdir}/clang/
%dir %{_libdir}/clang/%{maj_ver}/
%dir %{_libdir}/clang/%{maj_ver}/bin/
%dir %{_libdir}/clang/%{maj_ver}/include/
%dir %{_libdir}/clang/%{maj_ver}/lib/
%dir %{_libdir}/clang/%{maj_ver}/share/
%files -n %{pkg_name_clang}-analyzer
%license clang/LICENSE.TXT
%{install_bindir}/scan-view
%{install_bindir}/scan-build
%{install_bindir}/analyze-build
%{install_bindir}/intercept-build
%{install_bindir}/scan-build-py
%if %{without sys_llvm}
%{_bindir}/scan-view-%{maj_ver}
%{_bindir}/scan-build-%{maj_ver}
%{_bindir}/analyze-build-%{maj_ver}
%{_bindir}/intercept-build-%{maj_ver}
%{_bindir}/scan-build-py-%{maj_ver}
%endif
%{install_libexecdir}/ccc-analyzer
%{install_libexecdir}/c++-analyzer
%{install_libexecdir}/analyze-c++
%{install_libexecdir}/analyze-cc
%{install_libexecdir}/intercept-c++
%{install_libexecdir}/intercept-cc
%{install_datadir}/scan-view/
%{install_datadir}/scan-build/
%{_mandir}/man1/scan-build%{exec_suffix}.1.*
%if %{with sys_llvm}
%{python3_sitelib}/libear
%{python3_sitelib}/libscanbuild
%endif
%files -n %{pkg_name_clang}-tools-extra
%license clang-tools-extra/LICENSE.TXT
%{install_bindir}/amdgpu-arch
%{install_bindir}/clang-apply-replacements
%{install_bindir}/clang-change-namespace
%{install_bindir}/clang-check
%{install_bindir}/clang-doc
%{install_bindir}/clang-extdef-mapping
%{install_bindir}/clang-format
%{install_bindir}/clang-include-cleaner
%{install_bindir}/clang-include-fixer
%{install_bindir}/clang-move
%{install_bindir}/clang-offload-bundler
%{install_bindir}/clang-offload-packager
%{install_bindir}/clang-linker-wrapper
%{install_bindir}/clang-query
%{install_bindir}/clang-refactor
%{install_bindir}/clang-reorder-fields
%{install_bindir}/clang-repl
%{install_bindir}/clang-scan-deps
%if %{maj_ver} >= 19
%{install_bindir}/clang-installapi
%{install_bindir}/clang-nvlink-wrapper
%endif
%if %{maj_ver} >= 20
%{install_bindir}/clang-sycl-linker
%endif
%{install_bindir}/clang-tidy
%{install_bindir}/clangd
%{install_bindir}/diagtool
%{install_bindir}/hmaptool
%{install_bindir}/nvptx-arch
%{install_bindir}/pp-trace
%{install_bindir}/c-index-test
%{install_bindir}/find-all-symbols
%{install_bindir}/modularize
%{install_bindir}/clang-format-diff
%{install_bindir}/run-clang-tidy
%if %{maj_ver} < 20
%{install_bindir}/clang-pseudo
%{install_bindir}/clang-rename
%endif
%if %{without sys_llvm}
%{_bindir}/amdgpu-arch-%{maj_ver}
%{_bindir}/clang-apply-replacements-%{maj_ver}
%{_bindir}/clang-change-namespace-%{maj_ver}
%{_bindir}/clang-check-%{maj_ver}
%{_bindir}/clang-doc-%{maj_ver}
%{_bindir}/clang-extdef-mapping-%{maj_ver}
%{_bindir}/clang-format-%{maj_ver}
%{_bindir}/clang-include-cleaner-%{maj_ver}
%{_bindir}/clang-include-fixer-%{maj_ver}
%{_bindir}/clang-move-%{maj_ver}
%{_bindir}/clang-offload-bundler-%{maj_ver}
%{_bindir}/clang-offload-packager-%{maj_ver}
%{_bindir}/clang-linker-wrapper-%{maj_ver}
%{_bindir}/clang-query-%{maj_ver}
%{_bindir}/clang-refactor-%{maj_ver}
%{_bindir}/clang-reorder-fields-%{maj_ver}
%{_bindir}/clang-repl-%{maj_ver}
%{_bindir}/clang-scan-deps-%{maj_ver}
%if %{maj_ver} >= 19
%{_bindir}/clang-installapi-%{maj_ver}
%{_bindir}/clang-nvlink-wrapper-%{maj_ver}
%endif
%if %{maj_ver} >= 20
%{_bindir}/clang-sycl-linker-%{maj_ver}
%endif
%{_bindir}/clang-tidy-%{maj_ver}
%{_bindir}/clangd-%{maj_ver}
%{_bindir}/diagtool-%{maj_ver}
%{_bindir}/hmaptool-%{maj_ver}
%{_bindir}/nvptx-arch-%{maj_ver}
%{_bindir}/pp-trace-%{maj_ver}
%{_bindir}/c-index-test-%{maj_ver}
%{_bindir}/find-all-symbols-%{maj_ver}
%{_bindir}/modularize-%{maj_ver}
%{_bindir}/clang-format-diff-%{maj_ver}
%{_bindir}/run-clang-tidy-%{maj_ver}
%if %{maj_ver} < 20
%{_bindir}/clang-pseudo-%{maj_ver}
%{_bindir}/clang-rename-%{maj_ver}
%endif
%else
%{_emacs_sitestartdir}/clang-format.el
%if %{maj_ver} < 20
%{_emacs_sitestartdir}/clang-rename.el
%endif
%{_emacs_sitestartdir}/clang-include-fixer.el
%endif
%{_mandir}/man1/diagtool%{exec_suffix}.1.gz
%{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz
%{install_datadir}/clang/clang-format.py*
%{install_datadir}/clang/clang-format-diff.py*
%{install_datadir}/clang/clang-include-fixer.py*
%{install_datadir}/clang/clang-tidy-diff.py*
%{install_datadir}/clang/run-find-all-symbols.py*
%if %{maj_ver} < 20
%{install_datadir}/clang/clang-rename.py*
%endif
%files -n %{pkg_name_clang}-tools-extra-devel
%license clang-tools-extra/LICENSE.TXT
%{install_includedir}/clang-tidy/
%files -n %{?scl_prefix}git-clang-format%{pkg_suffix}
%license clang/LICENSE.TXT
%{install_bindir}/git-clang-format
%if %{without sys_llvm}
%{_bindir}/git-clang-format-%{maj_ver}
%endif
%if %{with sys_llvm}
%files -n python%{python3_pkgversion}-clang
%license clang/LICENSE.TXT
%{python3_sitelib}/clang/
%endif
#endregion CLANG files
#region COMPILER-RT files
%files -n %{pkg_name_compiler_rt}
%license compiler-rt/LICENSE.TXT
%ifarch x86_64 aarch64 riscv64
%{install_libdir}/clang/%{maj_ver}/bin/hwasan_symbolize
%endif
%{install_libdir}/clang/%{maj_ver}/include/fuzzer
%{install_libdir}/clang/%{maj_ver}/include/orc
%{install_libdir}/clang/%{maj_ver}/include/profile
%{install_libdir}/clang/%{maj_ver}/include/sanitizer
%{install_libdir}/clang/%{maj_ver}/include/xray
%{install_libdir}/clang/%{maj_ver}/share/*.txt
# Files that appear on all targets
%{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/libclang_rt.*
%ifnarch s390x
%{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtbegin.o
%{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o
%endif
%ifnarch %{ix86} s390x
%{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a
%endif
# Additional symlink if two triples are in use.
%if "%{llvm_triple}" != "%{compiler_rt_triple}"
%{install_libdir}/clang/%{maj_ver}/lib/%{llvm_triple}
%endif
#endregion COMPILER-RT files
#region OPENMP files
%files -n %{pkg_name_libomp}
%license openmp/LICENSE.TXT
%{install_libdir}/libomp.so
%{install_libdir}/libompd.so
%{install_libdir}/libarcher.so
%ifnarch %{ix86} %{arm} riscv64 loongarch64
# libomptarget is not supported on 32-bit systems.
# s390x does not support the offloading plugins.
%if %{maj_ver} >= 20
%{install_libdir}/libLLVMOffload.so.%{so_suffix}
%endif
%if %{maj_ver} == 18
%{install_libdir}/libomptarget.rtl.amdgpu.so.%{so_suffix}
%{install_libdir}/libomptarget.rtl.cuda.so.%{so_suffix}
%{install_libdir}/libomptarget.rtl.%{libomp_arch}.so.%{so_suffix}
%endif
%if %{maj_ver} <= 17
%{install_libdir}/libomptarget.rtl.amdgpu.so.%{maj_ver}
%{install_libdir}/libomptarget.rtl.cuda.so.%{maj_ver}
%{install_libdir}/libomptarget.rtl.%{libomp_arch}.so.%{maj_ver}
%endif
%if %{maj_ver} >= 18
%{install_libdir}/libomptarget.so.%{so_suffix}
%else
%{install_libdir}/libomptarget.so.%{maj_ver}
%endif
%endif
%files -n %{pkg_name_libomp}-devel
%license openmp/LICENSE.TXT
%{install_libdir}/clang/%{maj_ver}/include/omp.h
%if %{maj_ver} >= 18
%{install_libdir}/clang/%{maj_ver}/include/ompx.h
%endif
%{install_libdir}/clang/%{maj_ver}/include/omp-tools.h
%{install_libdir}/clang/%{maj_ver}/include/ompt.h
%{install_libdir}/clang/%{maj_ver}/include/ompt-multiplex.h
%{install_libdir}/cmake/openmp/
%ifnarch %{ix86}
# libomptarget is not supported on 32-bit systems.
# s390x does not support the offloading plugins.
%ifnarch riscv64
%if %{maj_ver} <= 18
%{install_libdir}/libomptarget.rtl.amdgpu.so
%{install_libdir}/libomptarget.rtl.cuda.so
%{install_libdir}/libomptarget.rtl.%{libomp_arch}.so
%endif
%endif
%{install_libdir}/libomptarget.devicertl.a
%{install_libdir}/libomptarget-amdgpu-*.bc
%{install_libdir}/libomptarget-nvptx-*.bc
%{install_libdir}/libomptarget.so
%if %{maj_ver} >= 20
%{install_libdir}/libLLVMOffload.so
%{install_includedir}/offload
%endif
%endif
#endregion OPENMP files
#region LLD files
%files -n %{pkg_name_lld}
%license lld/LICENSE.TXT
%ghost %{_bindir}/ld
%{install_bindir}/lld
%{install_bindir}/lld-link
%{install_bindir}/ld.lld
%{install_bindir}/ld64.lld
%{install_bindir}/wasm-ld
%if %{with sys_llvm}
%{_mandir}/man1/ld.lld.1*
%else
%{_bindir}/lld%{exec_suffix}
%{_bindir}/lld-link%{exec_suffix}
%{_bindir}/ld.lld%{exec_suffix}
%{_bindir}/ld64.lld%{exec_suffix}
%{_bindir}/wasm-ld%{exec_suffix}
%endif
%files -n %{pkg_name_lld}-devel
%license lld/LICENSE.TXT
%{install_includedir}/lld
%{install_libdir}/liblldCOFF.so
%{install_libdir}/liblldCommon.so
%{install_libdir}/liblldELF.so
%{install_libdir}/liblldMachO.so
%{install_libdir}/liblldMinGW.so
%{install_libdir}/liblldWasm.so
%{install_libdir}/cmake/lld/
%files -n %{pkg_name_lld}-libs
%license lld/LICENSE.TXT
%{install_libdir}/liblldCOFF.so.*
%{install_libdir}/liblldCommon.so.*
%{install_libdir}/liblldELF.so.*
%{install_libdir}/liblldMachO.so.*
%{install_libdir}/liblldMinGW.so.*
%{install_libdir}/liblldWasm.so.*
#endregion LLD files
#region Toolset files
%if 0%{?rhel}
%files -n %{pkg_name_llvm}-toolset
%license LICENSE.TXT
%endif
#endregion Toolset files
#region LLDB files
%if %{with lldb}
%files -n %{pkg_name_lldb}
%license lldb/LICENSE.TXT
%{install_bindir}/lldb*
%if %{without sys_llvm}
%{_bindir}/lldb*
%endif
# Usually, *.so symlinks are kept in devel subpackages. However, the python
# bindings depend on this symlink at runtime.
%{install_libdir}/liblldb*.so
%{install_libdir}/liblldb.so.*
%{install_libdir}/liblldbIntelFeatures.so.*
%{_mandir}/man1/lldb-server%{exec_suffix}.1.gz
%{_mandir}/man1/lldb%{exec_suffix}.1.gz
%if %{with bundle_compat_lib}
%{_libdir}/liblldb.so.%{compat_maj_ver}*
%endif
%files -n %{pkg_name_lldb}-devel
%{install_includedir}/lldb
%files -n %{?scl_prefix}python3-lldb
%{python3_sitearch}/lldb
%endif
#endregion LLDB files
#region MLIR files
%if %{with mlir}
%files -n %{pkg_name_mlir}
%license LICENSE.TXT
%if %{maj_ver} >= 18
%{install_libdir}/libmlir_arm_runner_utils.so.%{maj_ver}*
%{install_libdir}/libmlir_arm_sme_abi_stubs.so.%{maj_ver}*
%endif
%{install_libdir}/libmlir_async_runtime.so.%{maj_ver}*
%{install_libdir}/libmlir_c_runner_utils.so.%{maj_ver}*
%{install_libdir}/libmlir_float16_utils.so.%{maj_ver}*
%{install_libdir}/libmlir_runner_utils.so.%{maj_ver}*
%{install_libdir}/libMLIR*.so.%{maj_ver}*
%files -n %{pkg_name_mlir}-static
%{install_libdir}/libMLIR*.a
%files -n %{pkg_name_mlir}-devel
%{install_bindir}/mlir-cpu-runner
%{install_bindir}/mlir-linalg-ods-yaml-gen
%{install_bindir}/mlir-lsp-server
%{install_bindir}/mlir-opt
%{install_bindir}/mlir-pdll
%{install_bindir}/mlir-pdll-lsp-server
%{install_bindir}/mlir-reduce
%{install_bindir}/mlir-tblgen
%{install_bindir}/mlir-translate
%{install_bindir}/tblgen-lsp-server
%if %{maj_ver} >= 18
%{install_bindir}/mlir-query
%{install_bindir}/tblgen-to-irdl
%endif
%if %{maj_ver} >= 20
%{install_bindir}/mlir-rewrite
%endif
%if %{without sys_llvm}
%{_bindir}/mlir-tblgen-%{maj_ver}
%{_bindir}/mlir-pdll-%{maj_ver}
%{_bindir}/mlir-cpu-runner-%{maj_ver}
%{_bindir}/mlir-linalg-ods-yaml-gen-%{maj_ver}
%{_bindir}/mlir-lsp-server-%{maj_ver}
%{_bindir}/mlir-opt-%{maj_ver}
%{_bindir}/mlir-pdll-lsp-server-%{maj_ver}
%{_bindir}/tblgen-lsp-server-%{maj_ver}
%{_bindir}/mlir-reduce-%{maj_ver}
%{_bindir}/mlir-translate-%{maj_ver}
%if %{maj_ver} >= 18
%{_bindir}/mlir-query-%{maj_ver}
%{_bindir}/tblgen-to-irdl-%{maj_ver}
%endif
%if %{maj_ver} >= 20
%{_bindir}/mlir-rewrite-%{maj_ver}
%endif
%endif
%{install_includedir}/mlir
%{install_includedir}/mlir-c
%{install_libdir}/cmake/mlir
%if %{maj_ver} >= 18
%{install_libdir}/libmlir_arm_runner_utils.so
%{install_libdir}/libmlir_arm_sme_abi_stubs.so
%endif
%{install_libdir}/libmlir_async_runtime.so
%{install_libdir}/libmlir_c_runner_utils.so
%{install_libdir}/libmlir_float16_utils.so
%{install_libdir}/libmlir_runner_utils.so
%{install_libdir}/libMLIR*.so
%files -n %{?scl_prefix}python3-mlir
%{python3_sitearch}/mlir/
%endif
#endregion MLIR files
#region libcxx files
%if %{with libcxx}
%files -n %{pkg_name_libcxx}
%license libcxx/LICENSE.TXT
%doc libcxx/CREDITS.TXT libcxx/TODO.TXT
%{install_libdir}/libc++.so.*
%files -n %{pkg_name_libcxx}-devel
%{install_includedir}/c++/
%exclude %{install_includedir}/c++/v1/cxxabi.h
%exclude %{install_includedir}/c++/v1/__cxxabi_config.h
%{install_libdir}/libc++.so
%if %{maj_ver} >= 19
%{install_libdir}/libc++.modules.json
%{install_datadir}/libc++/v1/*
%endif
%files -n %{pkg_name_libcxx}-static
%license libcxx/LICENSE.TXT
%{install_libdir}/libc++.a
%{install_libdir}/libc++experimental.a
%files -n %{pkg_name_libcxxabi}
%license libcxxabi/LICENSE.TXT
%doc libcxxabi/CREDITS.TXT
%{install_libdir}/libc++abi.so.*
%files -n %{pkg_name_libcxxabi}-devel
%{install_includedir}/c++/v1/cxxabi.h
%{install_includedir}/c++/v1/__cxxabi_config.h
%{install_libdir}/libc++abi.so
%files -n %{pkg_name_libcxxabi}-static
%{install_libdir}/libc++abi.a
%files -n %{pkg_name_llvm_libunwind}
%license libunwind/LICENSE.TXT
%{install_libdir}/libunwind.so.1
%{install_libdir}/libunwind.so.1.0
%files -n %{pkg_name_llvm_libunwind}-devel
%{install_includedir}/llvm-libunwind/__libunwind_config.h
%{install_includedir}/llvm-libunwind/libunwind.h
%{install_includedir}/llvm-libunwind/libunwind.modulemap
%{install_includedir}/llvm-libunwind/mach-o/compact_unwind_encoding.h
%if %{maj_ver} <= 18
%{install_includedir}/llvm-libunwind/mach-o/compact_unwind_encoding.modulemap
%endif
%{install_includedir}/llvm-libunwind/unwind.h
%{install_includedir}/llvm-libunwind/unwind_arm_ehabi.h
%{install_includedir}/llvm-libunwind/unwind_itanium.h
%dir %{install_libdir}/llvm-unwind
%{install_libdir}/llvm-unwind/libunwind.so
%files -n %{pkg_name_llvm_libunwind}-static
%{install_libdir}/libunwind.a
%endif
%files -n %{pkg_name_llvm_libunwind}-doc
%license libunwind/LICENSE.TXT
%doc %{_pkgdocdir}/html
#endregion libcxx files
#endregion files
%changelog
* Mon Feb 10 2025 liyunfei <liyunfei33@huawei.com> - 19.1.7-1
- Package init