On Tuesday, 10 March 2020 16:05:19 CET Richard W.M. Jones wrote:
You have to use:
../libguestfs/run ./configure
../libguestfs/run make
Use of the second ../libguestfs/run against make is unfortunate but I
believe it's unavoidable due to the way that ocamlfind works.
Or a simplier:
$ /path/to/libguestfs/run bash -i
$ ./configure
$ make
$ [etc]
---
.gitignore | 1 +
ocaml/Makefile.am | 19 ++++++++++++++++++-
run.in | 2 ++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 1ebc5421f..cdc90453c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -379,6 +379,7 @@ Makefile.in
/ocaml/examples/guestfs-ocaml.3
/ocaml/examples/inspect_vm
/ocaml/examples/stamp-guestfs-ocaml.pod
+/ocaml/guestfs
/ocaml/guestfs-c-actions.c
/ocaml/guestfs-c-errnos.c
/ocaml/guestfs.ml
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index c85efee64..c02246270 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -197,4 +197,21 @@ install-data-hook:
CLEANFILES += $(noinst_DATA) $(check_DATA)
-endif
+# This "tricks" ocamlfind into allowing us to compile other OCaml
+# programs against a locally compiled copy of the libguestfs sources.
+# ocamlfind needs to see a directory called ‘guestfs’ which contains
+# ‘META’. The current directory is called ‘ocaml’, but if we make
+# this symlink then we can create the required directory structure.
+#
+# Note if you just want to use this, make sure you use
+# ‘../libguestfs/run make’ in your other program and everything should
+# just work.
+CLEANFILES += guestfs
+
+all-local: guestfs
+
+guestfs:
+ rm -f $@
+ ln -sf . $@
The '.' might be better replaced by $(srcdir) instead, although it will
only matter when building libguestfs with builddir!=srcdir, and then
anything against that uninstalled libguestfs.
The rest LGTM.
--
Pino Toscano