2023-10-12 09:15:14 +00:00
|
|
|
# Components enabled if supported by target architecture:
|
2024-05-30 08:18:56 +00:00
|
|
|
%define gold_arches %{ix86} x86_64 aarch64 %{power64} s390x
|
2023-10-12 09:15:14 +00:00
|
|
|
%ifarch %{gold_arches}
|
|
|
|
%bcond_without gold
|
|
|
|
%else
|
|
|
|
%bcond_with gold
|
|
|
|
%endif
|
|
|
|
%bcond_with compat_build
|
|
|
|
%bcond_without check
|
|
|
|
|
2024-07-30 14:59:07 +00:00
|
|
|
# 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
|
|
|
|
|
2024-05-27 07:16:41 +00:00
|
|
|
# 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
|
|
|
|
|
2023-10-12 09:15:14 +00:00
|
|
|
# We are building with clang for faster/lower memory LTO builds.
|
|
|
|
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/#_compiler_macros
|
|
|
|
%global toolchain clang
|
|
|
|
|
|
|
|
# Opt out of https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2158587
|
|
|
|
%undefine _include_frame_pointers
|
|
|
|
|
|
|
|
# Suffixless tarball name (essentially: basename -s .tar.xz llvm-project-17.0.6.src.tar.xz)
|
2024-05-15 11:36:41 +00:00
|
|
|
%if %{with snapshot_build}
|
|
|
|
%global src_tarball_dir llvm-project-%{llvm_snapshot_git_revision}
|
2024-05-17 09:27:48 +00:00
|
|
|
%else
|
|
|
|
%global src_tarball_dir llvm-project-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src
|
2024-05-15 11:36:41 +00:00
|
|
|
%endif
|
2023-10-12 09:15:14 +00:00
|
|
|
|
|
|
|
#region LLVM globals
|
|
|
|
|
|
|
|
%if %{with compat_build}
|
|
|
|
%global pkg_name_llvm llvm%{maj_ver}
|
2024-07-31 12:38:37 +00:00
|
|
|
%global pkg_suffix %{maj_ver}
|
2023-10-12 09:15:14 +00:00
|
|
|
%global exec_suffix -%{maj_ver}
|
|
|
|
%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
|
2024-03-16 21:14:57 +00:00
|
|
|
%global install_datadir %{install_prefix}/share
|
|
|
|
%global install_libexecdir %{install_prefix}/libexec
|
|
|
|
%global install_docdir %{install_datadir}/doc
|
2024-08-01 13:23:10 +00:00
|
|
|
%global unprefixed_libdir lib
|
2024-07-31 13:54:15 +00:00
|
|
|
%global build_libdir llvm/%{_vpath_builddir}/lib
|
2023-10-12 09:15:14 +00:00
|
|
|
|
|
|
|
%global pkg_includedir %{_includedir}/%{pkg_name_llvm}
|
|
|
|
%global pkg_datadir %{install_prefix}/share
|
|
|
|
%else
|
|
|
|
%global pkg_name_llvm llvm
|
|
|
|
%global install_prefix /usr
|
|
|
|
%global install_bindir %{_bindir}
|
2024-03-16 21:14:57 +00:00
|
|
|
%global install_datadir %{_datadir}
|
2023-10-12 09:15:14 +00:00
|
|
|
%global install_libdir %{_libdir}
|
|
|
|
%global install_includedir %{_includedir}
|
2024-03-16 21:14:57 +00:00
|
|
|
%global install_libexecdir %{_libexecdir}
|
|
|
|
%global install_docdir %{_docdir}
|
2024-08-01 13:23:10 +00:00
|
|
|
%global unprefixed_libdir %{_lib}
|
2024-07-31 13:54:15 +00:00
|
|
|
%global build_libdir llvm/%{_vpath_builddir}/%{_lib}
|
2023-10-12 09:15:14 +00:00
|
|
|
%global pkg_datadir %{_datadir}
|
2024-07-31 12:38:37 +00:00
|
|
|
%global pkg_suffix %{nil}
|
2023-10-12 09:15:14 +00:00
|
|
|
%global exec_suffix %{nil}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%if 0%{?rhel}
|
|
|
|
%global targets_to_build "X86;AMDGPU;PowerPC;NVPTX;SystemZ;AArch64;ARM;Mips;BPF;WebAssembly"
|
|
|
|
%global experimental_targets_to_build ""
|
|
|
|
%else
|
|
|
|
%global targets_to_build "all"
|
|
|
|
%global experimental_targets_to_build "AVR"
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%global build_install_prefix %{buildroot}%{install_prefix}
|
|
|
|
|
|
|
|
# Lower memory usage of dwz on s390x
|
|
|
|
%global _dwz_low_mem_die_limit_s390x 1
|
|
|
|
%global _dwz_max_die_limit_s390x 1000000
|
|
|
|
|
|
|
|
%global llvm_triple %{_target_platform}
|
|
|
|
|
|
|
|
# https://fedoraproject.org/wiki/Changes/PythonSafePath#Opting_out
|
|
|
|
# Don't add -P to Python shebangs
|
|
|
|
# The executable Python scripts in /usr/share/opt-viewer/ import each other
|
|
|
|
%undefine _py3_shebang_P
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region CLANG globals
|
|
|
|
|
2024-07-31 12:55:15 +00:00
|
|
|
%global pkg_name_clang clang%{pkg_suffix}
|
2023-10-12 09:15:14 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region COMPILER-RT globals
|
|
|
|
|
2024-07-31 12:45:09 +00:00
|
|
|
%global pkg_name_compiler_rt compiler-rt%{pkg_suffix}
|
2023-10-12 09:15:14 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
#region OPENMP globals
|
|
|
|
|
2024-07-31 12:51:01 +00:00
|
|
|
%global pkg_name_libomp libomp%{pkg_suffix}
|
2023-10-12 09:15:14 +00:00
|
|
|
|
2024-03-16 20:09:57 +00:00
|
|
|
%global so_suffix %{maj_ver}.%{min_ver}
|
2023-10-12 09:15:14 +00:00
|
|
|
|
|
|
|
%if %{with snapshot_build}
|
2024-03-16 20:09:57 +00:00
|
|
|
%global so_suffix %{maj_ver}.%{min_ver}%{llvm_snapshot_version_suffix}
|
2023-10-12 09:15:14 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%ifarch ppc64le
|
|
|
|
%global libomp_arch ppc64
|
|
|
|
%else
|
|
|
|
%global libomp_arch %{_arch}
|
|
|
|
%endif
|
|
|
|
|
|
|
|
#endregion
|
2024-05-06 09:05:12 +00:00
|
|
|
|
2024-05-03 11:12:47 +00:00
|
|
|
#region LLD globals
|
2024-07-31 12:55:15 +00:00
|
|
|
%global pkg_name_lld lld%{pkg_suffix}
|
2024-05-06 09:05:12 +00:00
|
|
|
#endregion
|
2024-07-01 11:30:45 +00:00
|
|
|
|
|
|
|
#region LLDB globals
|
|
|
|
%global pkg_name_lldb lldb
|
|
|
|
#endregion
|