commit:     973db0dbc3113bf9df5f60722573e213abb76f27
Author:     Matthias Maier <tamiko <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 11 06:48:53 2022 +0000
Commit:     Matthias Maier <tamiko <AT> gentoo <DOT> org>
CommitDate: Sat Jun 11 06:50:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=973db0db

sci-libs/symengine: fix USE=llvm

Closes: https://bugs.gentoo.org/745915
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>

 profiles/base/package.use.mask                     |  5 --
 .../symengine/files/symengine-0.8.1-fix_llvm.patch | 53 ++++++++++++++++++++++
 sci-libs/symengine/symengine-0.8.1-r1.ebuild       |  1 +
 3 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/profiles/base/package.use.mask b/profiles/base/package.use.mask
index 53bc3cce3a18..ed524909df2a 100644
--- a/profiles/base/package.use.mask
+++ b/profiles/base/package.use.mask
@@ -55,11 +55,6 @@ net-libs/ngtcp2 openssl
 # Needs masked version of ogre (>=1.12), bug #825330
 >=dev-games/mygui-3.4.1 ogre
 
-# Sam James <s...@gentoo.org> (2022-02-21)
-# Needs build system love to make LLVM support work.
-# bug #745915
-sci-libs/symengine llvm
-
 # Marek Szuba <mare...@gentoo.org> (2022-02-07)
 # Deprecated back-end with known stability and data-corruption issues,
 # likely to be removed in gramps-5.2.0.

diff --git a/sci-libs/symengine/files/symengine-0.8.1-fix_llvm.patch 
b/sci-libs/symengine/files/symengine-0.8.1-fix_llvm.patch
new file mode 100644
index 000000000000..3e39a9eda500
--- /dev/null
+++ b/sci-libs/symengine/files/symengine-0.8.1-fix_llvm.patch
@@ -0,0 +1,53 @@
+From: Matthias Maier <tam...@43-1.org>
+Date: Sat, 11 Jun 2022 01:44:54 -0500
+Subject: [PATCH] Fix cmake configure for shared LLVM libraries
+
+Gentoo builds LLVM into a combined shared library. The CMake
+configuration shipped with LLVM is evidently broken in this case, see
+
+  https://github.com/llvm/llvm-project/issues/34593
+  https://bugs.gentoo.org/745915
+
+We work around this issue by simply linking against the monolithic
+"LLVM" target.
+---
+ CMakeLists.txt | 23 +----------------------
+ 1 file changed, 1 insertion(+), 22 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cf5ab3b..dfa6605 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -402,28 +402,7 @@ if (WITH_LLVM)
+     endforeach()
+     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
+ 
+-    llvm_map_components_to_libnames(llvm_libs_direct 
${SYMENGINE_LLVM_COMPONENTS})
+-    llvm_expand_dependencies(llvm_libs ${llvm_libs_direct})
+-
+-    if (BUILD_SHARED_LIBS)
+-        set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT False)
+-        foreach(LLVM_LIB ${llvm_libs})
+-            get_target_property(${LLVM_LIB}_IMPORT_LOCATION ${LLVM_LIB} 
LOCATION)
+-            if (NOT "${${LLVM_LIB}_IMPORT_LOCATION}" MATCHES "NOTFOUND")
+-                if (NOT "${${LLVM_LIB}_IMPORT_LOCATION}" MATCHES ".a$|.lib$")
+-                    set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT True)
+-                endif()
+-            endif()
+-        endforeach()
+-    else()
+-        set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT True)
+-    endif()
+-    set(SYMENGINE_LLVM_LINK_DOWNSTREAM 
${SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT}
+-        CACHE INTERNAL "Link to llvm in SymEngineConfig.cmake")
+-    if (NOT SYMENGINE_LLVM_LINK_DOWNSTREAM)
+-        unset(SYMENGINE_LLVM_COMPONENTS)
+-    endif ()
+-    set(LIBS ${LIBS} ${llvm_libs})
++    set(LIBS ${LIBS} LLVM)
+     include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
+     set(HAVE_SYMENGINE_LLVM yes)
+     set(PKGS ${PKGS} "LLVM")
+-- 
+2.35.1
+

diff --git a/sci-libs/symengine/symengine-0.8.1-r1.ebuild 
b/sci-libs/symengine/symengine-0.8.1-r1.ebuild
index c389bae57034..6aee3b49af90 100644
--- a/sci-libs/symengine/symengine-0.8.1-r1.ebuild
+++ b/sci-libs/symengine/symengine-0.8.1-r1.ebuild
@@ -31,6 +31,7 @@ DEPEND="${RDEPEND}
 
 PATCHES=(
        "${FILESDIR}/${PN}-0.7.0-cmake-build-type.patch"
+       "${FILESDIR}/${PN}-0.8.1-fix_llvm.patch"
 )
 
 pkg_pretend() {

Reply via email to