!21 fix cmake version requirment for 2003 build

From: @liyunfei33 
Reviewed-by: @eastb233 
Signed-off-by: @eastb233
This commit is contained in:
openeuler-ci-bot 2025-03-07 09:47:06 +00:00 committed by Gitee
commit f8a00b125c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 427 additions and 60 deletions

View File

@ -0,0 +1,343 @@
From 17621e9cc5dea359fbf2aaa0e20e4f2a67d41fa6 Mon Sep 17 00:00:00 2001
From: liyunfei <liyunfei33@huawei.com>
Date: Thu, 6 Mar 2025 12:48:04 +0800
Subject: [PATCH] remove cmake_minimum_required
---
bolt/runtime/CMakeLists.txt | 2 +-
clang/CMakeLists.txt | 2 +-
clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt | 2 +-
compiler-rt/CMakeLists.txt | 2 +-
compiler-rt/lib/builtins/CMakeLists.txt | 2 +-
flang/CMakeLists.txt | 2 +-
flang/lib/Decimal/CMakeLists.txt | 2 +-
flang/runtime/CMakeLists.txt | 2 +-
libc/CMakeLists.txt | 2 +-
libc/examples/hello_world/CMakeLists.txt | 2 +-
libclc/CMakeLists.txt | 2 +-
libcxx/CMakeLists.txt | 2 +-
libcxxabi/CMakeLists.txt | 2 +-
libunwind/CMakeLists.txt | 2 +-
lld/CMakeLists.txt | 2 +-
lldb/CMakeLists.txt | 2 +-
lldb/tools/debugserver/CMakeLists.txt | 2 +-
llvm-libgcc/CMakeLists.txt | 2 +-
llvm/CMakeLists.txt | 2 +-
mlir/CMakeLists.txt | 2 +-
mlir/examples/standalone/CMakeLists.txt | 2 +-
openmp/CMakeLists.txt | 2 +-
openmp/cmake/DetectTestCompiler/CMakeLists.txt | 2 +-
openmp/libompd/src/CMakeLists.txt | 2 +-
polly/CMakeLists.txt | 2 +-
pstl/CMakeLists.txt | 2 +-
runtimes/CMakeLists.txt | 2 +-
27 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt
index 8472ce00b413..3ddfd2b1743b 100644
--- a/bolt/runtime/CMakeLists.txt
+++ b/bolt/runtime/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
include(CheckIncludeFiles)
include(GNUInstallDirs)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 98fcb6ea1a07..18936e79a24c 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
index 95c6fdb610e0..1d1d2a40050e 100644
--- a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
+++ b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt
@@ -1,6 +1,6 @@
project(exec C)
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
include(CheckCCompilerFlag)
check_c_compiler_flag("-std=c99" C99_SUPPORTED)
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index cfa97023d281..5f20a92155e3 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -3,7 +3,7 @@
# An important constraint of the build is that it only produces libraries
# based on the ability of the host toolchain to target various platforms.
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index d62fa0432e2a..1b5028472ddc 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -3,7 +3,7 @@
# architecture-specific code in various subdirectories.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- cmake_minimum_required(VERSION 3.20.0)
+ cmake_minimum_required(VERSION 3.16.0)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
project(CompilerRTBuiltins C ASM)
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index ac30da89995e..2b778265b432 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt
index 3116ff68ea26..319c75957e89 100644
--- a/flang/lib/Decimal/CMakeLists.txt
+++ b/flang/lib/Decimal/CMakeLists.txt
@@ -1,5 +1,5 @@
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- cmake_minimum_required(VERSION 3.20.0)
+ cmake_minimum_required(VERSION 3.16.0)
project(FortranDecimal C CXX)
diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt
index 5b23065a32d1..22ef3984110a 100644
--- a/flang/runtime/CMakeLists.txt
+++ b/flang/runtime/CMakeLists.txt
@@ -7,7 +7,7 @@
#===------------------------------------------------------------------------===#
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- cmake_minimum_required(VERSION 3.20.0)
+ cmake_minimum_required(VERSION 3.16.0)
project(FlangRuntime C CXX)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 4be92ba1380c..9ac479b1c01d 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
# Include LLVM's cmake policies.
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/libc/examples/hello_world/CMakeLists.txt b/libc/examples/hello_world/CMakeLists.txt
index 1561cdc1c3bf..64062f522a11 100644
--- a/libc/examples/hello_world/CMakeLists.txt
+++ b/libc/examples/hello_world/CMakeLists.txt
@@ -1,5 +1,5 @@
project(hello_world)
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
include(../examples.cmake)
add_example(
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 9daef8265c16..2b4c32e235f6 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
project( libclc VERSION 0.2.0 LANGUAGES CXX C)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index b8ac536588d3..4d8ba59e9a14 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -4,7 +4,7 @@
#===============================================================================
# Setup Project
#===============================================================================
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index f380fe6b6b92..12a8686fe429 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -4,7 +4,7 @@
# Setup Project
#===============================================================================
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index bc2a820fe98e..ac5b67357152 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -2,7 +2,7 @@
# Setup Project
#===============================================================================
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 595c286abd91..2ecd15275929 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 4a53d7ef3d0d..c643ee9654f3 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/lldb/tools/debugserver/CMakeLists.txt b/lldb/tools/debugserver/CMakeLists.txt
index 74afea804598..9274870fe830 100644
--- a/lldb/tools/debugserver/CMakeLists.txt
+++ b/lldb/tools/debugserver/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
project(Debugserver LANGUAGES C CXX ASM-ATT)
diff --git a/llvm-libgcc/CMakeLists.txt b/llvm-libgcc/CMakeLists.txt
index de42d908c371..cd825172274b 100644
--- a/llvm-libgcc/CMakeLists.txt
+++ b/llvm-libgcc/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
if (NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../libunwind")
message(FATAL_ERROR "llvm-libgcc requires being built in a monorepo layout with libunwind available")
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index b0afb47a7243..1885b9450ae5 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1,6 +1,6 @@
# See docs/CMake.html for instructions about how to build LLVM with CMake.
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index c91e9cd93dc8..beacaf45721f 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -1,5 +1,5 @@
# MLIR project.
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt
index 038242ba1437..c143d373fa6b 100644
--- a/mlir/examples/standalone/CMakeLists.txt
+++ b/mlir/examples/standalone/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
project(standalone-dialect LANGUAGES CXX C)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index c1efcaf80b54..e82b81aa3052 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/openmp/cmake/DetectTestCompiler/CMakeLists.txt b/openmp/cmake/DetectTestCompiler/CMakeLists.txt
index 8ea7ab8d45ba..56ffd3c51a7f 100644
--- a/openmp/cmake/DetectTestCompiler/CMakeLists.txt
+++ b/openmp/cmake/DetectTestCompiler/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
project(DetectTestCompiler C CXX)
include(CheckCCompilerFlag)
diff --git a/openmp/libompd/src/CMakeLists.txt b/openmp/libompd/src/CMakeLists.txt
index 0402a0177201..f9955c02b545 100644
--- a/openmp/libompd/src/CMakeLists.txt
+++ b/openmp/libompd/src/CMakeLists.txt
@@ -9,7 +9,7 @@
#
project (libompd)
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
add_library (ompd SHARED TargetValue.cpp omp-debug.cpp omp-state.cpp omp-icv.cpp)
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index 5d0f2cd7f00e..28f7c580f6a4 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -1,7 +1,7 @@
# Check if this is a in tree build.
if (NOT DEFINED LLVM_MAIN_SRC_DIR)
project(Polly)
- cmake_minimum_required(VERSION 3.20.0)
+ cmake_minimum_required(VERSION 3.16.0)
set(POLLY_STANDALONE_BUILD TRUE)
endif()
diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt
index 255e22af9a26..1364d451224a 100644
--- a/pstl/CMakeLists.txt
+++ b/pstl/CMakeLists.txt
@@ -5,7 +5,7 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------------------------------------------------------------------===##
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$")
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 599529852688..918e7a9c1c7e 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -1,5 +1,5 @@
# This file handles building LLVM runtime sub-projects.
-cmake_minimum_required(VERSION 3.20.0)
+cmake_minimum_required(VERSION 3.16.0)
# Add path for custom and the LLVM build's modules to the CMake module path.
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
--
2.42.0.windows.2

View File

@ -9,7 +9,7 @@
# Build sys_llvm packages or compat packages
%bcond_with sys_llvm
%bcond_with check
%if %{os_version} <= 2203
%if %{os_version} == 2203
%bcond_with toolchain_clang
%else
%bcond_without toolchain_clang
@ -115,7 +115,7 @@
#region LLD globals
%global pkg_name_libomp %{?scl_prefix}libomp
%global pkg_name_libomp %{?scl_prefix}openmp
%global so_suffix %{maj_ver}.%{min_ver}
@ -137,7 +137,7 @@
#endregion globals
#region MLIR globals
%global pkg_name_mlir %{?scl_prefix}mlir
%global pkg_name_mlir %{?scl_prefix}llvm-mlir
#endregion MLIR globals
#region libcxx globals
@ -150,7 +150,7 @@
#region main package
Name: llvm-toolset-%{maj_ver}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 1
Release: 6
Summary: The Low Level Virtual Machine
License: NCSA
@ -166,6 +166,9 @@ Source2: CMakeLists.txt
Patch0001: 0001-PATCH-clang-Don-t-install-static-libraries.patch
Patch0002: 0002-Always-build-shared-libs-for-LLD.patch
Patch0003: 0003-fedora-standalone.patch
%if %{os_version} <= 2003
Patch0004: 0004-remove-cmake_minimum_required.patch
%endif
BuildRequires: gcc
BuildRequires: gcc-c++
@ -447,13 +450,13 @@ Development header files for clang tools.
# Put git-clang-format in its own package, because it Requires git
# and we don't want to force users to install all those dependenices if they
# just want clang.
%package -n %{?scl_prefix}git-clang-format%{?pkg_suffix}
%package -n %{?scl_prefix}git-clang-format
Summary: Integration of clang-format for git
Requires: %{pkg_name_clang}-tools-extra = %{version}-%{release}
Requires: git
Requires: python3
%description -n %{?scl_prefix}git-clang-format%{pkg_suffix}
%description -n %{?scl_prefix}git-clang-format
clang-format integration for git.
%if %{with sys_llvm}
@ -495,7 +498,7 @@ Summary: OpenMP runtime for clang
URL: http://openmp.llvm.org
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
Requires: elfutils-libelf%{?_isa}
Requires: elfutils-libelf
Provides: libomp(major) = %{maj_ver}
@ -564,7 +567,9 @@ License: Apache-2.0 WITH LLVM-exception OR NCSA
URL: http://lldb.llvm.org/
Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release}
Requires: %{?scl_prefix}python3-lldb
%if %{with sys_llvm}
Requires: python%{python3_pkgversion}-lldb
%endif
%description -n %{pkg_name_lldb}
LLDB is a next generation, high-performance debugger. It is built as a set
@ -579,15 +584,17 @@ Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_lldb}-devel
The package contains header files for the LLDB debugger.
%package -n %{?scl_prefix}python3-lldb
%{?python_provide:%python_provide python3-lldb}
%if %{with sys_llvm}
%package -n python%{python3_pkgversion}-lldb
%{?python_provide:%python_provide python%{python3_pkgversion}-lldb}
Summary: Python module for LLDB
Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release}
%description -n %{?scl_prefix}python3-lldb
%description -n python%{python3_pkgversion}-lldb
The package contains the LLDB Python module.
%endif
%endif
#endregion LLDB packages
#region MLIR packages
@ -619,16 +626,18 @@ Requires: %{pkg_name_mlir}-static%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_mlir}-devel
MLIR development files.
%package -n %{?scl_prefix}python3-mlir
%{?python_provide:%python_provide python3-mlir}
%if %{with sys_llvm}
%package -n python%{python3_pkgversion}-mlir
%{?python_provide:%python_provide python%{python3_pkgversion}-mlir}
Summary: MLIR python bindings
Requires: python3
Requires: python3-numpy
Requires: python%{python3_pkgversion}-numpy
%description -n %{?scl_prefix}python3-mlir
%description -n python%{python3_pkgversion}-mlir
MLIR python bindings.
%endif
%endif
#endregion MLIR packages
#region libcxx packages
@ -775,10 +784,17 @@ export ASMFLAGS="%{build_cflags}"
-DLLVM_USE_PERF=ON \\\
-DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \\\
-DBUILD_SHARED_LIBS=OFF \\\
-DLLVM_BUILD_LLVM_DYLIB=ON
-DLLVM_BUILD_LLVM_DYLIB=ON \\\
-DBUILD_FOR_OPENEULER=ON
%global cmake_config_args %{cmake_common_args}
%if %{with toolchain_clang}
%global cmake_config_args %{cmake_config_args} \\\
-DCMAKE_C_COMPILER=clang \\\
-DCMAKE_CXX_COMPILER=clang++
%endif
#region clang options
%global cmake_config_args %{cmake_config_args} \\\
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \\\
@ -881,7 +897,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
@ -1353,10 +1369,8 @@ rm -rf %{buildroot}/%{install_datadir}/gdb
%ifnarch %{ix86}
# Remove files that we don't package, yet.
%if %{os_version} > 2203
rm %{buildroot}%{install_bindir}/llvm-omp-device-info
rm %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
%endif
rm -rf %{buildroot}%{install_bindir}/llvm-omp-device-info
rm -rf %{buildroot}%{install_bindir}/llvm-omp-kernel-replay
%endif
#endregion OPENMP installation
@ -1379,19 +1393,24 @@ install -D -m 644 -t %{buildroot}%{_mandir}/man1/ lld/docs/ld.lld.1
# python: fix binary libraries location
liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so))
%if %{with sys_llvm}
mkdir -p %{buildroot}%{python3_sitearch}
mv %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb %{buildroot}%{python3_sitearch}/lldb
ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so
%py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb
%endif
rm -rf %{buildroot}%{install_prefix}/..%{python3_sitearch}/lldb
%endif
#endregion LLDB installation
#region mlir installation
%if %{with mlir}
%if %{with sys_llvm}
mkdir -p %{buildroot}/%{python3_sitearch}
mv %{buildroot}%{install_prefix}/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch}
%endif
# These directories should be empty now.
rmdir %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages
rm -rf %{buildroot}%{install_prefix}/python_packages/mlir_core %{buildroot}%{install_prefix}/python_packages
# Unneeded files.
rm -rf %{buildroot}%{install_prefix}/src/python
%endif
@ -1416,7 +1435,7 @@ popd
%endif
#endregion libcxx installation
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
# Add version suffix to binaries. Do this at the end so it includes any
# additional binaries that may be been added by other steps.
for f in %{buildroot}/%{install_bindir}/*; do
@ -1446,7 +1465,7 @@ touch %{buildroot}%{_bindir}/llvm-config-%{maj_ver}
%else
rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
rm -f %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
(cd %{buildroot}/%{install_bindir} ; ln -s llvm-config llvm-config%{exec_suffix}-%{__isa_bits} )
%endif
@ -1465,7 +1484,7 @@ install -m 0755 ../llvm-compat-libs/lib/liblldb.so.%{compat_maj_ver}* %{buildroo
cat <<EOF > %{buildroot}%{_scl_scripts}/enable
# General environment variables
export PATH=%{install_bindir}\${PATH:+:\${PATH}}
export MANPATH=%{install_datadir}:\${MANPATH}
export MANPATH=%{_mandir}:\${MANPATH}
export PCP_DIR=%{_scl_root}
# bz847911 workaround:
@ -1481,23 +1500,6 @@ export LD_LIBRARY_PATH=%{_scl_root}\$rpmlibdir\$rpmlibdir32:%{_scl_root}\$rpmlib
EOF
chmod 755 %{buildroot}%{_scl_scripts}/enable
cat <<EOF > %{buildroot}%{install_bindir}/sudo
#! /bin/sh
# TODO: parse & pass-through sudo options from \$@
sudo_options="-E"
for arg in "\$@"
do
case "\$arg" in
*\'*)
arg=`echo "\$arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
cmd_options="\$cmd_options '\$arg'"
done
exec /usr/bin/sudo \$sudo_options LD_LIBRARY_PATH=\$LD_LIBRARY_PATH PATH=\$PATH scl enable %{scl} "\$cmd_options"
EOF
chmod 775 %{buildroot}%{install_bindir}/sudo
%endif
#endregion install
@ -1911,11 +1913,11 @@ fi
#endregion LLVM lit files
#region LLVM files
%files -n llvm-toolset-%{maj_ver}
%{_scl_scripts}/enable
%files -n %{pkg_name_llvm}
%license llvm/LICENSE.TXT
%{_scl_scripts}/enable
%{install_bindir}/sudo
%exclude %{_mandir}/man1/llvm-config*
%{_mandir}/man1/bugpoint%{exec_suffix}.1.gz
@ -2072,7 +2074,7 @@ fi
%{install_bindir}/llvm-tapi-diff
%endif
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
# This is for all the binaries with the version suffix.
%{_bindir}/bugpoint%{exec_suffix}
%{_bindir}/dsymutil%{exec_suffix}
@ -2246,7 +2248,7 @@ fi
%{install_bindir}/lli-child-target
%{install_bindir}/llvm-isel-fuzzer
%{install_bindir}/llvm-opt-fuzzer
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/not%{exec_suffix}
%{_bindir}/count%{exec_suffix}
%{_bindir}/yaml-bench%{exec_suffix}
@ -2286,7 +2288,8 @@ fi
%if %{with sys_llvm}
%{_mandir}/man1/clang.1.gz
%{_mandir}/man1/clang++.1.gz
%else
%endif
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/clang-%{maj_ver}
%{_bindir}/clang++-%{maj_ver}
%{_bindir}/clang-cl-%{maj_ver}
@ -2307,7 +2310,7 @@ fi
%{install_includedir}/clang-c/
%{install_libdir}/cmake/clang
%{install_bindir}/clang-tblgen
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/clang-tblgen-%{maj_ver}
%endif
%dir %{install_datadir}/clang/
@ -2328,7 +2331,7 @@ fi
%{install_bindir}/analyze-build
%{install_bindir}/intercept-build
%{install_bindir}/scan-build-py
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/scan-view-%{maj_ver}
%{_bindir}/scan-build-%{maj_ver}
%{_bindir}/analyze-build-%{maj_ver}
@ -2387,7 +2390,7 @@ fi
%{install_bindir}/clang-pseudo
%{install_bindir}/clang-rename
%endif
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/amdgpu-arch-%{maj_ver}
%{_bindir}/clang-apply-replacements-%{maj_ver}
%{_bindir}/clang-change-namespace-%{maj_ver}
@ -2424,7 +2427,8 @@ fi
%{_bindir}/clang-pseudo-%{maj_ver}
%{_bindir}/clang-rename-%{maj_ver}
%endif
%else
%endif
%if %{with sys_llvm}
%{_emacs_sitestartdir}/clang-format.el
%if %{maj_ver} < 20
%{_emacs_sitestartdir}/clang-rename.el
@ -2446,10 +2450,10 @@ fi
%license clang-tools-extra/LICENSE.TXT
%{install_includedir}/clang-tidy/
%files -n %{?scl_prefix}git-clang-format%{pkg_suffix}
%files -n %{?scl_prefix}git-clang-format
%license clang/LICENSE.TXT
%{install_bindir}/git-clang-format
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/git-clang-format-%{maj_ver}
%endif
@ -2484,7 +2488,7 @@ fi
%{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/clang_rt.crtend.o
%endif
%ifnarch %{ix86} s390x
%ifnarch %{ix86} s390x riscv64
%{install_libdir}/clang/%{maj_ver}/lib/%{compiler_rt_triple}/liborc_rt.a
%endif
@ -2566,7 +2570,8 @@ fi
%{install_bindir}/wasm-ld
%if %{with sys_llvm}
%{_mandir}/man1/ld.lld.1*
%else
%endif
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/lld%{exec_suffix}
%{_bindir}/lld-link%{exec_suffix}
%{_bindir}/ld.lld%{exec_suffix}
@ -2608,7 +2613,7 @@ fi
%files -n %{pkg_name_lldb}
%license lldb/LICENSE.TXT
%{install_bindir}/lldb*
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/lldb*
%endif
# Usually, *.so symlinks are kept in devel subpackages. However, the python
@ -2625,9 +2630,11 @@ fi
%files -n %{pkg_name_lldb}-devel
%{install_includedir}/lldb
%files -n %{?scl_prefix}python3-lldb
%if %{with sys_llvm}
%files -n python%{python3_pkgversion}-lldb
%{python3_sitearch}/lldb
%endif
%endif
#endregion LLDB files
#region MLIR files
@ -2665,7 +2672,7 @@ fi
%if %{maj_ver} >= 20
%{install_bindir}/mlir-rewrite
%endif
%if %{without sys_llvm}
%if %{without sys_llvm} && %{os_version} < 2403
%{_bindir}/mlir-tblgen-%{maj_ver}
%{_bindir}/mlir-pdll-%{maj_ver}
%{_bindir}/mlir-cpu-runner-%{maj_ver}
@ -2697,9 +2704,11 @@ fi
%{install_libdir}/libmlir_runner_utils.so
%{install_libdir}/libMLIR*.so
%files -n %{?scl_prefix}python3-mlir
%if %{with sys_llvm}
%files -n python%{python3_pkgversion}-mlir
%{python3_sitearch}/mlir/
%endif
%endif
#endregion MLIR files
#region libcxx files
@ -2763,5 +2772,20 @@ fi
#endregion files
%changelog
* Mon Mar 3 2025 liyunfei liyunfei33@huawei.com - 17.0.6-6
- fix cmake version requirment for 2003 build
* Mon Mar 3 2025 liyunfei liyunfei33@huawei.com - 17.0.6-5
- Remove python pack without sys_llvm
* Tue Feb 25 2025 liyunfei <liyunfei33@huawei.com> - 17.0.6-4
- Bugfix for package name & clang-17 conflict
* Fri Feb 21 2025 laokz <zhangkai@iscas.ac.cn> - 17.0.6-3
- riscv64: exclude packaging non-supported liborc_rt.a
* Fri Feb 14 2025 liyunfei <liyunfei33@huawei.com> - 17.0.6-2
- Add BUILD_FOR_OPENEULER & Bugfixes
* Mon Feb 10 2025 liyunfei <liyunfei33@huawei.com> - 17.0.6-1
- Package init
- Package init