From f127a9d979e8f4a282c2f2e4b173a0848557491b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 6 Dec 2019 14:41:15 +0000 Subject: [PATCH] Include upstream patch to fix build for OCaml 4.09. --- ...the-return-value-of-caml_named_value.patch | 38 +++++++++++++++++++ ocaml-libvirt.spec | 6 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-Make-const-the-return-value-of-caml_named_value.patch diff --git a/0001-Make-const-the-return-value-of-caml_named_value.patch b/0001-Make-const-the-return-value-of-caml_named_value.patch new file mode 100644 index 0000000..c8b7aee --- /dev/null +++ b/0001-Make-const-the-return-value-of-caml_named_value.patch @@ -0,0 +1,38 @@ +From 75b13978f85b32c7a121aa289d8ebf41ba14ee5a Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Thu, 5 Sep 2019 09:57:09 +0200 +Subject: [PATCH] Make const the return value of caml_named_value() + +With OCaml >= 4.09 caml_named_value() returns a const value *, so keep +the constness to build also in this case. + +Signed-off-by: Pino Toscano +--- + libvirt/libvirt_c_oneoffs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libvirt/libvirt_c_oneoffs.c b/libvirt/libvirt_c_oneoffs.c +index 6f56f10..e23c0db 100644 +--- a/libvirt/libvirt_c_oneoffs.c ++++ b/libvirt/libvirt_c_oneoffs.c +@@ -1207,7 +1207,7 @@ ocaml_libvirt_event_run_default_impl (value unitv) + #define DOMAIN_CALLBACK_BEGIN(NAME) \ + value connv, domv, callback_id, result; \ + connv = domv = callback_id = result = Val_int(0); \ +- static value *callback = NULL; \ ++ static const value *callback = NULL; \ + caml_leave_blocking_section(); \ + if (callback == NULL) \ + callback = caml_named_value(NAME); \ +@@ -1433,7 +1433,7 @@ timeout_callback(int timer, void *opaque) + { + value callback_id, result; + callback_id = result = Val_int(0); +- static value *callback = NULL; ++ static const value *callback = NULL; + caml_leave_blocking_section(); + if (callback == NULL) + callback = caml_named_value("Libvirt.timeout_callback"); +-- +2.23.0 + diff --git a/ocaml-libvirt.spec b/ocaml-libvirt.spec index 48abce7..9c0af9c 100644 --- a/ocaml-libvirt.spec +++ b/ocaml-libvirt.spec @@ -7,6 +7,10 @@ License: LGPLv2+ URL: http://libvirt.org/ocaml/ Source0: http://libvirt.org/sources/ocaml/%{name}-%{version}.tar.gz +# Fixes build with OCaml >= 4.09. +# Upstream commit 75b13978f85b32c7a121aa289d8ebf41ba14ee5a. +Patch1: 0001-Make-const-the-return-value-of-caml_named_value.patch + BuildRequires: ocaml >= 3.10.0 BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-findlib-devel @@ -81,7 +85,7 @@ make install-byte %changelog * Fri Dec 06 2019 Richard W.M. Jones - 0.6.1.5-3 -- Bump release and rebuild. +- Include upstream patch to fix build for OCaml 4.09. * Fri Dec 06 2019 Richard W.M. Jones - 0.6.1.5-2 - OCaml 4.09.0 (final) rebuild.