!12 [sync] PR-11: Bugfixes for 2203 build

From: @openeuler-sync-bot 
Reviewed-by: @liyunfei33 
Signed-off-by: @liyunfei33
This commit is contained in:
openeuler-ci-bot 2025-02-25 07:19:15 +00:00 committed by Gitee
commit 56164d83a1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 54 additions and 21 deletions

5
CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.13.4)
project(Runtimes C CXX ASM)
add_subdirectory(libcxxabi)
add_subdirectory(libcxx)
add_subdirectory(libunwind)

View File

@ -79,7 +79,7 @@
%global llvm_triple %{_host}
%global build_src_dir %{_builddir}/%{src_tarball_dir}
%if %{os_version} <= 2203
%if %{os_version} <= 2403
%global build_dir _build
%else
%global build_dir llvm/%{_vpath_builddir}
@ -149,7 +149,7 @@
#region main package
Name: llvm-toolset-%{maj_ver}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 2
Release: 3
Summary: The Low Level Virtual Machine
License: NCSA
@ -159,9 +159,7 @@ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ve
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{src_tarball_dir}.tar.xz.sig
# CMakeLists for libcxx build
%if %{maj_ver} == 17
Source2: CMakeLists.txt
%endif
Patch0001: 0001-PATCH-clang-Don-t-install-static-libraries.patch
Patch0002: 0002-Always-build-shared-libs-for-LLD.patch
@ -184,7 +182,7 @@ BuildRequires: python3-devel
BuildRequires: python3-psutil
BuildRequires: python3-sphinx
BuildRequires: python3-setuptools
%if %{maj_ver} >= 18
%if %{maj_ver} >= 18 && %{os_version} > 2203
BuildRequires: python3-myst-parser
%endif
%if %{with toolchain_clang}
@ -807,17 +805,22 @@ export ASMFLAGS="%{build_cflags}"
# Add all *enabled* documentation targets (no doxygen but sphinx)
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\
-DLLVM_ENABLE_SPHINX:BOOL=ON \\\
-DLLVM_BUILD_DOCS:BOOL=ON
%if %{os_version} <= 2203 && %{maj_ver} >= 18
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_ENABLE_SPHINX:BOOL=OFF
%else
# Configure sphinx:
# Build man-pages but no HTML docs using sphinx
%global cmake_config_args %{cmake_config_args} \\\
-DLLVM_ENABLE_SPHINX:BOOL=ON \\\
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \\\
-DSPHINX_OUTPUT_HTML:BOOL=OFF \\\
-DSPHINX_OUTPUT_MAN:BOOL=ON \\\
-DSPHINX_WARNINGS_AS_ERRORS=OFF
#endregion docs options
%endif
#region lldb options
%if %{with lldb}
@ -881,7 +884,7 @@ export ASMFLAGS="%{build_cflags}"
-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \\\
-DLLVM_INSTALL_UTILS:BOOL=ON \\\
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \\\
-DLLVM_PARALLEL_LINK_JOBS=1 \\\
-DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \\\
-DLLVM_TOOLS_INSTALL_DIR:PATH=bin \\\
-DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \\\
-DLLVM_UTILS_INSTALL_DIR:PATH=bin
@ -964,7 +967,7 @@ export ASMFLAGS="%{build_cflags}"
extra_cmake_args=''
#endregion cmake options
%if %{os_version} <= 2203
%if %{os_version} <= 2403
mkdir _build
cd _build
%define __cmake_in_source_build 1
@ -997,7 +1000,7 @@ cd llvm
# /usr/lib64/libomptarget-amdgpu-*.bc
# /usr/lib64/libomptarget-nvptx-*.bc
%if %{maj_ver} >= 18
%if %{os_version} >= 2403
%build_tool %cmake_target_opts runtimes
@ -1037,10 +1040,15 @@ cd %{build_src_dir}/_build_libcxx
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
-DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=ON \
-DLLVM_BUILD_DOCS=ON \
%if %{os_version} <= 2203 && %{maj_ver} >= 18
-DLLVM_ENABLE_SPHINX=OFF \
%else
-DLLVM_ENABLE_SPHINX=ON \
-DLIBUNWIND_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \
%endif
-DLIBUNWIND_INCLUDE_DOCS=ON \
-DLIBUNWIND_INSTALL_INCLUDE_DIR=%{install_includedir}/llvm-libunwind \
-DLIBUNWIND_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF \
-DCMAKE_SKIP_RPATH:BOOL=ON
%build_tool
#endregion libcxx build
@ -1111,7 +1119,7 @@ cd %{build_src_dir}/_build_compiler-rt
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on?
%if %{os_version} <= 2203
%if %{os_version} <= 2403
%make_build
%else
%build_tool
@ -1125,7 +1133,7 @@ cd %{build_src_dir}
%install
#region LLVM installation
%if %{os_version} <= 2203
%if %{os_version} <= 2403
cd %{build_src_dir}/%{build_dir}
%else
cd %{build_src_dir}/llvm
@ -1133,7 +1141,7 @@ cd %{build_src_dir}/llvm
%install_tool
%if %{maj_ver} <= 17
%if %{os_version} <= 2203
cd %{build_src_dir}/_build_libcxx
%install_tool
@ -1141,17 +1149,17 @@ cd %{build_src_dir}/_build_openmp
%install_tool
cd %{build_src_dir}/_build_compiler-rt
%if %{os_version} > 2203
%if %{os_version} > 2403
%install_tool
%else
%make_install
%endif
rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtbegin.o
rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtend.o
rm %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libclang_rt.builtins.a
%endif
rm -Rvf %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtbegin.o
rm -Rvf %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/clang_rt.crtend.o
rm -Rvf %{build_install_prefix}/lib/clang/%{maj_ver}/lib/%{llvm_triple}/libclang_rt.builtins.a
cd %{build_src_dir}
mkdir -p %{buildroot}/%{_bindir}
@ -1353,8 +1361,12 @@ rm -rf %{buildroot}/%{install_datadir}/gdb
%ifnarch %{ix86}
# Remove files that we don't package, yet.
%if %{os_version} > 2203
%if %{os_version} >= 2403
%if %{maj_ver} >= 20
rm %{buildroot}%{install_bindir}/llvm-offload-device-info
%else
rm %{buildroot}%{install_bindir}/llvm-omp-device-info
%endif
rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
%endif
%endif
@ -1916,6 +1928,7 @@ fi
%license llvm/LICENSE.TXT
%{_scl_scripts}/enable
%{install_bindir}/sudo
%if %{os_version} > 2203
%exclude %{_mandir}/man1/llvm-config*
%{_mandir}/man1/bugpoint%{exec_suffix}.1.gz
@ -1978,6 +1991,7 @@ fi
%if %{maj_ver} <= 17
%{_mandir}/man1/llvm-remark-size-diff%{exec_suffix}.1.gz
%endif
%endif
%{install_bindir}/bugpoint
%{install_bindir}/dsymutil
@ -2218,7 +2232,9 @@ fi
%ghost %{_bindir}/llvm-config-%{maj_ver}
%{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits}
%if %{os_version} > 2203
%{_mandir}/man1/llvm-config*
%endif
%{install_includedir}/llvm
%{install_includedir}/llvm-c
%{install_libdir}/libLLVM.so
@ -2281,12 +2297,17 @@ fi
%{install_bindir}/clang++-%{maj_ver}
%{install_bindir}/clang-cl
%{install_bindir}/clang-cpp
%{_mandir}/man1/clang-%{maj_ver}.1.gz
%{_mandir}/man1/clang++-%{maj_ver}.1.gz
%if %{os_version} > 2203
%{_mandir}/man1/clang-%{maj_ver}.1.gz
%endif
%if %{with sys_llvm}
%if %{os_version} > 2203
%{_mandir}/man1/clang.1.gz
%endif
%{_mandir}/man1/clang++.1.gz
%else
%endif
%if %{without sys_llvm}
%{_bindir}/clang-%{maj_ver}
%{_bindir}/clang++-%{maj_ver}
%{_bindir}/clang-cl-%{maj_ver}
@ -2431,8 +2452,10 @@ fi
%endif
%{_emacs_sitestartdir}/clang-include-fixer.el
%endif
%if %{os_version} > 2203
%{_mandir}/man1/diagtool%{exec_suffix}.1.gz
%{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz
%endif
%{install_datadir}/clang/clang-format.py*
%{install_datadir}/clang/clang-format-diff.py*
%{install_datadir}/clang/clang-include-fixer.py*
@ -2616,8 +2639,10 @@ fi
%{install_libdir}/liblldb*.so
%{install_libdir}/liblldb.so.*
%{install_libdir}/liblldbIntelFeatures.so.*
%if %{os_version} > 2203
%{_mandir}/man1/lldb-server%{exec_suffix}.1.gz
%{_mandir}/man1/lldb%{exec_suffix}.1.gz
%endif
%if %{with bundle_compat_lib}
%{_libdir}/liblldb.so.%{compat_maj_ver}*
%endif
@ -2763,6 +2788,9 @@ fi
#endregion files
%changelog
* Mon Feb 10 2025 liyunfei <liyunfei33@huawei.com> - 18.1.8-3
- Bugfixes for 2203 build
* Mon Feb 17 2025 laokz <zhangkai@iscas.ac.cn> - 18.1.8-2
- riscv64: exclude packaging non-supported liborc_rt.a