diff --git a/llvm.spec b/llvm.spec index fd2768b..294191c 100644 --- a/llvm.spec +++ b/llvm.spec @@ -1,8 +1,55 @@ -%bcond_with snapshot_build +#region globals +#region version +%global maj_ver 19 +%global min_ver 1 +%global patch_ver 3 +#global rc_ver 4 +%bcond_with snapshot_build %if %{with snapshot_build} -# Unlock LLVM Snapshot LUA functions -%{llvm_sb} +%include %{_sourcedir}/version.spec.inc +%endif +#endregion version + +# Components enabled if supported by target architecture: +%define gold_arches %{ix86} x86_64 aarch64 %{power64} s390x +%ifarch %{gold_arches} + %bcond_without gold +%else + %bcond_with gold +%endif + +# Build compat packages llvmN instead of main package for the current LLVM +# version. Used on Fedora. +%bcond_with compat_build +# Bundle compat libraries for a previous LLVM version, as part of llvm-libs and +# clang-libs. Used on RHEL. +%bcond_without bundle_compat_lib +%bcond_without check + +%if %{with bundle_compat_lib} +%global compat_maj_ver 18 +%global compat_ver %{compat_maj_ver}.1.8 +%endif + +# Compat builds do not include python-lit and lldb +%if %{with compat_build} +%bcond_with python_lit +%bcond_with lldb +%else +%bcond_without python_lit +%bcond_without lldb +%endif + +# Disable LTO on x86 and riscv in order to reduce memory consumption. +%ifarch %ix86 riscv64 +%bcond_with lto_build +%else +%bcond_without lto_build +%endif + +%if %{without lto_build} +%global _lto_cflags %nil %endif # We are building with clang for faster/lower memory LTO builds. @@ -13,57 +60,44 @@ # https://bugzilla.redhat.com/show_bug.cgi?id=2158587 %undefine _include_frame_pointers -# Components enabled if supported by target architecture: -%define gold_arches %{ix86} x86_64 aarch64 %{power64} s390x -%ifarch %{gold_arches} - %bcond_without gold -%else - %bcond_with gold -%endif - -%bcond_with compat_build -%bcond_without check - -%ifarch %ix86 -# Disable LTO on x86 in order to reduce memory consumption -%bcond_with lto_build -%else -%bcond_without lto_build -%endif - -%global maj_ver 18 -%global min_ver 1 -%global patch_ver 8 -#global rc_ver 4 - +# Suffixless tarball name (essentially: basename -s .tar.xz llvm-project-17.0.6.src.tar.xz) %if %{with snapshot_build} -%undefine rc_ver -%global maj_ver %{llvm_snapshot_version_major} -%global min_ver %{llvm_snapshot_version_minor} -%global patch_ver %{llvm_snapshot_version_patch} +%global src_tarball_dir llvm-project-%{llvm_snapshot_git_revision} +%else +%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}.src %endif -%global llvm_srcdir llvm-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src -%global cmake_srcdir cmake-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src -%global third_party_srcdir third-party-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src +#region LLVM globals %if %{with compat_build} -%global pkg_name llvm%{maj_ver} +%global pkg_name_llvm llvm%{maj_ver} +%global pkg_suffix %{maj_ver} %global exec_suffix -%{maj_ver} -%global install_prefix %{_libdir}/%{name} +%global install_prefix %{_libdir}/%{pkg_name_llvm} %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 build_libdir llvm/%{_vpath_builddir}/lib -%global pkg_includedir %{_includedir}/%{name} +%global pkg_includedir %{_includedir}/%{pkg_name_llvm} %global pkg_datadir %{install_prefix}/share %else -%global pkg_name 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 build_libdir llvm/%{_vpath_builddir}/%{_lib} %global pkg_datadir %{_datadir} +%global pkg_suffix %{nil} %global exec_suffix %{nil} %endif @@ -88,103 +122,244 @@ # The executable Python scripts in /usr/share/opt-viewer/ import each other %undefine _py3_shebang_P -################################################################################ -# OS Specific Configuration -################################################################################ +#endregion LLVM globals -######## -# RHEL # -######## -%if 0%{?rhel} -%global _smp_mflags -j8 +#region CLANG globals -%if 0%{?rhel} == 8 -%undefine __cmake_in_source_build +%global pkg_name_clang clang%{pkg_suffix} -# libedit-devel is a buildroot-only package in RHEL8, so we can't have a -# any run-time depencies on it. -%global use_libedit 0 +#endregion CLANG globals + +#region COMPILER-RT globals + +%global pkg_name_compiler_rt compiler-rt%{pkg_suffix} + +# TODO(kkleine): do these optflags hurt llvm and/or clang? + +# see https://sourceware.org/bugzilla/show_bug.cgi?id=25271 +%global optflags %(echo %{optflags} -D_DEFAULT_SOURCE) + +# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93615 +%global optflags %(echo %{optflags} -Dasm=__asm__) + +# 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 libomp%{pkg_suffix} + +%global so_suffix %{maj_ver}.%{min_ver} + +%if %{with snapshot_build} +%global so_suffix %{maj_ver}.%{min_ver}%{llvm_snapshot_version_suffix} %endif -%if 0%{?rhel} > 8 -%global use_libedit 1 -%endif +%ifarch ppc64le +%global libomp_arch ppc64 +%else +%global libomp_arch %{_arch} %endif -################################################################################ -# Spec File -################################################################################ +#endregion LLD globals +#region LLD globals +%global pkg_name_lld lld%{pkg_suffix} +#endregion LLD globals -Name: %{pkg_name} +#region LLDB globals +%global pkg_name_lldb lldb +#endregion LLDB globals +#endregion globals + +#region packages +#region main package +Name: %{pkg_name_llvm} Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}} -Release: 3%{?dist} +Release: 1%{?dist} Summary: The Low Level Virtual Machine License: Apache-2.0 WITH LLVM-exception OR NCSA URL: http://llvm.org + %if %{with snapshot_build} -Source0: %{llvm_snapshot_source_prefix}llvm-%{llvm_snapshot_yyyymmdd}.src.tar.xz -Source2: %{llvm_snapshot_source_prefix}cmake-%{llvm_snapshot_yyyymmdd}.src.tar.xz -Source4: %{llvm_snapshot_source_prefix}third-party-%{llvm_snapshot_yyyymmdd}.src.tar.xz -%{llvm_snapshot_extra_source_tags} +Source0: https://github.com/llvm/llvm-project/archive/%{llvm_snapshot_git_revision}.tar.gz %else -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{llvm_srcdir}.tar.xz -Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{llvm_srcdir}.tar.xz.sig -Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz -Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{cmake_srcdir}.tar.xz.sig -Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{third_party_srcdir}.tar.xz -Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{third_party_srcdir}.tar.xz.sig -Source6: release-keys.asc +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{src_tarball_dir}.tar.xz +Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{src_tarball_dir}.tar.xz.sig +%endif +Source6: release-keys.asc + +%if %{without compat_build} +Source2005: macros.%{pkg_name_clang} %endif -# Backport with modifications from -# https://github.com/llvm/llvm-project/pull/99273 -# Fixes RHEL-54336 -Patch001: 99273.patch -# RHEL-specific patch to avoid unwanted python3-myst-parser dep -Patch101: 0101-Deactivate-markdown-doc.patch +%if %{with bundle_compat_lib} +Source3000: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/llvm-project-%{compat_ver}.src.tar.xz +Source3001: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compat_ver}/llvm-project-%{compat_ver}.src.tar.xz.sig +%endif + +# Sources we use to split up the main spec file in sections so that we can more +# easily see what specfile sections are touched by a patch. +%if %{with snapshot_build} +Source1000: version.spec.inc +%endif + +# We've established the habit of numbering patches the following way: +# +# 0-499: All patches that are unconditionally applied +# 500-1000: Patches applied under certain conditions (e.g. only on RHEL8) +# 1500-1599: Patches for LLVM 15 +# 1600-1699: Patches for LLVM 16 +# 1700-1799: Patches for LLVM 17 +# ... +# 2000-2099: Patches for LLVM 20 +# +# The idea behind this is that the last range of patch numbers (e.g. 2000-2099) allow +# us to "deprecate" a patch instead of deleting it right away. +# Suppose llvm upstream in git is at version 20 and there's a patch living +# in some PR that has not been merged yet. You can copy that patch and put it +# in a line like: +# +# Patch2011: upstream.patch +# +# As time goes by, llvm moves on to LLVM 21 and meanwhile the patch has landed. +# There's no need for you to remove the "Patch2011:" line. In fact, we encourage you +# to not remove it for some time. For compat libraries and compat packages we might +# still need this patch and so we're applying it automatically for you in those +# situations. Remember that a compat library is always at least one major version +# behind the latest packaged LLVM version. + +#region OpenMP patches +Patch1900: 0001-openmp-Add-option-to-disable-tsan-tests-111548.patch +Patch1901: 0001-openmp-Use-core_siblings_list-if-physical_package_id.patch +#endregion OpenMP patches + +#region CLANG patches +Patch101: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch +Patch102: 0003-PATCH-clang-Don-t-install-static-libraries.patch +#endregion CLANG patches + +# Workaround a bug in ORC on ppc64le. +# More info is available here: https://reviews.llvm.org/D159115#4641826 +Patch103: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch + +#region LLD patches +Patch1800: 0001-18-Always-build-shared-libs-for-LLD.patch +Patch1902: 0001-19-Always-build-shared-libs-for-LLD.patch +Patch2000: 0001-19-Always-build-shared-libs-for-LLD.patch +#endregion LLD patches + +#region RHEL patches +# All RHEL +%if %{maj_ver} >= 20 +Patch500: 0001-20-Remove-myst_parser-dependency-for-RHEL.patch +%else +Patch500: 0001-19-Remove-myst_parser-dependency-for-RHEL.patch +%endif + +# RHEL 8 only +Patch501: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch +#endregion RHEL patches + +%if 0%{?rhel} == 8 +%global python3_pkgversion 3.12 +%global __python3 /usr/bin/python3.12 +%endif BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: clang BuildRequires: cmake +BuildRequires: chrpath BuildRequires: ninja-build BuildRequires: zlib-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel -BuildRequires: python3-psutil +# This intentionally does not use python3_pkgversion. RHEL 8 does not have +# python3.12-sphinx, and we are only using it as a binary anyway. BuildRequires: python3-sphinx -%if %{undefined rhel} -BuildRequires: python3-myst-parser +%if 0%{?rhel} != 8 +# RHEL 8 does not have these packages for python3.12. However, they are only +# needed for LLDB tests. +BuildRequires: python%{python3_pkgversion}-psutil +BuildRequires: python%{python3_pkgversion}-pexpect %endif +%if %{undefined rhel} +BuildRequires: python%{python3_pkgversion}-myst-parser +%endif +# Needed for %%multilib_fix_c_header BuildRequires: multilib-rpm-config %if %{with gold} BuildRequires: binutils-devel +%if %{undefined rhel} || 0%{?rhel} > 8 +BuildRequires: binutils-gold +%endif %endif %ifarch %{valgrind_arches} # Enable extra functionality when run the LLVM JIT under valgrind. BuildRequires: valgrind-devel %endif -%if 0%{?use_libedit} # LLVM's LineEditor library will use libedit if it is available. BuildRequires: libedit-devel -%endif -# Need pandoc to cover markdown to rst, because RHEL does not have recommonmark, -# so we can't build the documentation as is. +# We need python3-devel for %%py3_shebang_fix +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools %if 0%{?rhel} == 8 -# RHEL8 has pandoc which we can use instead of python3-recommonmark for some things. -BuildRequires: pandoc +BuildRequires: python%{python3_pkgversion}-rpm-macros %endif -# We need python3-devel for pathfix.py and %%py3_shebang_fix. -BuildRequires: python3-devel -BuildRequires: python3-setuptools -# For origin certification +# For gpg source verification BuildRequires: gnupg2 +BuildRequires: swig +BuildRequires: libxml2-devel +BuildRequires: doxygen -Requires: %{name}-libs%{?_isa} = %{version}-%{release} +# 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) + +BuildRequires: graphviz + +# This is required because we need "ps" when running LLDB tests +BuildRequires: procps-ng + +# For reproducible pyc file generation +# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility +# Since Fedora 41 this happens automatically, and RHEL 8 does not support this. +%if (%{defined fedora} && 0%{?fedora} < 41) || 0%{?rhel} == 9 || 0%{?rhel} == 10 +BuildRequires: /usr/bin/marshalparser +%global py_reproducible_pyc_path %{buildroot}%{python3_sitelib} +%endif + +Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release} Provides: llvm(major) = %{maj_ver} @@ -193,222 +368,754 @@ 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 -%package devel +#region LLVM lit package +%if %{with python_lit} +%package -n python%{python3_pkgversion}-lit +Summary: LLVM lit test runner for Python 3 + +BuildArch: noarch +Requires: python%{python3_pkgversion}-setuptools +%if 0%{?rhel} == 8 +# Became python3.12-clang in LLVM 19 +Obsoletes: python3-lit < 18.9 +%else +# This optional dependency is not available for python3.12 on RHEL 8. +Recommends: python%{python3_pkgversion}-psutil +%endif + +%description -n python%{python3_pkgversion}-lit +lit is a tool used by the LLVM project for executing its test suites. +%endif +#endregion LLVM lit package + +#region LLVM packages + +%package -n %{pkg_name_llvm}-devel Summary: Libraries and header files for LLVM -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: %{name}-libs%{?_isa} = %{version}-%{release} +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. -%if 0%{?use_libedit} Requires: libedit-devel -%endif +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: %{name}-static%{?_isa} = %{version}-%{release} -Requires: %{name}-test%{?_isa} = %{version}-%{release} -Requires: %{name}-googletest%{?_isa} = %{version}-%{release} +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): /usr/sbin/alternatives -Requires(postun): /usr/sbin/alternatives +Requires(post): %{_sbindir}/alternatives +Requires(postun): %{_sbindir}/alternatives Provides: llvm-devel(major) = %{maj_ver} -%description devel +%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 doc +%package -n %{pkg_name_llvm}-doc Summary: Documentation for LLVM BuildArch: noarch -Requires: %{name} = %{version}-%{release} +Requires: %{pkg_name_llvm} = %{version}-%{release} -%description doc +%description -n %{pkg_name_llvm}-doc Documentation for the LLVM compiler infrastructure. -%package libs +%package -n %{pkg_name_llvm}-libs Summary: LLVM shared libraries -Requires(post): /sbin/ldconfig -Requires(postun): /sbin/ldconfig -%description libs +%description -n %{pkg_name_llvm}-libs Shared libraries for the LLVM compiler infrastructure. -%package static +%package -n %{pkg_name_llvm}-static Summary: LLVM static libraries -Conflicts: %{name}-devel < 8 +Conflicts: %{pkg_name_llvm}-devel < 8 Provides: llvm-static(major) = %{maj_ver} -%description static +%description -n %{pkg_name_llvm}-static Static libraries for the LLVM compiler infrastructure. -%package cmake-utils +%package -n %{pkg_name_llvm}-cmake-utils Summary: CMake utilities shared across LLVM subprojects -%description cmake-utils +%description -n %{pkg_name_llvm}-cmake-utils CMake utilities shared across LLVM subprojects. This is for internal use by LLVM packages only. -%package test +%package -n %{pkg_name_llvm}-test Summary: LLVM regression tests -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: %{name}-libs%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_llvm}%{?_isa} = %{version}-%{release} +Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release} Provides: llvm-test(major) = %{maj_ver} -%description test +%description -n %{pkg_name_llvm}-test LLVM regression tests. -%package googletest +%package -n %{pkg_name_llvm}-googletest Summary: LLVM's modified googletest sources -# libllvm_gtest.a moved from llvm-static to llvm-googletest -Conflicts: %{name}-static < 17.0.0 -%description googletest +%description -n %{pkg_name_llvm}-googletest LLVM's modified googletest sources. -%if 0%{?rhel} -%package toolset -Summary: Package that installs llvm-toolset -Requires: clang = %{version} -Requires: llvm = %{version} +%if %{with snapshot_build} +%package -n %{pkg_name_llvm}-build-stats +Summary: Statistics for the RPM build -%description toolset +%description -n %{pkg_name_llvm}-build-stats +Statistics for the RPM build. Only available in snapshot builds. +%endif + +#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 %{without compat_build} +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 git-clang-format%{pkg_suffix} +Summary: Integration of clang-format for git +Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release} +Requires: git +Requires: python%{python3_pkgversion} + +%description -n git-clang-format%{pkg_suffix} +clang-format integration for git. + +%if %{without compat_build} +%package -n python%{python3_pkgversion}-clang +Summary: Python3 bindings for clang +Requires: %{pkg_name_clang}-devel%{?_isa} = %{version}-%{release} +Requires: python%{python3_pkgversion} +%if 0%{?rhel} == 8 +# Became python3.12-clang in LLVM 19 +Obsoletes: python3-clang < 18.9 +%endif +%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: 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: 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: 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 %{without compat_build} +# 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 Toolset package +%if 0%{?rhel} +%package -n %{pkg_name_llvm}-toolset +Summary: Package that installs llvm-toolset +Requires: clang = %{version}-%{release} +Requires: llvm = %{version}-%{release} +Requires: lld = %{version}-%{release} + +%description -n %{pkg_name_llvm}-toolset This is the main package for llvm-toolset. %endif +#endregion Toolset package -%prep -%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE1}' --data='%{SOURCE0}' -%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE3}' --data='%{SOURCE2}' -%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE5}' --data='%{SOURCE4}' -%setup -T -q -b 2 -n %{cmake_srcdir} -# TODO: It would be more elegant to set -DLLVM_COMMON_CMAKE_UTILS=%{_builddir}/%{cmake_srcdir}, -# but this is not a CACHED variable, so we can't actually set it externally :( -cd .. -mv %{cmake_srcdir} cmake -%setup -T -q -b 4 -n %{third_party_srcdir} -cd .. -mv %{third_party_srcdir} third-party +#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/ -%setup -T -q -b 0 -n %{llvm_srcdir} -%autopatch -M%{?!rhel:100}%{?rhel:200} -p2 +Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release} +Requires: python%{python3_pkgversion}-lldb -%py3_shebang_fix \ - test/BugPoint/compile-custom.ll.py \ - tools/opt-viewer/*.py \ - utils/update_cc_test_checks.py +%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 python%{python3_pkgversion}-lldb +%{?python_provide:%python_provide python%{python3_pkgversion}-lldb} +Summary: Python module for LLDB + +Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release} %if 0%{?rhel} == 8 -# Convert markdown files to rst to cope with the absence of compatible md parser in rhel. -# The sed expression takes care of a slight difference between pandoc markdown and sphinx markdown. -find -name '*.md' | while read md; do sed -r -e 's/^( )*\* /\n\1\* /' ${md} | pandoc -f markdown -o ${md%.md}.rst ; done +# Became python3.12-lldb in LLVM 19 +Obsoletes: python3-lldb < 18.9 %endif +%description -n python%{python3_pkgversion}-lldb +The package contains the LLDB Python module. +%endif +#endregion LLDB packages +#endregion packages + +#region prep +%prep +%if %{without snapshot_build} +# llvm +%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%endif + +%if %{with bundle_compat_lib} +%{gpgverify} --keyring='%{SOURCE6}' --signature='%{SOURCE3001}' --data='%{SOURCE3000}' +%setup -T -q -b 3000 -n llvm-project-%{compat_ver}.src + +# 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%{compat_maj_ver}00 -M%{compat_maj_ver}99 -p1 + +%endif + +# -T : Do Not Perform Default Archive Unpacking (without this, the th source would be unpacked twice) +# -b : 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 + +%if %{defined rhel} +%patch -p1 -P500 + +%if %{rhel} == 8 +%patch -p1 -P501 +%endif +%endif + +#region LLVM preparation + +%py3_shebang_fix \ + llvm/test/BugPoint/compile-custom.ll.py \ + llvm/tools/opt-viewer/*.py \ + llvm/utils/update_cc_test_checks.py + +#endregion LLVM preparation + +#region CLANG preparation + +%py3_shebang_fix \ + clang-tools-extra/clang-tidy/tool/ \ + clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py + +%py3_shebang_fix \ + clang/tools/clang-format/ \ + clang/tools/clang-format/git-clang-format \ + clang/utils/hmaptool/hmaptool \ + clang/tools/scan-view/bin/scan-view \ + clang/tools/scan-view/share/Reporter.py \ + clang/tools/scan-view/share/startfile.py \ + clang/tools/scan-build-py/bin/* \ + clang/tools/scan-build-py/libexec/* + +#endregion CLANG preparation + +#region COMPILER-RT preparation + +%py3_shebang_fix compiler-rt/lib/hwasan/scripts/hwasan_symbolize + +#endregion COMPILER-RT preparation + +#region LLDB preparation +# Empty lldb/docs/CMakeLists.txt because we cannot build it +echo "" > lldb/docs/CMakeLists.txt +#endregion LLDB preparation +#endregion prep + +#region build %build - -%if %{without lto_build} -%global _lto_cflags %nil +# 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 +%ifarch %ix86 +%global reduce_debuginfo 1 +%endif +%if 0%{?rhel} == 8 +%global reduce_debuginfo 1 %endif -%ifarch s390 s390x %ix86 -# Decrease debuginfo verbosity to reduce memory consumption during final library linking +%if %reduce_debuginfo == 1 %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %endif +%global projects clang;clang-tools-extra;lld +%if %{with lldb} +%global projects %{projects};lldb +%endif + # Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files. export ASMFLAGS="%{build_cflags}" -# force off shared libs as cmake macros turns it on. -# TODO: Disable LLVM_UNREACHABLE_OPTIMIZE. -%cmake -G Ninja \ - -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DLLVM_PARALLEL_LINK_JOBS=1 \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_SKIP_RPATH:BOOL=ON \ -%ifarch s390 %ix86 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ +# We set CLANG_DEFAULT_PIE_ON_LINUX=OFF and PPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON to match the +# defaults used by Fedora's GCC. + +# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things. +# This is copied from clang. +%ifarch aarch64 +%define _find_debuginfo_dwz_opts %{nil} %endif + +cd llvm + +#region LLVM lit +%if %{with python_lit} +pushd utils/lit +%py3_build +popd +%endif +#endregion LLVM lit + +%if 0%{?rhel} == 8 +%undefine __cmake_in_source_build +%endif + +#region cmake options +%global cmake_config_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}" \\\ + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra +%if %{with compat_build} + %global cmake_config_args %{cmake_config_args} -DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver} +%else + %global cmake_config_args %{cmake_config_args} -DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver} +%endif +#endregion clang options + +#region compiler-rt options +%global cmake_config_args %{cmake_config_args} \\\ + -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF \\\ + -DCOMPILER_RT_INSTALL_PATH=%{_prefix}/lib/clang/%{maj_ver} +#endregion compiler-rt options + +#region docs options +%global cmake_config_args %{cmake_config_args} \\\ + -DLLVM_BUILD_DOCS:BOOL=ON \\\ + -DLLVM_ENABLE_SPHINX:BOOL=ON \\\ + -DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \\\ + -DSPHINX_WARNINGS_AS_ERRORS=OFF \\\ + -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\ + -DLLVM_INCLUDE_DOCS:BOOL=ON \\\ + -DLLVM_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html +#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 +%if 0%{?rhel} == 8 + %global cmake_config_args %{cmake_config_args} -DLLDB_INCLUDE_TESTS:BOOL=OFF +%else + %global cmake_config_args %{cmake_config_args} -DLLDB_ENFORCE_STRICT_TEST_REQUIREMENTS:BOOL=ON +%endif +%endif +#endregion lldb options + +#region llvm options +%global cmake_config_args %{cmake_config_args} \\\ + -DLLVM_APPEND_VC_REV:BOOL=OFF \\\ + -DLLVM_BUILD_EXAMPLES:BOOL=OFF \\\ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \\\ + -DLLVM_BUILD_LLVM_DYLIB: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_EH=ON \\\ + -DLLVM_ENABLE_FFI:BOOL=ON \\\ + -DLLVM_ENABLE_LIBCXX:BOOL=OFF \\\ + -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \\\ + -DLLVM_ENABLE_PROJECTS="%{projects}" \\\ + -DLLVM_ENABLE_RTTI:BOOL=ON \\\ + -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp;offload" \\\ + -DLLVM_ENABLE_ZLIB:BOOL=ON \\\ + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \\\ + -DLLVM_INCLUDE_BENCHMARKS=OFF \\\ + -DLLVM_INCLUDE_EXAMPLES:BOOL=ON \\\ + -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_TARGETS_TO_BUILD=%{targets_to_build} \\\ + -DLLVM_TOOLS_INSTALL_DIR:PATH=bin \\\ + -DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \\\ + -DLLVM_USE_PERF:BOOL=ON \\\ + -DLLVM_UTILS_INSTALL_DIR:PATH=bin +#endregion llvm options + +#region openmp options +%global cmake_config_args %{cmake_config_args} \\\ + -DOPENMP_INSTALL_LIBDIR=%{unprefixed_libdir} \\\ + -DLIBOMP_INSTALL_ALIASES=OFF +#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} \\\ + -DBUILD_SHARED_LIBS:BOOL=OFF \\\ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \\\ + -DCMAKE_INSTALL_PREFIX=%{install_prefix} \\\ + -DENABLE_LINKER_BUILD_ID:BOOL=ON \\\ + -DOFFLOAD_INSTALL_LIBDIR=%{unprefixed_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 0%{?fedora} || 0%{?rhel} > 9 + %global cmake_config_args %{cmake_config_args} -DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=ON +%endif + +%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 %{without compat_build} %if 0%{?__isa_bits} == 64 - -DLLVM_LIBDIR_SUFFIX=64 \ + %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX=64 %else - -DLLVM_LIBDIR_SUFFIX= \ + %global cmake_config_args %{cmake_config_args} -DLLVM_LIBDIR_SUFFIX= %endif %endif - \ - -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \ - -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ - -DLLVM_ENABLE_ZLIB:BOOL=ON \ - -DLLVM_ENABLE_FFI:BOOL=ON \ - -DLLVM_ENABLE_RTTI:BOOL=ON \ - -DLLVM_USE_PERF:BOOL=ON \ + %if %{with gold} - -DLLVM_BINUTILS_INCDIR=%{_includedir} \ + %global cmake_config_args %{cmake_config_args} -DLLVM_BINUTILS_INCDIR=%{_includedir} %endif - -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \ - \ - -DLLVM_BUILD_RUNTIME:BOOL=ON \ - \ - -DLLVM_INCLUDE_TOOLS:BOOL=ON \ - -DLLVM_BUILD_TOOLS:BOOL=ON \ - \ - -DLLVM_INCLUDE_TESTS:BOOL=ON \ - -DLLVM_BUILD_TESTS:BOOL=ON \ - -DLLVM_INSTALL_GTEST:BOOL=ON \ - -DLLVM_LIT_ARGS=-v \ - \ - -DLLVM_INCLUDE_EXAMPLES:BOOL=ON \ - -DLLVM_BUILD_EXAMPLES:BOOL=OFF \ - \ - -DLLVM_INCLUDE_UTILS:BOOL=ON \ - -DLLVM_INSTALL_UTILS:BOOL=ON \ - -DLLVM_UTILS_INSTALL_DIR:PATH=bin \ - -DLLVM_TOOLS_INSTALL_DIR:PATH=bin \ - \ - -DLLVM_INCLUDE_DOCS:BOOL=ON \ - -DLLVM_BUILD_DOCS:BOOL=ON \ - -DLLVM_ENABLE_SPHINX:BOOL=ON \ - -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \ - \ + %if %{with snapshot_build} - -DLLVM_VERSION_SUFFIX="%{llvm_snapshot_version_suffix}" \ + %global cmake_config_args %{cmake_config_args} -DLLVM_VERSION_SUFFIX="%{llvm_snapshot_version_suffix}" %else - -DLLVM_VERSION_SUFFIX='' \ +%if %{without compat_build} + %global cmake_config_args %{cmake_config_args} -DLLVM_VERSION_SUFFIX='' %endif - -DLLVM_UNREACHABLE_OPTIMIZE:BOOL=ON \ - -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \ - -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ - -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \ - -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \ - -DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \ - -DSPHINX_WARNINGS_AS_ERRORS=OFF \ - -DCMAKE_INSTALL_PREFIX=%{install_prefix} \ - -DLLVM_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \ - -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 \ - -DLLVM_INCLUDE_BENCHMARKS=OFF \ -%if %{with lto_build} - -DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0" \ %endif + %ifarch x86_64 - -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" + %global cmake_config_args %{cmake_config_args} -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" %endif +%if 0%{?rhel} == 8 + %global cmake_config_args %{cmake_config_args} -DLLVM_RAM_PER_COMPILE_JOB=2048 +%endif +#endregion misc options + +extra_cmake_args='' +# TSan does not support 5-level page tables (https://github.com/llvm/llvm-project/issues/111492) +# so do not run tests using tsan on systems that potentially use 5-level page tables. +if grep 'flags.*la57' /proc/cpuinfo; then + extra_cmake_args="$extra_cmake_args -DOPENMP_TEST_ENABLE_TSAN=OFF" +fi +#endregion cmake options + +%cmake -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. %cmake_build --target LLVM + +# Also build libclang-cpp.so separately to avoid OOM errors. +# This is to fix occasional OOM errors on the ppc64le COPR builders. +%cmake_build --target libclang-cpp.so + %cmake_build +# 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 + +%cmake_build --target runtimes + +#region compat lib +cd .. + +%if %{with bundle_compat_lib} +%cmake -S ../llvm-project-%{compat_ver}.src/llvm -B ../llvm-compat-libs -G Ninja \ + -DCMAKE_INSTALL_PREFIX=%{buildroot}%{_libdir}/llvm%{compat_maj_ver}/ \ + -DCMAKE_SKIP_RPATH=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_EH=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_PROJECTS="clang;lldb" \ + -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DLLVM_INCLUDE_TESTS=OFF + +%ninja_build -C ../llvm-compat-libs LLVM +%ninja_build -C ../llvm-compat-libs libclang.so +%ninja_build -C ../llvm-compat-libs libclang-cpp.so +%ninja_build -C ../llvm-compat-libs liblldb.so + +%endif +#endregion compat lib +#endregion build + +#region install %install +#region LLVM installation + +pushd llvm + +%if %{with python_lit} +pushd utils/lit +%py3_install + +# Strip out #!/usr/bin/env python +sed -i -e '1{\@^#!/usr/bin/env python@d}' %{buildroot}%{python3_sitelib}/lit/*.py +popd +%endif + %cmake_install +popd + mkdir -p %{buildroot}/%{_bindir} # Install binaries needed for lit tests @@ -416,19 +1123,11 @@ mkdir -p %{buildroot}/%{_bindir} for f in %{test_binaries} do - install -m 0755 %{_vpath_builddir}/bin/$f %{buildroot}%{install_bindir} + install -m 0755 llvm/%{_vpath_builddir}/bin/$f %{buildroot}%{install_bindir} + chrpath --delete %{buildroot}%{install_bindir}/$f done -# Remove testing of update utility tools -rm -rf test/tools/UpdateTestChecks - # Install libraries needed for unittests -%if %{without compat_build} -%global build_libdir %{_vpath_builddir}/%{_lib} -%else -%global build_libdir %{_vpath_builddir}/lib -%endif - install %{build_libdir}/libLLVMTestingSupport.a %{buildroot}%{install_libdir} install %{build_libdir}/libLLVMTestingAnnotations.a %{buildroot}%{install_libdir} @@ -448,15 +1147,9 @@ ln -s -t %{buildroot}%{_libdir}/bfd-plugins/ ../LLVMgold.so %else -# Add version suffix to binaries -for f in %{buildroot}/%{install_bindir}/*; do - filename=`basename $f` - ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix} -done - # Create ld.so.conf.d entry -mkdir -p %{buildroot}/etc/ld.so.conf.d -cat >> %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arch}.conf << EOF +mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d +cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{pkg_name_llvm}-%{_arch}.conf << EOF %{install_libdir} EOF @@ -469,6 +1162,196 @@ done %endif +mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake +cp -Rv cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake + +#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 %{without compat_build} +install -p -m0644 -D %{SOURCE2005} %{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang} +sed -i -e "s|@@CLANG_MAJOR_VERSION@@|%{maj_ver}|" \ + -e "s|@@CLANG_MINOR_VERSION@@|%{min_ver}|" \ + -e "s|@@CLANG_PATCH_VERSION@@|%{patch_ver}|" \ + %{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang} + +# 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}%{_prefix}/lib/{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} + +# 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 %{without compat_build} +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* + +# TODO: Package html docs +rm -Rvf %{buildroot}%{install_docdir}/LLVM/clang/html +rm -Rvf %{buildroot}%{install_docdir}/LLVM/clang-tools/html +rm -Rvf %{buildroot}%{install_datadir}/clang-doc/clang-doc-default-stylesheet.css +rm -Rvf %{buildroot}%{install_datadir}/clang-doc/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}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/ + +# Add versioned resource directory macro +mkdir -p %{buildroot}%{_rpmmacrodir}/ +echo "%%clang%{maj_ver}_resource_dir %%{_prefix}/lib/clang/%{maj_ver}" >> %{buildroot}%{_rpmmacrodir}/macros.%{pkg_name_clang} + +# Install config file for clang +%if %{maj_ver} >=18 +mkdir -p %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/ +echo "--gcc-triple=%{_target_cpu}-redhat-linux" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg +echo "--gcc-triple=%{_target_cpu}-redhat-linux" >> %{buildroot}%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg +%endif + +#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 %{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 + +#endregion OPENMP installation + +#region LLD installation + +# Remove LLD's HTML documentation files +rm -Rvf %{buildroot}%{install_docdir}/LLVM/lld/html + +%if %{without compat_build} +# 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}%{_libdir}/liblldb.so)) +ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so +%py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb +%endif +#endregion LLDB installation + +%if %{with compat_build} +# 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 @@ -495,46 +1378,339 @@ rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix} # ghost presence touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix} -mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake -cp -Rv ../cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake +%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 +#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 -rm test/tools/dsymutil/X86/swift-interface.test +# TODO(kkleine): Add this to XFAIL instead? +rm llvm/test/tools/dsymutil/X86/swift-interface.test %if %{with check} -# FIXME: use %%cmake_build instead of %%__ninja -LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{_vpath_builddir} + +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 +} + +# 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)" +} +#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") %endif -%if %{with compat_build} -# Packages that install files in /etc/ld.so.conf have to manually run -# ldconfig. -# See https://bugzilla.redhat.com/show_bug.cgi?id=2001328 and -# https://docs.fedoraproject.org/en-US/packaging-guidelines/Scriptlets/#_linker_configuration_files -%post -p /sbin/ldconfig libs -%postun -p /sbin/ldconfig libs +# 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 -%post devel -/usr/sbin/update-alternatives --install %{_bindir}/llvm-config%{exec_suffix} llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} +%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 + +export LIT_FILTER_OUT=$(test_list_to_regex test_list_filter_out) + +# Disable openmp tests on s390x due to long-running tests. +%ifnarch s390x +%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 LLD +reset_test_opts +%cmake_build --target check-lld +#endregion Test LLD + +%endif + +%if %{with snapshot_build} +# Do this here instead of in install so the check targets are also included. +cp %{_vpath_builddir}/.ninja_log %{buildroot}%{pkg_datadir} +%endif + +#endregion check + +#region misc +%ldconfig_scriptlets -n %{pkg_name-llvm}-libs + %if %{without compat_build} -/usr/sbin/update-alternatives --install %{_bindir}/llvm-config-%{maj_ver} llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{__isa_bits} +%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 %{without compat_build} +%{_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 - /usr/sbin/update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + && "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 devel +%postun -n %{pkg_name_llvm}-devel if [ $1 -eq 0 ]; then - /usr/sbin/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + %{_sbindir}/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} fi %if %{without compat_build} # When upgrading between minor versions (i.e. from x.y.1 to x.y.2), we must @@ -543,19 +1719,277 @@ fi # alternative must be removed in order to give priority to a newly installed # compat package. if [[ $1 -eq 0 - || "x$(%{_bindir}/llvm-config-%{maj_ver} --version | awk -F . '{ print $1 }')" != "x%{maj_ver}" ]]; then - /usr/sbin/update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} + || "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 -%files -%license LICENSE.TXT +%if %{without compat_build} +%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 %exclude %{_mandir}/man1/llvm-config* -%{_mandir}/man1/* -%{install_bindir}/* + +%{_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 + +%{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 +%{install_bindir}/llvm-readtapi +%{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}/reduce-chunk-list +%{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 %{with compat_build} # This is for all the binaries with the version suffix. -%{_bindir}/*%{exec_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} +%{_bindir}/llvm-readtapi%{exec_suffix} +%{_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}/reduce-chunk-list%{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 + %endif %exclude %{_bindir}/llvm-config%{exec_suffix} @@ -571,8 +2005,8 @@ fi %exclude %{install_bindir}/llvm-opt-fuzzer %{pkg_datadir}/opt-viewer -%files libs -%license LICENSE.TXT +%files -n %{pkg_name_llvm}-libs +%license llvm/LICENSE.TXT %{install_libdir}/libLLVM-%{maj_ver}%{?llvm_snapshot_version_suffix:%{llvm_snapshot_version_suffix}}.so %if %{with gold} %{install_libdir}/LLVMgold.so @@ -580,55 +2014,67 @@ fi %{_libdir}/bfd-plugins/LLVMgold.so %endif %endif -%{install_libdir}/libLLVM-%{maj_ver}.so -%{install_libdir}/libLLVM.so.%{maj_ver}.%{min_ver} +%{install_libdir}/libLLVM.so.%{maj_ver}.%{min_ver}%{?llvm_snapshot_version_suffix:%{llvm_snapshot_version_suffix}} %{install_libdir}/libLTO.so* %{install_libdir}/libRemarks.so* %if %{with compat_build} %config(noreplace) /etc/ld.so.conf.d/%{name}-%{_arch}.conf %endif +%if %{with bundle_compat_lib} +%{_libdir}/libLLVM.so.%{compat_maj_ver}* +%endif -%files devel -%license LICENSE.TXT +%files -n %{pkg_name_llvm}-devel +%license llvm/LICENSE.TXT + +%if %{without compat_build} +%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} -%ghost %{_bindir}/llvm-config%{exec_suffix} -%{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits} %{_mandir}/man1/llvm-config* - %{install_includedir}/llvm %{install_includedir}/llvm-c %{install_libdir}/libLLVM.so %{install_libdir}/cmake/llvm -%{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%ghost %{_bindir}/llvm-config-%{maj_ver} -%files doc -%license LICENSE.TXT +%files -n %{pkg_name_llvm}-doc +%license llvm/LICENSE.TXT %doc %{_pkgdocdir}/html -%files static -%license LICENSE.TXT -%{install_libdir}/*.a +%files -n %{pkg_name_llvm}-static +%license llvm/LICENSE.TXT +%{install_libdir}/libLLVM*.a %exclude %{install_libdir}/libLLVMTestingSupport.a %exclude %{install_libdir}/libLLVMTestingAnnotations.a -%exclude %{install_libdir}/libllvm_gtest.a -%exclude %{install_libdir}/libllvm_gtest_main.a -%files cmake-utils -%license LICENSE.TXT +%files -n %{pkg_name_llvm}-cmake-utils +%license llvm/LICENSE.TXT %{pkg_datadir}/llvm/cmake -%files test -%license LICENSE.TXT +%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 %{with compat_build} +%{_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 googletest -%license LICENSE.TXT +%files -n %{pkg_name_llvm}-googletest +%license llvm/LICENSE.TXT %{install_libdir}/libLLVMTestingSupport.a %{install_libdir}/libLLVMTestingAnnotations.a %{install_libdir}/libllvm_gtest.a @@ -636,12 +2082,359 @@ fi %{install_includedir}/llvm-gtest %{install_includedir}/llvm-gmock -%if 0%{?rhel} -%files toolset -%license LICENSE.TXT +%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 +%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang.cfg +%{_sysconfdir}/%{pkg_name_clang}/%{_target_platform}-clang++.cfg +%{_mandir}/man1/clang-%{maj_ver}.1.gz +%{_mandir}/man1/clang++-%{maj_ver}.1.gz +%if %{without compat_build} +%{_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 +%{_prefix}/lib/clang/%{maj_ver}/include/* +%{install_libdir}/libclang.so.%{maj_ver}* +%{install_libdir}/libclang-cpp.so.%{maj_ver}* +%if %{with bundle_compat_lib} +%{_libdir}/libclang.so.%{compat_maj_ver}* +%{_libdir}/libclang-cpp.so.%{compat_maj_ver}* +%endif + +%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 %{with compat_build} +%{_bindir}/clang-tblgen-%{maj_ver} +%endif +%dir %{install_datadir}/clang/ + +%files -n %{pkg_name_clang}-resource-filesystem +%license clang/LICENSE.TXT +%dir %{_prefix}/lib/clang/ +%dir %{_prefix}/lib/clang/%{maj_ver}/ +%dir %{_prefix}/lib/clang/%{maj_ver}/bin/ +%dir %{_prefix}/lib/clang/%{maj_ver}/include/ +%dir %{_prefix}/lib/clang/%{maj_ver}/lib/ +%dir %{_prefix}/lib/clang/%{maj_ver}/share/ +%{_rpmmacrodir}/macros.%{pkg_name_clang} + +%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 %{with compat_build} +%{_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 %{without compat_build} +%{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-installapi +%{install_bindir}/clang-move +%{install_bindir}/clang-offload-bundler +%{install_bindir}/clang-offload-packager +%{install_bindir}/clang-linker-wrapper +%{install_bindir}/clang-nvlink-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} >= 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 %{with compat_build} +%{_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-installapi-%{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-nvlink-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} >= 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 git-clang-format%{pkg_suffix} +%license clang/LICENSE.TXT +%{install_bindir}/git-clang-format +%if %{with compat_build} +%{_bindir}/git-clang-format-%{maj_ver} +%endif + +%if %{without compat_build} +%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 +%{_prefix}/lib/clang/%{maj_ver}/bin/hwasan_symbolize +%endif +%{_prefix}/lib/clang/%{maj_ver}/include/fuzzer +%{_prefix}/lib/clang/%{maj_ver}/include/orc +%{_prefix}/lib/clang/%{maj_ver}/include/profile +%{_prefix}/lib/clang/%{maj_ver}/include/sanitizer +%{_prefix}/lib/clang/%{maj_ver}/include/xray + +%{_prefix}/lib/clang/%{maj_ver}/share/*.txt + +# Files that appear on all targets +%{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/libclang_rt.* + +%ifnarch s390x +%{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtbegin.o +%{_prefix}/lib/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o +%endif + +%ifnarch %{ix86} s390x +%{_prefix}/lib/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}" +%{_prefix}/lib/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} +# libomptarget is not supported on 32-bit systems. +# s390x does not support the offloading plugins. +%{install_libdir}/libomptarget.so.%{so_suffix} +%endif + +%files -n %{pkg_name_libomp}-devel +%license openmp/LICENSE.TXT +%{_prefix}/lib/clang/%{maj_ver}/include/omp.h +%{_prefix}/lib/clang/%{maj_ver}/include/ompx.h +%{_prefix}/lib/clang/%{maj_ver}/include/omp-tools.h +%{_prefix}/lib/clang/%{maj_ver}/include/ompt.h +%{_prefix}/lib/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. +%{install_libdir}/libomptarget.devicertl.a +%{install_libdir}/libomptarget-amdgpu-*.bc +%{install_libdir}/libomptarget-nvptx-*.bc +%{install_libdir}/libomptarget.so +%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 %{without compat_build} +%{_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* +# 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.* +%if %{with bundle_compat_lib} +%{_libdir}/liblldb.so.%{compat_maj_ver}* +%endif + +%files -n %{pkg_name_lldb}-devel +%{install_includedir}/lldb + +%files -n python%{python3_pkgversion}-lldb +%{python3_sitearch}/lldb +%endif +#endregion LLDB files +#endregion files + +#region changelog %changelog +* Sat Nov 16 2024 Tom Stellard - 19.1.3-1 +- 19.1.3 Release + * Fri Oct 18 2024 Tom Stellard - 18.1.8-3 - Remove stray fi from postun scriptlet