- Use upstream libvirt.git

- Add ocaml-libvirt.patch to build with dune

OBS-URL: https://build.opensuse.org/package/show/devel:languages:ocaml/ocaml-libvirt?expand=0&rev=29
This commit is contained in:
Olaf Hering 2022-04-04 15:44:58 +00:00 committed by Git OBS Bridge
parent 41afac2554
commit fb7050472c
5 changed files with 119 additions and 10 deletions

View File

@ -1,10 +1,13 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="filename">ocaml-libvirt</param>
<param name="revision">dune</param>
<param name="revision">06c073b25e4c18212b6fd1be77b23431b4612caf</param>
<param name="scm">git</param>
<param name="url">https://github.com/olafhering/ocaml-libvirt.git</param>
<param name="versionformat">0.6.1.5</param>
<param name="submodules">disable</param>
<param name="url">https://github.com/libvirt/libvirt-ocaml.git</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">[v]?([^+]+)(.*)</param>
<param name="versionrewrite-replacement">\1</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:76aadd479e050f54c518b010bb8c1e739def3f05e8fb0944975c9ae95312fa73
size 56432
oid sha256:2ac5217701ef13184c8ae9037bd0381a38d2cefb6560309bc8b27aae114e2fcc
size 87204

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 4 04:04:04 UTC 2022 - ohering@suse.de
- Use upstream libvirt.git
- Add ocaml-libvirt.patch to build with dune
-------------------------------------------------------------------
Fri Nov 1 12:34:56 UTC 2019 - ohering@suse.de

97
ocaml-libvirt.patch Normal file
View File

@ -0,0 +1,97 @@
--- /dev/null
+++ b/dune-project
@@ -0,0 +1,27 @@
+(lang dune 1.11)
+
+(name libvirt)
+
+(version 0.6.1.5)
+
+(generate_opam_files true)
+
+(license "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception")
+
+(authors "Richard W.M. Jones <rjones@redhat.com>")
+
+(maintainers "Richard W.M. Jones <rjones@redhat.com>")
+
+(homepage "https://libvirt.org/ocaml/")
+
+(package
+ (name libvirt)
+ (synopsis "OCaml bindings for libvirt")
+ (description
+ "OCaml bindings for libvirt, allowing you to write OCaml programs and scripts which control virtualisation features.")
+ (depends
+ (dune
+ (>= 1.11))
+ dune.configurator
+ (ocaml
+ (>= 4.02.0))))
--- /dev/null
+++ b/examples/dune
@@ -0,0 +1,4 @@
+(executables
+ (public_names domain_events get_all_domain_stats get_cpu_stats list_domains
+ list_secrets node_info)
+ (libraries libvirt))
--- /dev/null
+++ b/libvirt/config/discover.ml
@@ -0,0 +1,16 @@
+module C = Configurator.V1
+
+let () =
+C.main ~name:"libvirt" (fun c ->
+
+let conf =
+ match C.Pkg_config.get c with
+ | None -> C.die "'pkg-config' missing"
+ | Some pc ->
+ match (C.Pkg_config.query pc ~package:"libvirt") with
+ | None -> C.die "'pkg-config libvirt' missing"
+ | Some deps -> deps
+ in
+
+ C.Flags.write_sexp "c_flags.sexp" conf.cflags;
+ C.Flags.write_sexp "c_library_flags.sexp" conf.libs)
--- /dev/null
+++ b/libvirt/config/dune
@@ -0,0 +1,3 @@
+(executable
+ (name discover)
+ (libraries dune.configurator))
--- /dev/null
+++ b/libvirt/dune
@@ -0,0 +1,32 @@
+(library
+ (name mllibvirt)
+ (public_name libvirt)
+ (synopsis "binding for libvirt")
+ (modules Libvirt Libvirt_version)
+ (wrapped false)
+ (libraries unix)
+ (c_names libvirt_c_common libvirt_c_oneoffs libvirt_generated)
+ (c_flags
+ "-DCAML_NAME_SPACE"
+ (:include c_flags.sexp))
+ (c_library_flags
+ (:include c_library_flags.sexp)))
+
+(rule
+ (target libvirt_version.ml)
+ (action
+ (write-file %{target}
+ "let version = \"%{version:libvirt}\"\nlet package = \"libvirt\"\n")))
+
+(rule
+ (target libvirt_generated.c)
+ (deps generator.pl)
+ (action
+ (run perl -w generator.pl)))
+
+(rule
+ (targets c_flags.sexp c_library_flags.sexp)
+ (deps
+ (:discover config/discover.exe))
+ (action
+ (run %{discover})))

View File

@ -1,7 +1,7 @@
#
# spec file for package ocaml-libvirt
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -21,16 +21,17 @@ Version: 0.6.1.5
Release: 0
%{?ocaml_preserve_bytecode}
Summary: OCaml binding for libvirt
License: LGPL-2.0+
License: LGPL-2.0-or-later
Group: Development/Languages/OCaml
Url: http://libvirt.org/ocaml/
URL: https://opam.ocaml.org/packages/libvirt
Source0: %name-%version.tar.xz
Patch0: ocaml-libvirt.patch
BuildRequires: ocaml
BuildRequires: ocaml-dune
BuildRequires: ocaml-rpm-macros >= 20191101
BuildRequires: ocaml-rpm-macros >= 20220222
BuildRequires: perl
BuildRequires: ocamlfind(dune.configurator)
BuildRequires: ocamlfind(unix)
BuildRequires: perl
BuildRequires: pkgconfig(libvirt)
%description
@ -66,3 +67,5 @@ dune_test_tolerate_fail='dune_test_tolerate_fail'
%_bindir/*
%files devel -f %name.files.devel
%changelog