lld18/lld.spec

169 lines
4.6 KiB
RPMSpec
Raw Normal View History

%bcond_without sys_llvm
%bcond_without check
%bcond_with toolchain_clang
%bcond_without bisheng_autotuner
%if %{with toolchain_clang}
%global toolchain clang
%endif
2023-05-15 20:21:56 +08:00
%global maj_ver 17
2023-01-30 22:08:04 +08:00
%global min_ver 0
%global patch_ver 6
2023-05-15 20:21:56 +08:00
%if %{with sys_llvm}
%global pkg_name lld
%global install_prefix %{_prefix}
%global install_datadir %{_datadir}
%else
2023-05-15 20:21:56 +08:00
%global pkg_name lld%{maj_ver}
%global install_prefix %{_libdir}/llvm%{maj_ver}
%global install_datadir %{install_prefix}/share
%endif
2023-05-15 20:21:56 +08:00
%global install_bindir %{install_prefix}/bin
%if 0%{?__isa_bits} == 64
%global install_libdir %{install_prefix}/lib64
%else
%global install_libdir %{install_prefix}/lib
%endif
%global install_includedir %{install_prefix}/include
2023-01-30 22:08:04 +08:00
# Don't include unittests in automatic generation of provides or requires.
%global __provides_exclude_from ^%{_libdir}/lld/.*$
%global __requires_exclude ^libgtest.*$
# Disable LTO as this causes crash if gcc lto enabled.
%define _lto_cflags %{nil}
2023-05-15 20:21:56 +08:00
Name: %{pkg_name}
2023-01-30 22:08:04 +08:00
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 6
2023-01-30 22:08:04 +08:00
Summary: The LLVM Linker
License: NCSA
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/lld-%{version}.src.tar.xz
2023-05-15 20:21:56 +08:00
Patch1: fedora-PATCH-lld-Import-compact_unwind_encoding.h-from-libu.patch
Patch2: 0002-Backport-lld-LoongArch-Support-the-R_LARCH_-ADD-SUB-6-relocation-type.patch
Patch3: 0003-Backport-ELF-RISCV-Implement-emit-relocs-with-relaxation.patch
Patch4: 0004-Backport-lld-ELF-Support-relax-R_LARCH_ALIGN.patch
Patch5: 0005-Backport-lld-LoongArch-Support-the-R_LARCH_-ADD-SUB-_ULEB128-relocation-types.patch
Patch6: 0006-Add-BiSheng-Autotuner-support-for-LLVM-compiler.patch
Patch7: 0007-Backport-LoongArch-add-support-for-call36-and-extreme-relocs.patch
2023-01-30 22:08:04 +08:00
BuildRequires: clang
BuildRequires: cmake
%if %{with sys_llvm}
BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-googletest = %{version}
BuildRequires: llvm-test = %{version}
BuildRequires: llvm-cmake-utils = %{version}
%else
2023-05-15 20:21:56 +08:00
BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-googletest = %{version}
BuildRequires: llvm%{maj_ver}-test = %{version}
BuildRequires: llvm%{maj_ver}-cmake-utils = %{version}
%endif
2023-01-30 22:08:04 +08:00
BuildRequires: ncurses-devel
2023-05-15 20:21:56 +08:00
BuildRequires: ninja-build
2023-01-30 22:08:04 +08:00
BuildRequires: python3-rpm-macros
2023-05-15 20:21:56 +08:00
BuildRequires: python3-lit >= %{version}
BuildRequires: zlib-devel
2023-01-30 22:08:04 +08:00
Requires(post): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives
Requires: %{name}-libs = %{version}-%{release}
%description
The LLVM project linker.
%package devel
Summary: Libraries and header files for LLD
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description devel
This package contains library and header files needed to develop new native
programs that use the LLD infrastructure.
%package libs
Summary: LLD shared libraries
%description libs
Shared libraries for LLD.
%prep
%autosetup -n lld-%{version}.src -p2
%build
mkdir -p _build
cd _build
%cmake .. -G Ninja \
2023-05-15 20:21:56 +08:00
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
2023-01-30 22:08:04 +08:00
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_DYLIB_COMPONENTS="all" \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DPYTHON_EXECUTABLE=%{__python3} \
2023-05-15 20:21:56 +08:00
-DLLVM_INCLUDE_TESTS=ON \
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
-DLLVM_LIT_ARGS="-sv \
--path %{install_prefix}" \
-DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \
%if "%{toolchain}" == "clang"
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
%endif
%if %{with bisheng_autotuner}
-DENABLE_AUTOTUNER=ON \
%endif
-DLLVM_MAIN_SRC_DIR=%{install_prefix}/src
2023-01-30 22:08:04 +08:00
%ninja_build
%install
%ninja_install -C _build
2023-05-15 20:21:56 +08:00
rm %{buildroot}%{install_includedir}/mach-o/compact_unwind_encoding.h
2023-01-30 22:08:04 +08:00
%check
2023-05-15 20:21:56 +08:00
%if %{with check}
%ninja_build check-lld -C _build
2023-05-15 20:21:56 +08:00
%endif
2023-01-30 22:08:04 +08:00
%files
%license LICENSE.TXT
%{install_bindir}/*
2023-01-30 22:08:04 +08:00
%files devel
2023-05-15 20:21:56 +08:00
%{install_includedir}/lld
%{install_libdir}/liblld*.so
%{install_libdir}/cmake/lld/
2023-01-30 22:08:04 +08:00
%files libs
2023-05-15 20:21:56 +08:00
%{install_libdir}/liblld*.so.*
2023-01-30 22:08:04 +08:00
%changelog
* Mon Sep 23 2024 zhanglimin <zhanglimin@loongson.cn> - 17.0.6-6
- [LoongArch] Backport the support for call36 and extreme model relocs.
* Tue Jul 30 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-5
- Disable toolchain_clang build for BiSheng Autotuner support temporary.
* Tue Jul 16 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-4
- Add BiSheng Autotuner support.
* Fri Jul 5 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-3
- Add toolchain_clang build support
* Mon Mar 25 2024 zhanglimin <zhanglimin@loongson.cn> - 17.0.6-2
- Supoort `relax` feature on LoongArch
* Fri Dec 1 2023 zhoujing <zhoujing106@huawei.com> - 17.0.6-1
- Update to 17.0.6
* Thu May 25 2023 cf-zhao <zhaochuanfeng@huawei.com> - 12.0.1-1
- Package init