Add INSTALL_OCAMLLIB parameter for allowing ocaml install to a user
defined path. If not defined, fallback to `ocamlc -where`.

Signed-off-by: Antonio Caggiano <quic_acagg...@quicinc.com>
---
 ocaml/Makefile.am | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 63713ee68..9e94ad446 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -185,16 +185,19 @@ data_hook_files += *.cmx *.cmxa
 endif
 
 install-data-hook:
-       mkdir -p $(DESTDIR)$(OCAMLLIB)
-       mkdir -p $(DESTDIR)$(OCAMLLIB)/stublibs
-       rm -rf $(DESTDIR)$(OCAMLLIB)/guestfs
-       rm -rf $(DESTDIR)$(OCAMLLIB)/stublibs/dllmlguestfs.so*
+       if test "x$INSTALL_OCAMLLIB" = "x"; then
+               INSTALL_OCAMLLIB=$OCAMLLIB
+       fi
+       mkdir -p $(DESTDIR)$(INSTALL_OCAMLLIB)
+       mkdir -p $(DESTDIR)$(INSTALL_OCAMLLIB)/stublibs
+       rm -rf $(DESTDIR)$(INSTALL_OCAMLLIB)/guestfs
+       rm -rf $(DESTDIR)$(INSTALL_OCAMLLIB)/stublibs/dllmlguestfs.so*
        $(OCAMLFIND) install \
-         -ldconf ignore -destdir $(DESTDIR)$(OCAMLLIB) \
+         -ldconf ignore -destdir $(DESTDIR)$(INSTALL_OCAMLLIB) \
          guestfs \
          $(data_hook_files)
-       rm -f $(DESTDIR)$(OCAMLLIB)/guestfs/bindtests.*
-       rm $(DESTDIR)$(OCAMLLIB)/guestfs/libguestfsocaml.a
+       rm -f $(DESTDIR)$(INSTALL_OCAMLLIB)/guestfs/bindtests.*
+       rm $(DESTDIR)$(INSTALL_OCAMLLIB)/guestfs/libguestfsocaml.a
 
 CLEANFILES += $(noinst_DATA) $(check_DATA)
 
-- 
2.45.1
_______________________________________________
Libguestfs mailing list -- guestfs@lists.libguestfs.org
To unsubscribe send an email to guestfs-le...@lists.libguestfs.org

Reply via email to