[packages/llvm] - patch to fix ocaml linking with shared libLLVM, fixed NDEBUG defines in lowmem bcond

qboosh qboosh at pld-linux.org
Thu Nov 9 20:52:25 CET 2023


commit 98bed43db497aadff76c7258c842a08fbc5ca05e
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Nov 9 20:37:21 2023 +0100

    - patch to fix ocaml linking with shared libLLVM, fixed NDEBUG defines in lowmem bcond

 llvm-ocaml-link-dylib.patch | 25 +++++++++++++++++++++++++
 llvm.spec                   |  7 ++++---
 2 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/llvm.spec b/llvm.spec
index 1a3d897..985c04f 100644
--- a/llvm.spec
+++ b/llvm.spec
@@ -109,6 +109,7 @@ Source8:	https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio
 Source9:	https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cmake-%{version}.src.tar.xz
 # Source9-md5:	38ae9cc0950f277c8f88e570c4d18010
 Patch1:		%{name}-pld.patch
+Patch2:		%{name}-ocaml-link-dylib.patch
 Patch3:		x32-gcc-toolchain.patch
 Patch5:		%{name}-ocaml-shared.patch
 Patch6:		%{name}-flang.patch
@@ -132,7 +133,6 @@ BuildRequires:	libltdl-devel
 BuildRequires:	libpfm-devel
 BuildRequires:	libstdc++-devel >= 6:5
 BuildRequires:	libxml2-devel >= 2
-%{?with_ocaml:BuildRequires:	llvm-devel >= 17}
 BuildRequires:	ncurses-devel
 %if %{with ocaml}
 BuildRequires:	ocaml >= 4.00.0
@@ -707,6 +707,7 @@ Integracja narzędzi Clang do formatowania i zmiany nazw z Vimem.
 %{__mv} cmake-%{version}.src cmake-utils
 
 %patch1 -p1
+%patch2 -p1
 %patch3 -p1
 %patch5 -p1
 %if %{with flang}
@@ -744,8 +745,8 @@ cd build
 CPPFLAGS="%{rpmcppflags} -D_FILE_OFFSET_BITS=64"
 
 %if %{with lowmem}
-export CFLAGS="%{rpmcflags} -NDEBUG -g0"
-export CXXFLAGS="%{rpmcxxflags} -NDEBUG -g0"
+export CFLAGS="%{rpmcflags} -DNDEBUG -g0"
+export CXXFLAGS="%{rpmcxxflags} -DNDEBUG -g0"
 if echo 'int main(){}' | %{__cc} -x c %{rpmldflags} -Wl,--reduce-memory-overheads -o /dev/null - > /dev/null 2>&1; then
 export LDFLAGS="%{rpmldflags} -Wl,--reduce-memory-overheads"
 fi
diff --git a/llvm-ocaml-link-dylib.patch b/llvm-ocaml-link-dylib.patch
new file mode 100644
index 0000000..e382acd
--- /dev/null
+++ b/llvm-ocaml-link-dylib.patch
@@ -0,0 +1,25 @@
+--- llvm-17.0.4.src/cmake/modules/AddOCaml.cmake.orig	2023-11-06 21:27:39.906604595 +0100
++++ llvm-17.0.4.src/cmake/modules/AddOCaml.cmake	2023-11-06 22:12:34.479135305 +0100
+@@ -69,7 +69,7 @@ function(add_ocaml_library name)
+   endif()
+ 
+   if(LLVM_LINK_LLVM_DYLIB)
+-    list(APPEND ocaml_flags "-lLLVM")
++    list(APPEND ocaml_flags "-lLLVM-17")
+   else()
+     explicit_map_components_to_libraries(llvm_libs ${ARG_LLVM})
+     foreach( llvm_lib ${llvm_libs} )
+@@ -186,9 +186,13 @@ function(add_ocaml_library name)
+   endforeach()
+ 
+   if( NOT LLVM_OCAML_OUT_OF_TREE )
++    if(LLVM_LINK_LLVM_DYLIB)
++      add_dependencies("ocaml_${name}" LLVM)
++    else()
+     foreach( llvm_lib ${llvm_libs} )
+       add_dependencies("ocaml_${name}" "${llvm_lib}")
+     endforeach()
++    endif()
+   endif()
+ 
+   add_dependencies("ocaml_all" "ocaml_${name}")
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/llvm.git/commitdiff/98bed43db497aadff76c7258c842a08fbc5ca05e



More information about the pld-cvs-commit mailing list