compiler-rt18/compiler-rt.spec

160 lines
4.5 KiB
RPMSpec
Raw Normal View History

2023-12-05 11:03:32 +08:00
%bcond_without sys_llvm
2023-07-20 11:33:23 +08:00
%bcond_without check
%bcond_without toolchain_clang
%bcond_without bisheng_autotuner
%if %{with toolchain_clang}
%global toolchain clang
%endif
2023-07-20 11:33:23 +08:00
2023-12-05 11:03:32 +08:00
%global maj_ver 17
2023-07-20 11:33:23 +08:00
%global min_ver 0
2023-12-05 11:03:32 +08:00
%global patch_ver 6
%global crt_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global crt_srcdir compiler-rt-%{version}%{?rc_ver:rc%{rc_ver}}.src
%global optflags %(echo %{optflags} -D_DEFAULT_SOURCE)
%global optflags %(echo %{optflags} -Dasm=__asm__)
2023-07-20 11:33:23 +08:00
%if %{with sys_llvm}
%global pkg_name compiler-rt
%global install_prefix %{_prefix}
2023-12-05 11:03:32 +08:00
%global install_datadir %{_datadir}
2023-07-20 11:33:23 +08:00
%else
%global pkg_name compiler-rt%{maj_ver}
%global install_prefix %{_libdir}/llvm%{maj_ver}
2023-12-05 11:03:32 +08:00
%global install_datadir %{install_prefix}/share
2023-07-20 11:33:23 +08:00
%endif
%if 0%{?__isa_bits} == 64
%global install_libdir %{install_prefix}/lib64
%else
%global install_libdir %{install_prefix}/lib
%endif
2023-07-20 11:33:23 +08:00
Name: %{pkg_name}
Version: %{crt_version}
Release: 5
2020-07-30 19:53:18 +08:00
Summary: LLVM "compiler-rt" runtime libraries
2020-07-30 19:53:18 +08:00
License: NCSA or MIT
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz
2023-12-05 11:03:32 +08:00
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{crt_srcdir}.tar.xz.sig
2020-07-30 19:53:18 +08:00
Patch1: 0001-Backport-LoongArch-improve-the-support-for-compiler-rt.patch
2020-07-30 19:53:18 +08:00
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: ninja-build
2020-07-30 19:53:18 +08:00
BuildRequires: python3
# We need python3-devel for pathfix.py.
BuildRequires: python3-devel
%if %{with toolchain_clang}
BuildRequires: clang
%endif
2023-12-05 11:03:32 +08:00
2023-07-20 11:33:23 +08:00
%if %{with sys_llvm}
2020-07-30 19:53:18 +08:00
BuildRequires: llvm-devel = %{version}
2023-07-20 11:33:23 +08:00
BuildRequires: llvm-test = %{version}
2023-12-05 11:03:32 +08:00
BuildRequires: llvm-cmake-utils = %{version}
2023-07-20 11:33:23 +08:00
%else
BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-test = %{version}
2023-12-05 11:03:32 +08:00
BuildRequires: llvm%{maj_ver}-cmake-utils = %{version}
2023-07-20 11:33:23 +08:00
%endif
2020-02-21 17:30:31 +08:00
%description
2020-07-30 19:53:18 +08:00
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.
2020-02-21 17:30:31 +08:00
%prep
%autosetup -n %{crt_srcdir} -p2
2023-12-05 11:03:32 +08:00
# compiler-rt does not allow configuring LLVM_COMMON_CMAKE_UTILS.
ln -s %{install_datadir}/llvm/cmake ../cmake
pathfix.py -i %{__python3} -pn lib/hwasan/scripts/hwasan_symbolize
2020-07-30 19:53:18 +08:00
2020-02-21 17:30:31 +08:00
%build
2023-07-20 11:33:23 +08:00
# Copy CFLAGS into ASMFLAGS, so -fcf-protection is used when compiling assembly files.
export ASMFLAGS=$CFLAGS
2020-02-21 17:30:31 +08:00
mkdir -p _build
cd _build
2023-07-20 11:33:23 +08:00
%cmake .. \
2020-07-30 19:53:18 +08:00
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
2023-07-20 11:33:23 +08:00
-DCMAKE_MODULE_PATH=%{install_libdir}/cmake/llvm \
-DCMAKE_SKIP_RPATH:BOOL=ON \
2023-12-05 11:03:32 +08:00
-DCOMPILER_RT_INSTALL_PATH=%{install_libdir}/clang/%{maj_ver} \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
2020-02-21 17:30:31 +08:00
%if 0%{?__isa_bits} == 64
2020-07-30 19:53:18 +08:00
-DLLVM_LIBDIR_SUFFIX=64 \
2020-02-21 17:30:31 +08:00
%else
2020-07-30 19:53:18 +08:00
-DLLVM_LIBDIR_SUFFIX= \
%endif
%if "%{toolchain}" == "clang"
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
%endif
%if %{with bisheng_autotuner}
-DLLVM_ENABLE_AUTOTUNER=ON \
2020-02-21 17:30:31 +08:00
%endif
2020-07-30 19:53:18 +08:00
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on?
2020-02-21 17:30:31 +08:00
%make_build
%install
cd _build
%make_install
%check
#%%cmake_build --target check-compiler-rt
2020-02-21 17:30:31 +08:00
%files
%license LICENSE.TXT
%ifarch x86_64 aarch64 riscv64
2023-12-05 11:03:32 +08:00
%{install_libdir}/clang/%{maj_ver}/bin/*
%endif
%{install_libdir}/clang/%{maj_ver}/include/*
%{install_libdir}/clang/%{maj_ver}/lib/*
%{install_libdir}/clang/%{maj_ver}/share/*
%ifarch x86_64 aarch64 riscv64
2023-12-05 11:03:32 +08:00
%{install_libdir}/clang/%{maj_ver}/bin/hwasan_symbolize
2020-07-30 19:53:18 +08:00
%endif
2020-02-21 17:30:31 +08:00
%changelog
* Tue Aug 20 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-5
- Add BiSheng Autotuner support.
* Fri Jul 5 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-4
- Add toolchain_clang build support
* Wed Apr 03 2024 zhanglimin <zhanglimin@loongson.cn> - 17.0.6-3
- Improve the support for compiler-rt on LoongArch
* Fri Feb 23 2024 jchzhou <zhoujiacheng@iscas.ac.cn> - 17.0.6-2
- Fix an unpackaged file issue on riscv64
2023-12-05 11:03:32 +08:00
* Tue Dec 5 2023 zhoujing <zhoujing106@huawei.com> - 17.0.6-1
- Update to 17.0.6
2023-07-20 11:33:23 +08:00
* Tue Dec 20 2022 eastb233 <xiezhiheng@huawei.com> - 12.0.1-2
- Delete run path in DSO
* Mon Dec 27 2021 Chen Chen <chen_aka_jan@163.com> - 12.0.1-1
- Update to 12.0.1
* Fri Sep 25 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 10.0.1-3
- hwasan_symbolize should run in python2 and python3, and python3 is default now
* Sat Sep 19 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 10.0.1-2
- Keep "/usr/bin/env python" instead of /usr/bin/python3 in hwasan_symbolize
2020-07-30 19:53:18 +08:00
* Thu Jul 30 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 10.0.1-1
- Update to 10.0.1
2020-02-21 17:30:31 +08:00
* Thu Dec 5 2019 openEuler Buildteam <buildteam@openeuler.org> - 7.0.0-2
- Package init