2024-08-28 11:21:20 +00:00
|
|
|
# We assume that we're building a snapshot if the if the build happens
|
|
|
|
# in Copr and the project has this prefix: @fedora-llvm-team/llvm-snapshots-
|
|
|
|
%global copr_snapshot_build_detected %(/bin/bash -fc 'if [[ "%{?copr_username}/%{?copr_projectname}" == @fedora-llvm-team/llvm-snapshots-* ]];
|
|
|
|
then
|
|
|
|
echo "yes"
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
fi')
|
|
|
|
|
|
|
|
%if "%{copr_snapshot_build_detected}" == "yes"
|
|
|
|
%bcond_without snapshot_build
|
2023-08-17 12:59:30 +00:00
|
|
|
%else
|
2024-08-28 11:21:20 +00:00
|
|
|
%bcond_with snapshot_build
|
2023-08-17 12:59:30 +00:00
|
|
|
%endif
|
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%global maj_ver 19
|
2024-02-02 02:19:34 +00:00
|
|
|
%global min_ver 1
|
2024-08-28 11:21:20 +00:00
|
|
|
%global patch_ver 0
|
|
|
|
%global rc_ver 3
|
2023-08-09 14:47:38 +00:00
|
|
|
|
|
|
|
%if %{with snapshot_build}
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/version.spec.inc
|
2023-08-09 14:47:38 +00:00
|
|
|
%endif
|
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/globals.spec.inc
|
2022-07-19 10:49:30 +00:00
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
Name: %{pkg_name_llvm}
|
2023-11-24 17:14:14 +00:00
|
|
|
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
|
2024-08-28 11:21:20 +00:00
|
|
|
Release: 1%{?dist}
|
2016-01-27 15:23:13 +00:00
|
|
|
Summary: The Low Level Virtual Machine
|
2013-03-08 10:41:56 +00:00
|
|
|
|
2023-01-19 19:45:58 +00:00
|
|
|
License: Apache-2.0 WITH LLVM-exception OR NCSA
|
2016-01-27 15:23:13 +00:00
|
|
|
URL: http://llvm.org
|
2023-08-14 21:40:54 +00:00
|
|
|
|
2024-07-22 08:24:04 +00:00
|
|
|
%if %{with snapshot_build}
|
|
|
|
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}}/%{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
|
2024-08-28 11:21:20 +00:00
|
|
|
Source6: release-keys.asc
|
2022-11-17 09:10:57 +00:00
|
|
|
|
2024-07-22 08:24:04 +00:00
|
|
|
%if %{without compat_build}
|
|
|
|
Source2005: macros.%{pkg_name_clang}
|
|
|
|
%endif
|
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%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
|
|
|
|
|
2024-07-22 08:24:04 +00:00
|
|
|
# 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
|
|
|
|
Source1001: build.spec.inc
|
|
|
|
Source1002: changelog.spec.inc
|
|
|
|
Source1003: check.spec.inc
|
|
|
|
Source1004: files.spec.inc
|
|
|
|
Source1005: globals.spec.inc
|
|
|
|
Source1006: install.spec.inc
|
|
|
|
Source1007: prep.spec.inc
|
|
|
|
Source1008: packages.spec.inc
|
|
|
|
|
|
|
|
#region CLANG patches
|
|
|
|
Patch2001: 0001-PATCH-clang-Make-funwind-tables-the-default-on-all-a.patch
|
|
|
|
Patch2002: 0003-PATCH-clang-Don-t-install-static-libraries.patch
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
# Workaround a bug in ORC on ppc64le.
|
|
|
|
# More info is available here: https://reviews.llvm.org/D159115#4641826
|
|
|
|
Patch2005: 0001-Workaround-a-bug-in-ORC-on-ppc64le.patch
|
|
|
|
|
|
|
|
#region LLD patches
|
|
|
|
Patch3002: 0001-Always-build-shared-libs-for-LLD.patch
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region RHEL patches
|
|
|
|
# All RHEL
|
|
|
|
Patch9001: 0001-Remove-myst_parser-dependency-for-RHEL.patch
|
2024-08-28 11:21:20 +00:00
|
|
|
|
2024-07-22 08:24:04 +00:00
|
|
|
# RHEL 8 only
|
2024-08-28 11:21:20 +00:00
|
|
|
#Patch9002: 0001-Fix-page-size-constant-on-aarch64-and-ppc64le.patch
|
2024-07-22 08:24:04 +00:00
|
|
|
#endregion
|
2023-10-12 09:15:14 +00:00
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%if 0%{?rhel} == 8
|
|
|
|
%global python3_pkgversion 3.12
|
|
|
|
%global __python3 /usr/bin/python3.12
|
|
|
|
%endif
|
|
|
|
|
2018-12-04 15:10:41 +00:00
|
|
|
BuildRequires: gcc
|
|
|
|
BuildRequires: gcc-c++
|
2021-04-23 21:10:27 +00:00
|
|
|
BuildRequires: clang
|
2016-01-27 15:23:13 +00:00
|
|
|
BuildRequires: cmake
|
2018-03-08 23:40:31 +00:00
|
|
|
BuildRequires: ninja-build
|
2016-01-27 15:23:13 +00:00
|
|
|
BuildRequires: zlib-devel
|
2018-12-04 15:10:41 +00:00
|
|
|
BuildRequires: libffi-devel
|
2016-06-07 09:36:38 +00:00
|
|
|
BuildRequires: ncurses-devel
|
2024-08-28 11:21:20 +00:00
|
|
|
# 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.
|
2016-01-27 15:23:13 +00:00
|
|
|
BuildRequires: python3-sphinx
|
2024-08-28 11:21:20 +00:00
|
|
|
%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
|
2023-05-22 15:57:51 +00:00
|
|
|
%if %{undefined rhel}
|
2024-08-28 11:21:20 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-myst-parser
|
2023-05-22 15:57:51 +00:00
|
|
|
%endif
|
2023-10-12 09:15:14 +00:00
|
|
|
# Needed for %%multilib_fix_c_header
|
2017-04-03 19:24:44 +00:00
|
|
|
BuildRequires: multilib-rpm-config
|
2012-02-24 09:59:11 +00:00
|
|
|
%if %{with gold}
|
2018-12-04 15:10:41 +00:00
|
|
|
BuildRequires: binutils-devel
|
2012-02-24 09:59:11 +00:00
|
|
|
%endif
|
2018-08-28 05:46:20 +00:00
|
|
|
%ifarch %{valgrind_arches}
|
2017-08-25 13:40:02 +00:00
|
|
|
# Enable extra functionality when run the LLVM JIT under valgrind.
|
2018-12-04 15:10:41 +00:00
|
|
|
BuildRequires: valgrind-devel
|
2018-08-28 05:46:20 +00:00
|
|
|
%endif
|
2017-09-08 23:45:30 +00:00
|
|
|
# LLVM's LineEditor library will use libedit if it is available.
|
2018-12-04 15:10:41 +00:00
|
|
|
BuildRequires: libedit-devel
|
2021-09-23 12:47:00 +00:00
|
|
|
# We need python3-devel for %%py3_shebang_fix
|
2024-08-28 11:21:20 +00:00
|
|
|
BuildRequires: python%{python3_pkgversion}-devel
|
|
|
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
|
|
|
%if 0%{?rhel} == 8
|
|
|
|
BuildRequires: python%{python3_pkgversion}-rpm-macros
|
|
|
|
%endif
|
2008-01-21 17:33:11 +00:00
|
|
|
|
2024-07-02 21:15:43 +00:00
|
|
|
# For gpg source verification
|
2020-07-13 12:27:26 +00:00
|
|
|
BuildRequires: gnupg2
|
|
|
|
|
2024-07-02 21:15:43 +00:00
|
|
|
BuildRequires: swig
|
|
|
|
BuildRequires: libxml2-devel
|
|
|
|
BuildRequires: doxygen
|
|
|
|
|
|
|
|
# For clang-offload-packager
|
|
|
|
BuildRequires: elfutils-libelf-devel
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-Data-Dumper
|
|
|
|
BuildRequires: perl-Encode
|
|
|
|
BuildRequires: libffi-devel
|
|
|
|
|
|
|
|
BuildRequires: perl-generators
|
|
|
|
|
|
|
|
# According to https://fedoraproject.org/wiki/Packaging:Emacs a package
|
|
|
|
# should BuildRequires: emacs if it packages emacs integration files.
|
|
|
|
BuildRequires: emacs
|
|
|
|
|
|
|
|
BuildRequires: libatomic
|
|
|
|
|
|
|
|
# scan-build uses these perl modules so they need to be installed in order
|
|
|
|
# to run the tests.
|
|
|
|
BuildRequires: perl(Digest::MD5)
|
|
|
|
BuildRequires: perl(File::Copy)
|
|
|
|
BuildRequires: perl(File::Find)
|
|
|
|
BuildRequires: perl(File::Path)
|
|
|
|
BuildRequires: perl(File::Temp)
|
|
|
|
BuildRequires: perl(FindBin)
|
|
|
|
BuildRequires: perl(Hash::Util)
|
|
|
|
BuildRequires: perl(lib)
|
|
|
|
BuildRequires: perl(Term::ANSIColor)
|
|
|
|
BuildRequires: perl(Text::ParseWords)
|
|
|
|
BuildRequires: perl(Sys::Hostname)
|
|
|
|
|
|
|
|
BuildRequires: graphviz
|
|
|
|
|
2024-07-05 19:19:24 +00:00
|
|
|
# This is required because we need "ps" when running LLDB tests
|
|
|
|
BuildRequires: procps-ng
|
|
|
|
|
2024-07-02 21:15:43 +00:00
|
|
|
# For reproducible pyc file generation
|
|
|
|
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility
|
2024-07-16 10:29:26 +00:00
|
|
|
# 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
|
2024-07-02 21:15:43 +00:00
|
|
|
BuildRequires: /usr/bin/marshalparser
|
|
|
|
%global py_reproducible_pyc_path %{buildroot}%{python3_sitelib}
|
|
|
|
%endif
|
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
|
2008-01-21 17:33:11 +00:00
|
|
|
|
2019-07-18 03:50:40 +00:00
|
|
|
Provides: llvm(major) = %{maj_ver}
|
|
|
|
|
2016-01-27 15:23:13 +00:00
|
|
|
%description
|
|
|
|
LLVM is a compiler infrastructure designed for compile-time, link-time,
|
|
|
|
runtime, and idle-time optimization of programs from arbitrary programming
|
|
|
|
languages. The compiler infrastructure includes mirror sets of programming
|
|
|
|
tools as well as libraries with equivalent functionality.
|
2008-01-21 17:33:11 +00:00
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/packages.spec.inc
|
2024-07-04 20:29:05 +00:00
|
|
|
|
2008-01-21 17:33:11 +00:00
|
|
|
%prep
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/prep.spec.inc
|
2018-08-30 21:47:59 +00:00
|
|
|
|
2008-01-21 17:33:11 +00:00
|
|
|
%build
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/build.spec.inc
|
2008-01-21 17:33:11 +00:00
|
|
|
|
|
|
|
%install
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/install.spec.inc
|
2022-11-09 18:22:27 +00:00
|
|
|
|
2011-08-01 16:50:42 +00:00
|
|
|
%check
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/check.spec.inc
|
2011-12-05 22:44:54 +00:00
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%ldconfig_scriptlets -n %{pkg_name-llvm}-libs
|
2023-11-10 21:58:54 +00:00
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%if %{without compat_build}
|
|
|
|
%ldconfig_scriptlets -n %{pkg_name_lld}-libs
|
2021-07-13 20:14:17 +00:00
|
|
|
%endif
|
2024-08-28 11:21:20 +00:00
|
|
|
|
|
|
|
%post -n %{pkg_name_llvm}-devel
|
2024-05-08 11:04:38 +00:00
|
|
|
%{_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}
|
2024-05-16 16:43:43 +00:00
|
|
|
|
|
|
|
# During the upgrade from LLVM 16 (F38) to LLVM 17 (F39), we found out the
|
|
|
|
# main llvm-devel package was leaving entries in the alternatives system.
|
|
|
|
# Try to remove them now.
|
|
|
|
for v in 14 15 16; do
|
|
|
|
if [[ -e %{_bindir}/llvm-config-$v
|
|
|
|
&& "x$(%{_bindir}/llvm-config-$v --version | awk -F . '{ print $1 }')" != "x$v" ]]; then
|
|
|
|
%{_sbindir}/update-alternatives --remove llvm-config-$v %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
|
|
|
|
fi
|
|
|
|
done
|
2024-05-08 11:04:38 +00:00
|
|
|
%endif
|
2011-08-01 16:50:42 +00:00
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%postun -n %{pkg_name_llvm}-devel
|
2017-03-23 10:39:17 +00:00
|
|
|
if [ $1 -eq 0 ]; then
|
2024-08-28 11:21:20 +00:00
|
|
|
%{_sbindir}/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
|
2023-11-10 21:58:54 +00:00
|
|
|
fi
|
2021-07-13 20:14:17 +00:00
|
|
|
%if %{without compat_build}
|
2023-11-10 21:58:54 +00:00
|
|
|
# When upgrading between minor versions (i.e. from x.y.1 to x.y.2), we must
|
|
|
|
# not remove the alternative.
|
|
|
|
# However, during a major version upgrade (i.e. from 16.x.y to 17.z.w), the
|
|
|
|
# alternative must be removed in order to give priority to a newly installed
|
|
|
|
# compat package.
|
|
|
|
if [[ $1 -eq 0
|
2024-08-28 11:21:20 +00:00
|
|
|
|| "x$(%{_bindir}/llvm-config-%{maj_ver} --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}
|
2017-03-23 10:39:17 +00:00
|
|
|
fi
|
2023-11-10 21:58:54 +00:00
|
|
|
%endif
|
2011-08-01 16:50:42 +00:00
|
|
|
|
2024-02-07 19:36:02 +00:00
|
|
|
%if %{without compat_build}
|
2024-08-02 10:26:55 +00:00
|
|
|
%post -n %{pkg_name_lld}
|
|
|
|
%{_sbindir}/update-alternatives --install %{_bindir}/ld ld %{_bindir}/ld.lld 1
|
2009-09-07 06:59:47 +00:00
|
|
|
|
2024-08-02 10:26:55 +00:00
|
|
|
%postun -n %{pkg_name_lld}
|
|
|
|
if [ $1 -eq 0 ] ; then
|
|
|
|
%{_sbindir}/update-alternatives --remove ld %{_bindir}/ld.lld
|
|
|
|
fi
|
2024-07-04 20:29:05 +00:00
|
|
|
%endif
|
|
|
|
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/files.spec.inc
|
2018-03-19 16:26:08 +00:00
|
|
|
|
2008-01-21 17:33:11 +00:00
|
|
|
%changelog
|
2024-08-28 11:21:20 +00:00
|
|
|
%include %{_sourcedir}/changelog.spec.inc
|