diff --git a/0001-Fix-the-matching-failure-of-triples-containing-upper.patch b/0001-Fix-the-matching-failure-of-triples-containing-upper.patch new file mode 100644 index 0000000000000000000000000000000000000000..0cffb8866a847d9957edf292a1232c3a8d9f36f1 --- /dev/null +++ b/0001-Fix-the-matching-failure-of-triples-containing-upper.patch @@ -0,0 +1,28 @@ +From ff388248ff30709fbc51e35f90ff22060dd91e7f Mon Sep 17 00:00:00 2001 +From: westtide +Date: Tue, 15 Oct 2024 16:58:47 +0800 +Subject: [PATCH] Fix the matching failure of triples containing uppercase + latter + Signed-off-by: westtide + +--- + libc/cmake/modules/LLVMLibCArchitectures.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libc/cmake/modules/LLVMLibCArchitectures.cmake \ +b/libc/cmake/modules/LLVMLibCArchitectures.cmake +index dacb4db75..2dbd41df5 100644 +--- a/libc/cmake/modules/LLVMLibCArchitectures.cmake ++++ b/libc/cmake/modules/LLVMLibCArchitectures.cmake +@@ -84,7 +84,7 @@ if(NOT (libc_compiler_info_result EQUAL "0")) + message(FATAL_ERROR "libc build: error querying compiler info from the " + "compiler: ${libc_compiler_info}") + endif() +-string(REGEX MATCH "Target: [-_a-z0-9.]+[ \r\n]+" ++string(REGEX MATCH "Target: [-_a-zA-Z0-9.]+[ \r\n]+" + libc_compiler_target_info ${libc_compiler_info}) + if(NOT libc_compiler_target_info) + message(FATAL_ERROR "libc build: could not read compiler target info from:\n" +-- +2.43.0 + diff --git a/llvm-libc.spec b/llvm-libc.spec new file mode 100644 index 0000000000000000000000000000000000000000..78f9712762eccfb8139e84bef53f9ac9818617ee --- /dev/null +++ b/llvm-libc.spec @@ -0,0 +1,51 @@ +ExclusiveArch: %{ix86} x86_64 aarch64 riscv64 +%global debug_package %{nil} +%define src_tarball_name llvm-project-%{version}.src + +Name: llvm-libc +Version: 17.0.6 +Release: 1 +Summary: LLVM C standard library implementation + +License: Apache-2.0 WITH LLVM-exception +URL: https://libc.llvm.org/ +# Use the full llvm-project src tarball here for now +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{src_tarball_name}.tar.xz +BuildRequires: llvm clang cmake ninja-build + +# pr: https://github.com/llvm/llvm-project/pull/112464 +Patch0: 0001-Fix-the-matching-failure-of-triples-containing-upper.patch + +%description +LLVM libc is an implementation of the C standard library optimized for use with LLVM and Clang. It aims to provide a fully compliant C17 library with better performance and more opportunities for whole-program optimization when used with LLVM-based compilers. + +%prep +%setup -q -n %{src_tarball_name} +%setup -T -D -n %{src_tarball_name}/libc +%patch -P 0 -p 2 + +%build +export CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument" +export CXXFLAGS="$CXXFLAGS -Wno-error=unused-command-line-argument" + +%cmake ../runtimes -G Ninja \ + -B %{_vpath_builddir} \ + -DLLVM_ENABLE_RUNTIMES="libc" \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_INSTALL_PREFIX=%{_libdir} +%cmake_build + +%install +%cmake_install +mv %{buildroot}%{_libdir}/lib/* %{buildroot}%{_libdir}/ + +%files +%defattr(-,root,root,-) +%license LICENSE.TXT +%{_libdir}/libllvmlibc.a + +%changelog +* Mon Sep 30 2024 westtide - 17.0.6-1 +- Initial package of llvm-libc for openEuler diff --git a/llvm-project-17.0.6.src.tar.xz b/llvm-project-17.0.6.src.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..cdcb13184e9bf3d86998f2e0f937d3a6e15da999 Binary files /dev/null and b/llvm-project-17.0.6.src.tar.xz differ