build: Allow OCaml programs using libguestfs to be compiled against build dir.

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.
This commit is contained in:
Richard W.M. Jones
2020-03-10 15:02:30 +00:00
parent e33b3c83a0
commit bf61bf7355
3 changed files with 21 additions and 1 deletions

1
.gitignore vendored
View File

@@ -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

View File

@@ -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_S) . $@
endif HAVE_OCAML

2
run.in
View File

@@ -227,6 +227,8 @@ export MALLOC_PERTURB_=$random_val
# local libguestfs.
prepend PKG_CONFIG_PATH "$b/lib/local"
export PKG_CONFIG_PATH
prepend OCAMLPATH "$b/ocaml"
export OCAMLPATH
# Do we have libtool? If we have it then we can use it to make
# running valgrind simpler. However don't depend on it.