2024-05-17 09:27:48 +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-
|
2024-07-15 07:13:31 +00:00
|
|
|
%global copr_snapshot_build_detected %(/bin/bash -fc 'if [[ "%{?copr_username}/%{?copr_projectname}" == @fedora-llvm-team/llvm-snapshots-* ]];
|
2024-05-17 09:27:48 +00:00
|
|
|
then
|
|
|
|
echo "yes"
|
|
|
|
else
|
|
|
|
echo "no"
|
|
|
|
fi')
|
|
|
|
|
|
|
|
%if "%{copr_snapshot_build_detected}" == "yes"
|
|
|
|
%bcond_without snapshot_build
|
|
|
|
%else
|
|
|
|
%bcond_with snapshot_build
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%global maj_ver 18
|
|
|
|
%global min_ver 1
|
|
|
|
%global patch_ver 5
|
|
|
|
|
|
|
|
%if %{with snapshot_build}
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/version.spec.inc
|
2024-05-17 09:27:48 +00:00
|
|
|
%endif
|
2022-06-13 07:22:45 +00:00
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/globals.spec.inc
|
2022-07-19 10:49:30 +00:00
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
Name: %{pkg_name_llvm}
|
2022-01-04 17:55:42 +00:00
|
|
|
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
|
2022-11-09 18:22:27 +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
|
2015-09-16 03:11:34 +00:00
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/sources.spec.inc
|
2022-11-17 09:10:57 +00:00
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/patches.spec.inc
|
|
|
|
|
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
|
2021-04-29 05:06:22 +00:00
|
|
|
BuildRequires: python3-psutil
|
2016-01-27 15:23:13 +00:00
|
|
|
BuildRequires: python3-sphinx
|
2023-05-22 15:57:51 +00:00
|
|
|
%if %{undefined rhel}
|
2023-09-26 06:58:16 +00:00
|
|
|
BuildRequires: python3-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
|
2018-08-30 21:47:59 +00:00
|
|
|
BuildRequires: python3-devel
|
2021-04-19 11:18:31 +00:00
|
|
|
BuildRequires: python3-setuptools
|
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: python3-rpm-macros
|
|
|
|
BuildRequires: python3-lit
|
|
|
|
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: python3
|
|
|
|
|
|
|
|
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-10 12:52:46 +00:00
|
|
|
# This is required because of "ModuleNotFoundError: No module named 'pexpect'" when running LLDB tests.
|
|
|
|
BuildRequires: python3-pexpect
|
|
|
|
|
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
|
|
|
%if %{without compat_build}
|
|
|
|
# For reproducible pyc file generation
|
|
|
|
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility
|
|
|
|
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
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/packages.spec.inc
|
2018-03-19 16:26:08 +00:00
|
|
|
|
2008-01-21 17:33:11 +00:00
|
|
|
%prep
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/prep.spec.inc
|
2018-08-30 21:47:59 +00:00
|
|
|
|
2008-01-21 17:33:11 +00:00
|
|
|
%build
|
2023-10-12 09:15:14 +00:00
|
|
|
%include %{_sourcedir}/build.spec.inc
|
2008-01-21 17:33:11 +00:00
|
|
|
|
|
|
|
%install
|
2023-10-12 09:15:14 +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
|
2021-07-13 20:14:17 +00:00
|
|
|
|
2024-05-08 11:03:59 +00:00
|
|
|
%ldconfig_scriptlets -n %{pkg_name-llvm}-libs
|
2011-12-05 22:44:54 +00:00
|
|
|
|
2024-07-05 19:23:26 +00:00
|
|
|
%if %{without compat_build}
|
|
|
|
%ldconfig_scriptlets -n %{pkg_name_lld}-libs
|
|
|
|
%endif
|
|
|
|
|
2024-05-06 09:00:19 +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-05-06 09:00:19 +00:00
|
|
|
%postun -n %{pkg_name_llvm}-devel
|
2024-05-08 11:04:38 +00:00
|
|
|
if [ $1 -eq 0 ]; then
|
|
|
|
%{_sbindir}/update-alternatives --remove llvm-config%{exec_suffix} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
|
2024-05-16 16:43:43 +00:00
|
|
|
fi
|
2024-05-08 11:04:38 +00:00
|
|
|
%if %{without compat_build}
|
2024-05-16 16:43:43 +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
|
|
|
|
|| "x$(%{_bindir}/llvm-config-%{maj_ver} --version | awk -F . '{ print $1 }')" != "x%{maj_ver}" ]]; then
|
2024-05-08 11:04:38 +00:00
|
|
|
%{_sbindir}/update-alternatives --remove llvm-config-%{maj_ver} %{install_bindir}/llvm-config%{exec_suffix}-%{__isa_bits}
|
|
|
|
fi
|
2024-05-16 16:43:43 +00:00
|
|
|
%endif
|
2016-02-12 20:37:19 +00:00
|
|
|
|
2023-10-12 09:15:14 +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-05-16 16:43:43 +00:00
|
|
|
%include %{_sourcedir}/changelog.spec.inc
|