Hilko Bengen
2014-Sep-14 19:25 UTC
Re: [Libguestfs] ocamldep -all seems to break builds on platforms without a native compiler
* Richard W.M. Jones:> Yes, also this commit doesn't actually fix the problem. I still see > occasional problems building StringMap. I have reverted this commit.Here's another patch that should enable the native-code targets only if they can be built. Cheers, -Hilko
Hilko Bengen
2014-Sep-14 19:25 UTC
[Libguestfs] [PATCH] Generate *.cmx targets only if a native OCaml compiler exists
--- builder/Makefile.am | 2 ++ customize/Makefile.am | 2 ++ mllib/Makefile.am | 2 ++ ocaml/Makefile.am | 4 ++++ resize/Makefile.am | 2 ++ sparsify/Makefile.am | 2 ++ sysprep/Makefile.am | 2 ++ v2v/Makefile.am | 2 ++ 8 files changed, 18 insertions(+) diff --git a/builder/Makefile.am b/builder/Makefile.am index 0ca5db6..eb6295a 100644 --- a/builder/Makefile.am +++ b/builder/Makefile.am @@ -185,8 +185,10 @@ endif $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@ +endif # Manual pages and HTML files for the website. diff --git a/customize/Makefile.am b/customize/Makefile.am index 90234a0..746375d 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -139,8 +139,10 @@ endif $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@ +endif # automake will decide we don't need C support in this file. Really # we do, so we have to provide it ourselves. diff --git a/mllib/Makefile.am b/mllib/Makefile.am index af0fe85..210fc64 100644 --- a/mllib/Makefile.am +++ b/mllib/Makefile.am @@ -118,8 +118,10 @@ endif $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@ +endif # This OCaml module has to be generated by make (configure will put # unexpanded prefix macro in). diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am index 8b9dcfa..94f11ef 100644 --- a/ocaml/Makefile.am +++ b/ocaml/Makefile.am @@ -147,8 +147,10 @@ endif $(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \ $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@ +if HAVE_OCAMLOPT %.opt: %.cmx mlguestfs.cmxa $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@ +endif check-valgrind: $(MAKE) VG="$(top_builddir)/run @VG@" check @@ -160,10 +162,12 @@ guestfs.cmo: guestfs.ml $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package unix -c $< -o $@ %.cmo: %.ml mlguestfs.cma $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -package unix -c $< -o $@ +if HAVE_OCAMLOPT guestfs.cmx: guestfs.ml $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -package unix -c $< -o $@ %.cmx: %.ml mlguestfs.cmxa $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -package unix -c $< -o $@ +endif depend: .depend diff --git a/resize/Makefile.am b/resize/Makefile.am index 91abeee..d1bc46f 100644 --- a/resize/Makefile.am +++ b/resize/Makefile.am @@ -94,8 +94,10 @@ endif $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@ +endif # automake will decide we don't need C support in this file. Really # we do, so we have to provide it ourselves. diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am index bb3bda0..fc2777d 100644 --- a/sparsify/Makefile.am +++ b/sparsify/Makefile.am @@ -95,8 +95,10 @@ virt_sparsify_LINK = \ $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ +endif # Manual pages and HTML files for the website. diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index 7b88ef5..d6dae86 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -155,8 +155,10 @@ endif $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -c $< -o $@ +endif # automake will decide we don't need C support in this file. Really # we do, so we have to provide it ourselves. diff --git a/v2v/Makefile.am b/v2v/Makefile.am index 553b93c..03d7442 100644 --- a/v2v/Makefile.am +++ b/v2v/Makefile.am @@ -164,8 +164,10 @@ virt_v2v_LINK = \ $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ .ml.cmo: $(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ +if HAVE_OCAMLOPT .ml.cmx: $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ +endif # Data directory. -- 2.1.0
Richard W.M. Jones
2014-Sep-14 20:35 UTC
Re: [Libguestfs] [PATCH] Generate *.cmx targets only if a native OCaml compiler exists
ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org