[Libguestfs] [nbdkit PATCH] ocaml: Make build VPATH aware
Richard W.M. Jones
rjones at redhat.com
Thu Nov 29 22:42:40 UTC 2018
On Thu, Nov 29, 2018 at 04:35:22PM -0600, Eric Blake wrote:
> The ocaml.opt compiler defaults to building things in the same
> directory as its input; we need explicit -o options to build
> in a VPATH $(builddir) when $(srcdir) is read-only (as is the
> case during 'make distcheck'). We also have to build any side
> effect files explicitly in cases where we can't directly use -o
> to control those outputs alongside the final product.
>
> Thanks: Richard W.M. Jones
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>
> I'm working on getting 'make distcheck' happy (in general, it
> fails because we aren't set up for VPATH builds yet). I'm pushing
> the small and obvious patches when I spot them, but for stuff
> where I'm less certain, I'll post to the list as well. This is
> what Rich helped me come up with on IRC for the ocaml failures.
>
> plugins/ocaml/Makefile.am | 4 ++--
> tests/Makefile.am | 4 +++-
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/plugins/ocaml/Makefile.am b/plugins/ocaml/Makefile.am
> index 484d041..b95f255 100644
> --- a/plugins/ocaml/Makefile.am
> +++ b/plugins/ocaml/Makefile.am
> @@ -43,10 +43,10 @@ ocamllibdir = $(OCAMLLIB)
> ocamllib_DATA = NBDKit.mli NBDKit.cmi NBDKit.cmx NBDKit.o
>
> NBDKit.cmi: NBDKit.mli
> - $(OCAMLC) -c $<
> + $(OCAMLC) -c $< -o $@
>
> NBDKit.cmx: NBDKit.ml NBDKit.cmi
> - $(OCAMLOPT) $(OCAMLOPTFLAGS) -c $<
> + $(OCAMLOPT) $(OCAMLOPTFLAGS) -c $< -o $@
> NBDKit.o: NBDKit.cmx
>
> # NB: libnbdkitocaml is not plugin. It's a library that you have to
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 4e16fa9..94f3d43 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -517,7 +517,9 @@ test_ocaml_CFLAGS = \
> test_ocaml_LDADD = libtest.la $(LIBGUESTFS_LIBS)
>
> check_SCRIPTS += test-ocaml-plugin.so
> -test-ocaml-plugin.so: test_ocaml_plugin.ml ../plugins/ocaml/libnbdkitocaml.la ../plugins/ocaml/NBDKit.cmi ../plugins/ocaml/NBDKit.cmx
> +test_ocaml_plugin.cmx: test_ocaml_plugin.ml
> + $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml -c $< -o $@
> +test-ocaml-plugin.so: test_ocaml_plugin.cmx ../plugins/ocaml/libnbdkitocaml.la ../plugins/ocaml/NBDKit.cmi ../plugins/ocaml/NBDKit.cmx
> $(OCAMLOPT) $(OCAMLOPTFLAGS) -I ../plugins/ocaml \
> -output-obj -runtime-variant _pic -o $@ \
> NBDKit.cmx $< \
> --
This is fine, ACK.
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/
More information about the Libguestfs
mailing list