On Mon, Aug 12, 2024 at 11:41:22AM +0200, Antonio Caggiano wrote:
 Add INSTALL_OCAMLLIB parameter for allowing ocaml install to a user
 defined path. If not defined, fallback to `ocamlc -where`. 
Can't the usual destdir mechanism be used?
 Signed-off-by: Antonio Caggiano <quic_acaggian(a)quicinc.com>
 ---
  m4/ocaml.m4       |  3 +++
  ocaml/Makefile.am | 14 +++++++-------
  2 files changed, 10 insertions(+), 7 deletions(-)
 
 diff --git a/m4/ocaml.m4 b/m4/ocaml.m4
 index fddd6a0c2..91896f386 100644
 --- a/m4/ocaml.m4
 +++ b/m4/ocaml.m4
 @@ -17,6 +17,9 @@ AC_DEFUN([AC_PROG_OCAML],
       OCAMLVERSION=`$OCAMLC -v | sed -n -e 's|.*version* *\(.*\)$|\1|p'`
       AC_MSG_RESULT([OCaml version is $OCAMLVERSION])
       OCAMLLIB=`$OCAMLC -where 2>/dev/null || $OCAMLC -v|tail -1|cut -d ' ' -f
4`
 +     if test "x$INSTALL_OCAMLLIB" = "x"; then
 +        INSTALL_OCAMLLIB=$OCAMLLIB
 +     fi
       AC_MSG_RESULT([OCaml library path is $OCAMLLIB])
  
       AC_SUBST([OCAMLVERSION]) 
Note this is a copy-in file from another project, I don't know if we
can really modify it here.  (Unfortunately I'm not sure of the
upstream status ...)
Eric, any idea about this?
 diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
 index 63713ee68..f7621a8fa 100644
 --- a/ocaml/Makefile.am
 +++ b/ocaml/Makefile.am
 @@ -185,16 +185,16 @@ 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*
 +	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) 
This part of the change seems reasonable.
Rich.
-- 
Richard Jones, Virtualization Group, Red Hat 
http://people.redhat.com/~rjones
Read my programming and virtualization blog: 
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v