!3 Add llvm-libunwind-12.0.1 source code and build script
From: @lukewzh Reviewed-by: @eastb233 Signed-off-by: @eastb233
This commit is contained in:
commit
5f8c5f7fa4
74
0001-libunwind-standalone-build.patch
Normal file
74
0001-libunwind-standalone-build.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
From 2d99b052457b78753313704338a9edbb1561ab36 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wangzehong <wangzehong2@huawei.com>
|
||||||
|
Date: Thu, 16 Feb 2023 16:48:37 +0800
|
||||||
|
Subject: [PATCH] modify to standalone build
|
||||||
|
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 34 +++++++++++++++++++++++++++++-----
|
||||||
|
docs/CMakeLists.txt | 1 +
|
||||||
|
2 files changed, 30 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libunwind-12.0.1.src/CMakeLists.txt b/libunwind-12.0.1.src/CMakeLists.txt
|
||||||
|
index 570b8db..14e1b11 100644
|
||||||
|
--- a/libunwind-12.0.1.src/CMakeLists.txt
|
||||||
|
+++ b/libunwind-12.0.1.src/CMakeLists.txt
|
||||||
|
@@ -1,6 +1,3 @@
|
||||||
|
-if (NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../libcxx")
|
||||||
|
- message(FATAL_ERROR "libunwind requires being built in a monorepo layout with libcxx available")
|
||||||
|
-endif()
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# Setup Project
|
||||||
|
@@ -37,9 +34,36 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_B
|
||||||
|
# the configurator should write the script into.
|
||||||
|
set(LIBUNWIND_STANDALONE_BUILD 1)
|
||||||
|
set(LLVM_LIT_OUTPUT_DIR "${LIBUNWIND_BINARY_DIR}/bin")
|
||||||
|
+ find_program(LLVM_CONFIG_PATH "llvm-config" DOC "Path to llvm-config binary")
|
||||||
|
+ if(NOT LLVM_CONFIG_PATH)
|
||||||
|
+ message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
|
||||||
|
+ endif()
|
||||||
|
+
|
||||||
|
+ execute_process(COMMAND "${LLVM_CONFIG_PATH}"
|
||||||
|
+ "--obj-root"
|
||||||
|
+ "--includedir"
|
||||||
|
+ "--cmakedir"
|
||||||
|
+ "--src-root"
|
||||||
|
+ RESULT_VARIABLE HAD_ERROR
|
||||||
|
+ OUTPUT_VARIABLE LLVM_CONFIG_OUTPUT
|
||||||
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
+ if(HAD_ERROR)
|
||||||
|
+ message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
|
||||||
|
+ endif()
|
||||||
|
+
|
||||||
|
+ string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" LLVM_CONFIG_OUTPUT "${LLVM_CONFIG_OUTPUT}")
|
||||||
|
+
|
||||||
|
+ list(GET LLVM_CONFIG_OUTPUT 0 OBJ_ROOT)
|
||||||
|
+ list(GET LLVM_CONFIG_OUTPUT 1 MAIN_INCLUDE_DIR)
|
||||||
|
+ list(GET LLVM_CONFIG_OUTPUT 2 LLVM_CMAKE_PATH)
|
||||||
|
+ list(GET LLVM_CONFIG_OUTPUT 3 MAIN_SRC_DIR)
|
||||||
|
+
|
||||||
|
+ if(NOT EXISTS "${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
|
||||||
|
+ message(FATAL_ERROR "LLVMConfig.cmake not found")
|
||||||
|
+ endif()
|
||||||
|
+ include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
|
||||||
|
|
||||||
|
- # Find the LLVM sources and simulate LLVM CMake options.
|
||||||
|
- include(HandleOutOfTreeLLVM)
|
||||||
|
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
|
||||||
|
else()
|
||||||
|
set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
|
||||||
|
endif()
|
||||||
|
diff --git a/libunwind-12.0.1.src/docs/CMakeLists.txt b/libunwind-12.0.1.src/docs/CMakeLists.txt
|
||||||
|
index c226f2f..17fb075 100644
|
||||||
|
--- a/libunwind-12.0.1.src/docs/CMakeLists.txt
|
||||||
|
+++ b/libunwind-12.0.1.src/docs/CMakeLists.txt
|
||||||
|
@@ -2,6 +2,7 @@ include(FindSphinx)
|
||||||
|
if (SPHINX_FOUND)
|
||||||
|
include(AddSphinxTarget)
|
||||||
|
+ include(AddLLVM)
|
||||||
|
if (${SPHINX_OUTPUT_HTML})
|
||||||
|
add_sphinx_target(html libunwind)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
--
|
||||||
|
2.33.1.windows.1
|
||||||
BIN
libunwind-12.0.1.src.tar.xz
Normal file
BIN
libunwind-12.0.1.src.tar.xz
Normal file
Binary file not shown.
80
libunwind.spec
Normal file
80
libunwind.spec
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
%global maj_ver 12
|
||||||
|
%global min_ver 0
|
||||||
|
%global patch_ver 1
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
Name: llvm-libunwind
|
||||||
|
Version: 12.0.1
|
||||||
|
Release: 1
|
||||||
|
Summary: LLVM "libunwind" runtime libraries
|
||||||
|
License: BSD
|
||||||
|
URL: http://llvm.org
|
||||||
|
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/libunwind-%{version}.src.tar.xz
|
||||||
|
|
||||||
|
Patch0: 0001-libunwind-standalone-build.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
BuildRequires: cmake
|
||||||
|
BuildRequires: python3
|
||||||
|
BuildRequires: llvm-devel
|
||||||
|
|
||||||
|
%description
|
||||||
|
The libunwind-devel package includes the libraries and header files for
|
||||||
|
libunwind.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: LLVM libunwind development files
|
||||||
|
Provides: libunwind(major) = %{maj_ver}
|
||||||
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
Static and unversioned shared libraries for LLVM libunwind
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n libunwind-%{version}.src -p2
|
||||||
|
|
||||||
|
%build
|
||||||
|
mkdir -p _build
|
||||||
|
cd _build
|
||||||
|
|
||||||
|
cmake \
|
||||||
|
-DLLVM_CMAKE_PATH=%{_libdir}/cmake/llvm \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
|
-DLIBUNWIND_ENABLE_STATIC=OFF \
|
||||||
|
%if 0%{?__isa_bits} == 64
|
||||||
|
-DLLVM_LIBDIR_SUFFIX=64 \
|
||||||
|
%else
|
||||||
|
-DLLVM_LIBDIR_SUFFIX= \
|
||||||
|
%endif
|
||||||
|
..
|
||||||
|
|
||||||
|
%make_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
cd _build
|
||||||
|
%make_install
|
||||||
|
|
||||||
|
# We can't install on default location because that would conflict with
|
||||||
|
# https://gitee.com/src-openeuler/libunwind
|
||||||
|
# ABI wise, even though llvm-libunwind's library is named libunwind, it doesn't
|
||||||
|
# have the exact same ABI has gcc's libunwind (it actually provides a subset).
|
||||||
|
mkdir -p %{buildroot}/%{_libdir}/llvm-unwind/
|
||||||
|
mv %{buildroot}%{_libdir}/libunwind* %{buildroot}/%{_libdir}/llvm-unwind/
|
||||||
|
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license LICENSE.TXT
|
||||||
|
%dir %{_libdir}/llvm-unwind
|
||||||
|
%{_libdir}/llvm-unwind/libunwind.so.*
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%{_libdir}/llvm-unwind/libunwind.so
|
||||||
|
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Feb 7 2023 Wang Zehong <wangzehong2@huawei.com> - 12.0.1-1
|
||||||
|
- update to 12.0.1-1
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user