From 1291afde5782de79461f4023054832e4770b566d Mon Sep 17 00:00:00 2001 From: liyunfei Date: Fri, 25 Apr 2025 17:35:54 +0800 Subject: [PATCH 1/5] replace os_version with dist (cherry picked from commit 2a54d91fb7afe331923024a0c8137891fbe31d17) --- llvm-toolset-18.spec | 50 +++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/llvm-toolset-18.spec b/llvm-toolset-18.spec index 98cbc27..b2f1413 100644 --- a/llvm-toolset-18.spec +++ b/llvm-toolset-18.spec @@ -4,19 +4,21 @@ %global min_ver 1 %global patch_ver 8 -%global os_version %{lua: print(tonumber(rpm.expand("%{dist}"):match("oe(%d+)") or 9999))} +%if "%dist" == "%nil" +%global dist .oe2403 +%endif # Build sys_llvm packages or compat packages %bcond_with sys_llvm %bcond_with check -%if %{os_version} <= 2203 +%if "%dist" < ".oe2403" %bcond_with toolchain_clang %else %bcond_without toolchain_clang %endif # mlir requires pybind11-2.9 but 22.03 only have pybind11-2.8 -%if %{os_version} <= 2203 +%if "%dist" < ".oe2403" %bcond_with mlir %else %bcond_without mlir @@ -79,7 +81,7 @@ %global llvm_triple %{_host} %global build_src_dir %{_builddir}/%{src_tarball_dir} -%if %{os_version} <= 2403 +%if "%dist" < ".oe2503" %global build_dir _build %else %global build_dir llvm/%{_vpath_builddir} @@ -149,7 +151,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 6 +Release: 7 Summary: The Low Level Virtual Machine License: NCSA @@ -182,7 +184,7 @@ BuildRequires: python3-devel BuildRequires: python3-psutil BuildRequires: python3-sphinx BuildRequires: python3-setuptools -%if %{maj_ver} >= 18 && %{os_version} > 2203 +%if %{maj_ver} >= 18 && "%dist" >= ".oe2403" BuildRequires: python3-myst-parser %endif %if %{with toolchain_clang} @@ -813,7 +815,7 @@ export ASMFLAGS="%{build_cflags}" -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\ -DLLVM_BUILD_DOCS:BOOL=ON -%if %{os_version} <= 2203 && %{maj_ver} >= 18 +%if "%dist" < ".oe2403" && %{maj_ver} >= 18 %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_ENABLE_SPHINX:BOOL=OFF %else @@ -973,7 +975,7 @@ export ASMFLAGS="%{build_cflags}" extra_cmake_args='' #endregion cmake options -%if %{os_version} <= 2403 +%if "%dist" < ".oe2503" mkdir _build cd _build %define __cmake_in_source_build 1 @@ -1006,7 +1008,7 @@ cd llvm # /usr/lib64/libomptarget-amdgpu-*.bc # /usr/lib64/libomptarget-nvptx-*.bc -%if %{os_version} >= 2403 +%if "%dist" >= ".oe2403" %build_tool %cmake_target_opts runtimes @@ -1046,7 +1048,7 @@ 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 +%if "%dist" < ".oe2403" && %{maj_ver} >= 18 -DLLVM_ENABLE_SPHINX=OFF \ %else -DLLVM_ENABLE_SPHINX=ON \ @@ -1125,7 +1127,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} <= 2403 +%if "%dist" < ".oe2409" %make_build %else %build_tool @@ -1139,7 +1141,7 @@ cd %{build_src_dir} %install #region LLVM installation -%if %{os_version} <= 2403 +%if "%dist" < ".oe2409" cd %{build_src_dir}/%{build_dir} %else cd %{build_src_dir}/llvm @@ -1147,7 +1149,7 @@ cd %{build_src_dir}/llvm %install_tool -%if %{os_version} <= 2203 +%if "%dist" < ".oe2403" cd %{build_src_dir}/_build_libcxx %install_tool @@ -1155,12 +1157,8 @@ cd %{build_src_dir}/_build_openmp %install_tool cd %{build_src_dir}/_build_compiler-rt -%if %{os_version} > 2403 -%install_tool -%else %make_install %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 @@ -1367,7 +1365,7 @@ rm -rf %{buildroot}/%{install_datadir}/gdb %ifnarch %{ix86} # Remove files that we don't package, yet. -%if %{os_version} >= 2403 +%if "%dist" >= ".oe2403" %if %{maj_ver} >= 20 rm %{buildroot}%{install_bindir}/llvm-offload-device-info %else @@ -1922,7 +1920,7 @@ fi %files -n %{pkg_name_llvm} %license llvm/LICENSE.TXT -%if %{os_version} > 2203 +%if "%dist" >= ".oe2403" %exclude %{_mandir}/man1/llvm-config* %{_mandir}/man1/bugpoint%{exec_suffix}.1.gz @@ -2226,7 +2224,7 @@ fi %ghost %{_bindir}/llvm-config-%{maj_ver} %{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%if %{os_version} > 2203 +%if "%dist" >= ".oe2403" %{_mandir}/man1/llvm-config* %endif %{install_includedir}/llvm @@ -2292,11 +2290,11 @@ fi %{install_bindir}/clang-cl %{install_bindir}/clang-cpp %{_mandir}/man1/clang++-%{maj_ver}.1.gz -%if %{os_version} > 2203 +%if "%dist" >= ".oe2403" %{_mandir}/man1/clang-%{maj_ver}.1.gz %endif %if %{with sys_llvm} -%if %{os_version} > 2203 +%if "%dist" >= ".oe2403" %{_mandir}/man1/clang.1.gz %endif %{_mandir}/man1/clang++.1.gz @@ -2446,7 +2444,7 @@ fi %endif %{_emacs_sitestartdir}/clang-include-fixer.el %endif -%if %{os_version} > 2203 +%if "%dist" >= ".oe2403" %{_mandir}/man1/diagtool%{exec_suffix}.1.gz %{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz %endif @@ -2633,7 +2631,7 @@ fi %{install_libdir}/liblldb*.so %{install_libdir}/liblldb.so.* %{install_libdir}/liblldbIntelFeatures.so.* -%if %{os_version} > 2203 +%if "%dist" >= ".oe2403" %{_mandir}/man1/lldb-server%{exec_suffix}.1.gz %{_mandir}/man1/lldb%{exec_suffix}.1.gz %endif @@ -2786,6 +2784,10 @@ fi #endregion files %changelog +* Tue Jun 10 2025 liyunfei - 18.1.8-7 +- replace os_version with dist +- default dist to .oe2403 + * Fri May 16 2025 Wenlong Zhang - 18.1.8-6 - Fix libomptarget.rtl.amdgpu|cuda|loonarch64.so file not found -- Gitee From 2ad6780b37c66cb8130dc82f2653d338d1f3c7b3 Mon Sep 17 00:00:00 2001 From: wangqiang Date: Mon, 13 Oct 2025 13:47:52 +0800 Subject: [PATCH 2/5] Replaced the hardcoded /opt/openEuler path with /opt/\%{_vendor} (cherry picked from commit f7e7676bb6d8146ff0387d92baad17bc9739bbff) --- llvm-toolset-18.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm-toolset-18.spec b/llvm-toolset-18.spec index b2f1413..d98a413 100644 --- a/llvm-toolset-18.spec +++ b/llvm-toolset-18.spec @@ -50,7 +50,7 @@ %global pkg_suffix %{nil} %global exec_suffix %{nil} %else -%global _scl_prefix /opt/openEuler +%global _scl_prefix /opt/%{_vendor} %{?scl:%scl_package %scl} %{!?scl:%global scl_prefix llvm-toolset-%{maj_ver}-} %{!?scl:%global pkg_name %{name}} @@ -149,9 +149,9 @@ #region packages #region main package -Name: llvm-toolset-%{maj_ver} +Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 7 +Release: 8 Summary: The Low Level Virtual Machine License: NCSA @@ -2784,6 +2784,9 @@ fi #endregion files %changelog +* Mon Oct 13 2025 Wang Qiang - 18.1.8-8 +- Replaced the hardcoded /opt/openEuler path with /opt/\%{_vendor} + * Tue Jun 10 2025 liyunfei - 18.1.8-7 - replace os_version with dist - default dist to .oe2403 -- Gitee From ab53909df0fa06bab1af64441cd8551cd4606efb Mon Sep 17 00:00:00 2001 From: liyunfei Date: Wed, 15 Oct 2025 11:32:55 +0800 Subject: [PATCH 3/5] Revert "replace os_version with dist" & default os_version to 9999 This reverts commit 76b235ab2fe5efbc04473054c467f218d67ac1c7. (cherry picked from commit f6e34670dd37a35e8cdf487567f49e0dcb122236) --- llvm-toolset-18.spec | 53 ++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/llvm-toolset-18.spec b/llvm-toolset-18.spec index d98a413..e4487e7 100644 --- a/llvm-toolset-18.spec +++ b/llvm-toolset-18.spec @@ -4,21 +4,24 @@ %global min_ver 1 %global patch_ver 8 -%if "%dist" == "%nil" -%global dist .oe2403 +%global os_version %{lua: print(tonumber(rpm.expand("%{dist}"):match("oe(%d+)") or 9999))} + +# workaround for `dist` of oE master branch changing to .oe1 +%if %{os_version} == 1 +%global os_version 9999 %endif # Build sys_llvm packages or compat packages %bcond_with sys_llvm %bcond_with check -%if "%dist" < ".oe2403" +%if %{os_version} <= 2203 %bcond_with toolchain_clang %else %bcond_without toolchain_clang %endif # mlir requires pybind11-2.9 but 22.03 only have pybind11-2.8 -%if "%dist" < ".oe2403" +%if %{os_version} <= 2203 %bcond_with mlir %else %bcond_without mlir @@ -81,7 +84,7 @@ %global llvm_triple %{_host} %global build_src_dir %{_builddir}/%{src_tarball_dir} -%if "%dist" < ".oe2503" +%if %{os_version} <= 2403 %global build_dir _build %else %global build_dir llvm/%{_vpath_builddir} @@ -151,7 +154,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 8 +Release: 9 Summary: The Low Level Virtual Machine License: NCSA @@ -184,7 +187,7 @@ BuildRequires: python3-devel BuildRequires: python3-psutil BuildRequires: python3-sphinx BuildRequires: python3-setuptools -%if %{maj_ver} >= 18 && "%dist" >= ".oe2403" +%if %{maj_ver} >= 18 && %{os_version} > 2203 BuildRequires: python3-myst-parser %endif %if %{with toolchain_clang} @@ -815,7 +818,7 @@ export ASMFLAGS="%{build_cflags}" -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \\\ -DLLVM_BUILD_DOCS:BOOL=ON -%if "%dist" < ".oe2403" && %{maj_ver} >= 18 +%if %{os_version} <= 2203 && %{maj_ver} >= 18 %global cmake_config_args %{cmake_config_args} \\\ -DLLVM_ENABLE_SPHINX:BOOL=OFF %else @@ -975,7 +978,7 @@ export ASMFLAGS="%{build_cflags}" extra_cmake_args='' #endregion cmake options -%if "%dist" < ".oe2503" +%if %{os_version} <= 2403 mkdir _build cd _build %define __cmake_in_source_build 1 @@ -1008,7 +1011,7 @@ cd llvm # /usr/lib64/libomptarget-amdgpu-*.bc # /usr/lib64/libomptarget-nvptx-*.bc -%if "%dist" >= ".oe2403" +%if %{os_version} >= 2403 %build_tool %cmake_target_opts runtimes @@ -1048,7 +1051,7 @@ 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 "%dist" < ".oe2403" && %{maj_ver} >= 18 +%if %{os_version} <= 2203 && %{maj_ver} >= 18 -DLLVM_ENABLE_SPHINX=OFF \ %else -DLLVM_ENABLE_SPHINX=ON \ @@ -1127,7 +1130,7 @@ cd %{build_src_dir}/_build_compiler-rt -DCMAKE_SKIP_RPATH:BOOL=ON \ -DCOMPILER_RT_INCLUDE_TESTS:BOOL=OFF # could be on? -%if "%dist" < ".oe2409" +%if %{os_version} <= 2403 %make_build %else %build_tool @@ -1141,7 +1144,7 @@ cd %{build_src_dir} %install #region LLVM installation -%if "%dist" < ".oe2409" +%if %{os_version} <= 2403 cd %{build_src_dir}/%{build_dir} %else cd %{build_src_dir}/llvm @@ -1149,7 +1152,7 @@ cd %{build_src_dir}/llvm %install_tool -%if "%dist" < ".oe2403" +%if %{os_version} <= 2203 cd %{build_src_dir}/_build_libcxx %install_tool @@ -1157,8 +1160,12 @@ cd %{build_src_dir}/_build_openmp %install_tool cd %{build_src_dir}/_build_compiler-rt +%if %{os_version} > 2403 +%install_tool +%else %make_install %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 @@ -1365,7 +1372,7 @@ rm -rf %{buildroot}/%{install_datadir}/gdb %ifnarch %{ix86} # Remove files that we don't package, yet. -%if "%dist" >= ".oe2403" +%if %{os_version} >= 2403 %if %{maj_ver} >= 20 rm %{buildroot}%{install_bindir}/llvm-offload-device-info %else @@ -1920,7 +1927,7 @@ fi %files -n %{pkg_name_llvm} %license llvm/LICENSE.TXT -%if "%dist" >= ".oe2403" +%if %{os_version} > 2203 %exclude %{_mandir}/man1/llvm-config* %{_mandir}/man1/bugpoint%{exec_suffix}.1.gz @@ -2224,7 +2231,7 @@ fi %ghost %{_bindir}/llvm-config-%{maj_ver} %{install_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} -%if "%dist" >= ".oe2403" +%if %{os_version} > 2203 %{_mandir}/man1/llvm-config* %endif %{install_includedir}/llvm @@ -2290,11 +2297,11 @@ fi %{install_bindir}/clang-cl %{install_bindir}/clang-cpp %{_mandir}/man1/clang++-%{maj_ver}.1.gz -%if "%dist" >= ".oe2403" +%if %{os_version} > 2203 %{_mandir}/man1/clang-%{maj_ver}.1.gz %endif %if %{with sys_llvm} -%if "%dist" >= ".oe2403" +%if %{os_version} > 2203 %{_mandir}/man1/clang.1.gz %endif %{_mandir}/man1/clang++.1.gz @@ -2444,7 +2451,7 @@ fi %endif %{_emacs_sitestartdir}/clang-include-fixer.el %endif -%if "%dist" >= ".oe2403" +%if %{os_version} > 2203 %{_mandir}/man1/diagtool%{exec_suffix}.1.gz %{_mandir}/man1/extraclangtools%{exec_suffix}.1.gz %endif @@ -2631,7 +2638,7 @@ fi %{install_libdir}/liblldb*.so %{install_libdir}/liblldb.so.* %{install_libdir}/liblldbIntelFeatures.so.* -%if "%dist" >= ".oe2403" +%if %{os_version} > 2203 %{_mandir}/man1/lldb-server%{exec_suffix}.1.gz %{_mandir}/man1/lldb%{exec_suffix}.1.gz %endif @@ -2784,6 +2791,10 @@ fi #endregion files %changelog +* Wed Oct 15 2025 liyunfei - 18.1.8-9 +- Revert replace os_version with dist +- default os_version to 2403 + * Mon Oct 13 2025 Wang Qiang - 18.1.8-8 - Replaced the hardcoded /opt/openEuler path with /opt/\%{_vendor} -- Gitee From ada58726277063126beae1cf501e3846be0d6dd5 Mon Sep 17 00:00:00 2001 From: liyunfei Date: Wed, 15 Oct 2025 17:00:13 +0800 Subject: [PATCH 4/5] update target triples for all openEuler based distribution (cherry picked from commit 320d2bb98baef8f4f77d38b9ac3e9ad474d39105) --- llvm-toolset-18.spec | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/llvm-toolset-18.spec b/llvm-toolset-18.spec index e4487e7..eef9432 100644 --- a/llvm-toolset-18.spec +++ b/llvm-toolset-18.spec @@ -154,7 +154,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 9 +Release: 10 Summary: The Low Level Virtual Machine License: NCSA @@ -740,6 +740,11 @@ Documentation for LLVM libunwind # shebang_fix part removed +# update Gnu target triples, make it friendly to all openEuler based distribution +%if "%{_vendor}" != "openEuler" +sed -i 's/"\([a-zA-Z0-9_-]\+\)-openEuler-linux"/"\1-openEuler-linux", "\1-%{_vendor}-linux"/g' %{build_src_dir}/clang/lib/Driver/ToolChains/Gnu.cpp +%endif + #endregion prep #region build @@ -2791,6 +2796,9 @@ fi #endregion files %changelog +* Wed Oct 15 2025 liyunfei - 18.1.8-10 +- update target triples for all openEuler based distribution. + * Wed Oct 15 2025 liyunfei - 18.1.8-9 - Revert replace os_version with dist - default os_version to 2403 -- Gitee From 5ca416b743d0ea903621d469dacaa201bf5d7726 Mon Sep 17 00:00:00 2001 From: wangqiang Date: Fri, 17 Oct 2025 13:31:24 +0800 Subject: [PATCH 5/5] Fix a macro expand issue (cherry picked from commit 13939c21539bf25e5fd334215e50d1bacd0401ee) --- llvm-toolset-18.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/llvm-toolset-18.spec b/llvm-toolset-18.spec index eef9432..501c848 100644 --- a/llvm-toolset-18.spec +++ b/llvm-toolset-18.spec @@ -107,7 +107,7 @@ %global pkg_name_compiler_rt %{?scl_prefix}compiler-rt %global optflags %(echo %{optflags} | sed 's/-fgcc-compatible//') -%global optflags %(echo %{optflags} | sed 's/-specs=\/usr\/lib\/rpm\/generic-hardened-cc1//') +%global optflags %(echo %{optflags} | sed 's|-specs=/usr/lib/rpm/generic-hardened-cc1||g') %ifnarch x86_64 %global optflags %(echo %{optflags} | sed 's/-fstack-clash-protection//') # may affect cmake check for fpic @@ -154,7 +154,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 10 +Release: 11 Summary: The Low Level Virtual Machine License: NCSA @@ -2796,6 +2796,9 @@ fi #endregion files %changelog +* Fri Oct 17 2025 wangqiang - 18.1.8-11 +- Fix a macro expand issue + * Wed Oct 15 2025 liyunfei - 18.1.8-10 - update target triples for all openEuler based distribution. -- Gitee