[Libguestfs] [PATCH 1/4] More fixes for situations where ocamlopt is not available
Richard W.M. Jones
rjones at redhat.com
Tue Mar 4 07:56:21 UTC 2014
On Tue, Mar 04, 2014 at 12:07:29AM +0100, Hilko Bengen wrote:
> - run bindtests.opt only if available
> - use ocamlc -custom
> - Don't try to install native code if it hasn't been built (Thanks to Olaf Hering)
> ---
> mllib/Makefile.am | 2 +-
> ocaml/Makefile.am | 7 ++++++-
> ocaml/examples/Makefile.am | 11 ++++-------
> ocaml/run-bindtests | 2 ++
> 4 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/mllib/Makefile.am b/mllib/Makefile.am
> index 2e35d1e..0e317b2 100644
> --- a/mllib/Makefile.am
> +++ b/mllib/Makefile.am
> @@ -176,7 +176,7 @@ common_utils_tests: common_gettext.cmx common_utils.cmx common_utils_tests.cmx
> else
> common_utils_tests: common_gettext.cmo common_utils.cmo common_utils_tests.cmo
> $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
> - mlguestfs.cma -linkpkg $^ -cclib -lncurses -o $@
> + mlguestfs.cma -linkpkg $^ -cclib -lncurses -custom -o $@
> endif
>
> TESTS_ENVIRONMENT = $(top_builddir)/run --test
> diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
> index 708b2e7..7c8e515 100644
> --- a/ocaml/Makefile.am
> +++ b/ocaml/Makefile.am
> @@ -171,13 +171,18 @@ depend: .depend
> SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly
>
> # Do the installation by hand, because we want to run ocamlfind.
> +data_hook_files = META *.so *.a *.cma *.cmi $(srcdir)/*.mli
> +if HAVE_OCAMLOPT
> +data_hook_files += *.cmx *.cmxa
> +endif
> +
> install-data-hook:
> mkdir -p $(DESTDIR)$(OCAMLLIB)
> mkdir -p $(DESTDIR)$(OCAMLLIB)/stublibs
> $(OCAMLFIND) install \
> -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
> guestfs \
> - META *.so *.a *.cma *.cmx *.cmxa *.cmi $(srcdir)/*.mli
> + $(data_hook_files)
> rm $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
> rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
>
> diff --git a/ocaml/examples/Makefile.am b/ocaml/examples/Makefile.am
> index 472e180..de647fc 100644
> --- a/ocaml/examples/Makefile.am
> +++ b/ocaml/examples/Makefile.am
> @@ -58,16 +58,13 @@ inspect_vm: inspect_vm.ml
> $(OCAMLFIND) ocamlopt $(OCAMLFINDFLAGS) -package unix -linkpkg \
> -warn-error A -I .. mlguestfs.cmxa $< -o $@
> else
> -
> -# This avoids:
> -# Error: Error on dynamically loaded library: ../dllmlguestfs.so: libguestfs.so.0: cannot open shared object file: No such file or directory
> create_disk: create_disk.ml
> - $(top_builddir)/run $(OCAMLFIND) ocamlc $(OCAMLFINDFLAGS) -package unix -linkpkg \
> - -warn-error A -I .. mlguestfs.cma $< -o $@
> + $(OCAMLFIND) ocamlc $(OCAMLFINDFLAGS) -package unix -linkpkg \
> + -warn-error A -I .. mlguestfs.cma -custom $< -o $@
>
> inspect_vm: inspect_vm.ml
> - $(top_builddir)/run $(OCAMLFIND) ocamlc $(OCAMLFINDFLAGS) -package unix -linkpkg \
> - -warn-error A -I .. mlguestfs.cma $< -o $@
> + $(OCAMLFIND) ocamlc $(OCAMLFINDFLAGS) -package unix -linkpkg \
> + -warn-error A -I .. mlguestfs.cma -custom $< -o $@
> endif
>
> endif
> diff --git a/ocaml/run-bindtests b/ocaml/run-bindtests
> index 3b73e8d..1fa54ec 100755
> --- a/ocaml/run-bindtests
> +++ b/ocaml/run-bindtests
> @@ -21,5 +21,7 @@ set -e
> ./bindtests.bc > bindtests.tmp
> diff -u $srcdir/../bindtests bindtests.tmp
>
> +test -x ./bindtests.opt || exit 0
> +
> ./bindtests.opt > bindtests.tmp
> diff -u $srcdir/../bindtests bindtests.tmp
> --
> 1.9.0
ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
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