!55 adopt to new cmake macro

From: @fundawang 
Reviewed-by: @liyunfei33 
Signed-off-by: @liyunfei33
This commit is contained in:
openeuler-ci-bot 2024-11-29 06:39:06 +00:00 committed by Gitee
commit e4a863997f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 24 additions and 27 deletions

View File

@ -1,6 +1,6 @@
%bcond_without sys_llvm
%bcond_with check
%bcond_without toolchain_clang
%bcond_with toolchain_clang
%if %{with toolchain_clang}
%global toolchain clang
@ -27,9 +27,9 @@
Name: %{pkg_name}
Version: %{bolt_version}
Release: 2
Release: 3
Summary: BOLT is a post-link optimizer developed to speed up large applications
License: Apache 2.0
License: Apache-2.0
URL: https://github.com/llvm/llvm-project/tree/main/bolt
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{bolt_version}/%{bolt_srcdir}.tar.xz
@ -99,45 +99,32 @@ Documentation for the BOLT optimizer
# Set LD_LIBRARY_PATH now because we skip rpath generation and the build uses
# some just built libraries.
export LD_LIBRARY_PATH=%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}
%ninja_build bolt
export LD_LIBRARY_PATH=%{_builddir}/%{bolt_srcdir}/%{__cmake_builddir}/%{_lib}
%cmake_build --target bolt
%install
%ninja_install bolt
# Remove extera llvm files.
find %{buildroot}%{install_prefix} \
! -name "llvm-bolt" \
! -name "merge-fdata" \
! -name "perf2bolt" \
! -name "llvm-boltdiff" \
! -name "llvm-bolt-heatmap" \
! -name "libbolt_rt_hugify.a" \
! -name "libbolt_rt_instr.a" \
-type f,l -exec rm -f '{}' \;
%cmake_install --component bolt
# Remove files installed during the build phase.
rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a
rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{__cmake_builddir}/%{_lib}/lib*.a
# There currently is not support upstream for building html doc from BOLT
install -d %{buildroot}%{install_docdir}
mv bolt/README.md bolt/docs/*.md %{buildroot}%{install_docdir}
%check
%if %{with check}
%check
%ifarch aarch64
# Failing test cases on aarch64
rm bolt/test/cache+-deprecated.test bolt/test/bolt-icf.test bolt/test/R_ABS.pic.lld.cpp
%endif
export LD_LIBRARY_PATH=%{_builddir}/%{bolt_srcdir}//%{_vpath_builddir}/%{_lib}
export LD_LIBRARY_PATH=%{_builddir}/%{bolt_srcdir}//%{__cmake_builddir}/%{_lib}
export DESTDIR=%{buildroot}
%ninja_build check-bolt
%cmake_build --target check-bolt
# Remove files installed during the check phase.
rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a
rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{__cmake_builddir}/%{_lib}/lib*.a
%endif
%files
@ -151,15 +138,21 @@ rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a
%ifarch x86_64
%{install_libdir}/libbolt_rt_hugify.a
%{install_libdir}/libbolt_rt_instr.a
%if %{with toolchain_clang}
%{install_libdir}/libbolt_rt_instr_osx.a
%endif
%endif
%exclude %{_builddir}/%{bolt_srcdir}/lib/*
%files doc
%doc %{install_docdir}
%changelog
* Tue Nov 12 2024 Funda Wang <fundawang@yeah.net> - 17.0.6-3
- adopt to new cmake macro
- build with gcc now, as llvm/clang will produce linking error
against libLLVMTableGen.a now
* Fri Jul 5 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-2
- Add toolchain_clang build support

4
llvm-bolt.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: llvm/llvm-project
tag_prefix: ^llvmorg-
separator: .