Bugfixes for 2203 build

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