diff --git a/llvm-toolset-18.spec b/llvm-toolset-18.spec index d98a4137363b1ab133cfc4e2aa2b824a25d6f007..f1d60240d04c2410af59b12a141c5ea897554a2e 100644 --- a/llvm-toolset-18.spec +++ b/llvm-toolset-18.spec @@ -4,21 +4,19 @@ %global min_ver 1 %global patch_ver 8 -%if "%dist" == "%nil" -%global dist .oe2403 -%endif +%global os_version %{lua: print(tonumber(rpm.expand("%{dist}"):match("oe(%d+)") or 2403))} # 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 +79,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 +149,7 @@ #region main package Name: llvm-toolset-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 8 +Release: 10 Summary: The Low Level Virtual Machine License: NCSA @@ -184,7 +182,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} @@ -737,6 +735,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 @@ -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,13 @@ 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 + * Mon Oct 13 2025 Wang Qiang - 18.1.8-8 - Replaced the hardcoded /opt/openEuler path with /opt/\%{_vendor}