Missing files

This commit is contained in:
serge-sans-paille 2021-11-17 08:52:26 +01:00
parent e1821b7573
commit bdddcf4cff
3 changed files with 180 additions and 0 deletions

118
llvm-libunwind.spec Normal file
View File

@ -0,0 +1,118 @@
%global maj_ver 13
%global min_ver 0
%global patch_ver 0
#global rc_ver 3
%global libunwind_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global libunwind_srcdir libunwind-%{libunwind_version}%{?rc_ver:rc%{rc_ver}}.src
Name: llvm-libunwind
Version: %{libunwind_version}%{?rc_ver:~rc%{rc_ver}}
Release: 1%{?dist}
Summary: LLVM libunwind
License: ASL 2.0 or NCSA or MIT
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{libunwind_srcdir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{libunwind_srcdir}.tar.xz.sig
Source2: tstellar-gpg-key.asc
# Upstream tighly ties its build to libcxx source, we don't want to use that
# senario, so we need to maintain that patch downstream.
Patch0: standalone.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: llvm-devel
# For documentation
BuildRequires: python3-sphinx
# For gpg source verification
BuildRequires: gnupg2
# Explicitly not supported upstream
ExcludeArch: s390x
%description
LLVM libunwind is an implementation of the interface defined by the HP libunwind
project. It was contributed Apple as a way to enable clang++ to port to
platforms that do not have a system unwinder. It is intended to be a small and
fast implementation of the ABI, leaving off some features of HP's libunwind
that never materialized (e.g. remote unwinding).
%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
%package doc
Summary: libunwind documentation
# jquery.js and langage_data.js are used in the HTML doc and under BSD License
License: BSD and (ASL 2.0 or NCSA or MIT)
%description doc
Documentation for LLVM libunwind
%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup -n %{libunwind_srcdir} -p2
%build
%cmake -GNinja \
-DLLVM_CMAKE_PATH=%{_libdir}/cmake/llvm \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DLIBUNWIND_ENABLE_STATIC=OFF \
-DLIBUNWIND_INCLUDE_DOCS=ON \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DLLVM_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3
%cmake_build
%install
%cmake_install
# We can't install on default location because that would conflict with
# https://src.fedoraproject.org/rpms/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/
rm %{buildroot}%{_docdir}/libunwind/html/.buildinfo
# Same applies to the documentation
mv %{buildroot}%{_docdir}/libunwind %{buildroot}%{_docdir}/llvm-libunwind
%check
# upstream has a hard dependency on libcxx source code for test to be configured
# properly. We can't model that, so rely on gating instead.
#cmake_build --target check-unwind
%files
%license LICENSE.TXT
%dir %{_libdir}/llvm-unwind
%{_libdir}/llvm-unwind/libunwind.so.*
%files devel
%{_libdir}/llvm-unwind/libunwind.so
%files doc
%license LICENSE.TXT
%dir %{_docdir}/llvm-libunwind
%doc %{_docdir}/llvm-libunwind/html
%changelog
* Wed Nov 17 2021 sguelton@redhat.com - 13.0.0-1
- Initial release

62
standalone.patch Normal file
View File

@ -0,0 +1,62 @@
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index f32fe9d..e9da8477 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/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
@@ -38,8 +35,37 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR LIBUNWIND_STANDALONE_B
set(LIBUNWIND_STANDALONE_BUILD 1)
set(LLVM_LIT_OUTPUT_DIR "${LIBUNWIND_BINARY_DIR}/bin")
- # Find the LLVM sources and simulate LLVM CMake options.
- include(HandleOutOfTreeLLVM)
+ 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")
+
+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
+
else()
set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
endif()
diff --git a/libunwind/docs/CMakeLists.txt b/libunwind/docs/CMakeLists.txt
index 79b87eb..eaf6f3d 100644
--- a/libunwind/docs/CMakeLists.txt
+++ b/libunwind/docs/CMakeLists.txt
@@ -1,5 +1,6 @@
include(FindSphinx)
if (SPHINX_FOUND AND LLVM_ENABLE_SPHINX)
+ include(AddLLVM)
include(AddSphinxTarget)
if (${SPHINX_OUTPUT_HTML})
add_sphinx_target(html libunwind)

BIN
tstellar-gpg-key.asc Normal file

Binary file not shown.