Date: Wednesday, March 22, 2023 @ 13:18:22
  Author: arojas
Revision: 1426909

upgpkg: symengine 0.10.0-3: Fix cmake config too (use Gentoo patch)

Modified:
  symengine/trunk/PKGBUILD
  symengine/trunk/llvm-shared.patch

-------------------+
 PKGBUILD          |    6 ++---
 llvm-shared.patch |   62 +++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 8 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-03-22 12:50:16 UTC (rev 1426908)
+++ PKGBUILD    2023-03-22 13:18:22 UTC (rev 1426909)
@@ -3,7 +3,7 @@
 
 pkgname=symengine
 pkgver=0.10.0
-pkgrel=2
+pkgrel=3
 pkgdesc='Fast symbolic manipulation library, written in C++'
 url='http://sympy.org/'
 arch=(x86_64)
@@ -15,11 +15,11 @@
         llvm-shared.patch)
 sha256sums=('27eae7982f010e4901a5922d44e0de4b81c3b8dd52c57b147a1994f0541da50e'
             'f19af7885923a6fb80783796a24e045201014415e8b9f195b87443600864e7b1'
-            'beb7933867f5b1c607539ef665279f9907741013b64a8cd07ed500f5a8737471')
+            'ef05a806139b35e0336f00cb6960ef6cf483f11b0041e436a99ab1f46bdcb11c')
 
 prepare() {
   patch -d $pkgname-$pkgver -p1 < primesieve.patch # Actually use primesieve
-  patch -d $pkgname-$pkgver -p1 < llvm-shared.patch # Use shared LLVM
+  patch -d $pkgname-$pkgver -p1 < llvm-shared.patch # Use shared LLVM (Gentoo)
 }
 
 build() {

Modified: llvm-shared.patch
===================================================================
--- llvm-shared.patch   2023-03-22 12:50:16 UTC (rev 1426908)
+++ llvm-shared.patch   2023-03-22 13:18:22 UTC (rev 1426909)
@@ -1,14 +1,66 @@
+From: Matthias Maier <[email protected]>
+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 c81da8b5..967e7cb7 100644
+index cf5ab3b..dfa6605 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -416,8 +416,7 @@ if (WITH_LLVM)
+@@ -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})
-+    set (llvm_libs LLVM)
+-
+-    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")
+diff --git a/cmake/SymEngineConfig.cmake.in b/cmake/SymEngineConfig.cmake.in
+index b01ef9b..6d82c10 100644
+--- a/cmake/SymEngineConfig.cmake.in
++++ b/cmake/SymEngineConfig.cmake.in
+@@ -67,9 +67,7 @@ set(SYMENGINE_LLVM_COMPONENTS @SYMENGINE_LLVM_COMPONENTS@)
  
-     if (BUILD_SHARED_LIBS)
-         set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT False)
+ if (NOT "${SYMENGINE_LLVM_COMPONENTS}" STREQUAL "")
+     find_package(LLVM REQUIRED ${SYMENGINE_LLVM_COMPONENTS} HINTS @LLVM_DIR@)
+-    llvm_map_components_to_libnames(llvm_libs_direct 
${SYMENGINE_LLVM_COMPONENTS})
+-    llvm_expand_dependencies(llvm_libs ${llvm_libs_direct})
+-    set(SYMENGINE_LIBRARIES ${SYMENGINE_LIBRARIES} ${llvm_libs})
++    set(SYMENGINE_LIBRARIES ${SYMENGINE_LIBRARIES} LLVM)
+ else()
+     set(SYMENGINE_LLVM_INCLUDE_DIRS)
+ endif()
+-- 

Reply via email to