[PATCH v3] ocaml: INSTALL_OCAMLLIB Makefile parameter
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_acaggian@quicinc.com> --- m4/guestfs-ocaml.m4 | 4 ++++ ocaml/Makefile.am | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 index 25b06408c..6696db5bb 100644 --- a/m4/guestfs-ocaml.m4 +++ b/m4/guestfs-ocaml.m4 @@ -210,3 +210,7 @@ OCAML_WARN_ERROR="-warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X+52-3-6 -w -6" AC_SUBST([OCAML_WARN_ERROR]) OCAML_FLAGS="-g -annot $safe_string_option" AC_SUBST([OCAML_FLAGS]) + +if test "x$INSTALL_OCAMLLIB" = "x"; then + INSTALL_OCAMLLIB=$OCAMLLIB +fi 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) -- 2.45.1
On Mon, Aug 12, 2024 at 04:42:43PM +0200, Antonio Caggiano wrote:
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_acaggian@quicinc.com> --- m4/guestfs-ocaml.m4 | 4 ++++ ocaml/Makefile.am | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 index 25b06408c..6696db5bb 100644 --- a/m4/guestfs-ocaml.m4 +++ b/m4/guestfs-ocaml.m4 @@ -210,3 +210,7 @@ OCAML_WARN_ERROR="-warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X+52-3-6 -w -6" AC_SUBST([OCAML_WARN_ERROR]) OCAML_FLAGS="-g -annot $safe_string_option" AC_SUBST([OCAML_FLAGS]) + +if test "x$INSTALL_OCAMLLIB" = "x"; then + INSTALL_OCAMLLIB=$OCAMLLIB +fi
Eric, does this need AC_SUBST? I'm a bit unclear on the rules for that ... Rich.
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)
-- 2.45.1
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
On Mon, Aug 12, 2024 at 04:32:14PM GMT, Richard W.M. Jones wrote:
On Mon, Aug 12, 2024 at 04:42:43PM +0200, Antonio Caggiano wrote:
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_acaggian@quicinc.com> --- m4/guestfs-ocaml.m4 | 4 ++++ ocaml/Makefile.am | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4 index 25b06408c..6696db5bb 100644 --- a/m4/guestfs-ocaml.m4 +++ b/m4/guestfs-ocaml.m4 @@ -210,3 +210,7 @@ OCAML_WARN_ERROR="-warn-error +C+D+E+F+L+M+P+S+U+V+Y+Z+X+52-3-6 -w -6" AC_SUBST([OCAML_WARN_ERROR]) OCAML_FLAGS="-g -annot $safe_string_option" AC_SUBST([OCAML_FLAGS]) + +if test "x$INSTALL_OCAMLLIB" = "x"; then + INSTALL_OCAMLLIB=$OCAMLLIB +fi
Eric, does this need AC_SUBST? I'm a bit unclear on the rules for that ...
As written, INSTALL_OCAMLLIB is only defined as a shell variable for the duration of running ./configure.
Rich.
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)
Since you want it to last longer, by this use of as a $(INSTALL_OCAMLLIB) make substitution, then you do indeed nooed AC_SUBST back in configure.ac. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org
participants (3)
-
Antonio Caggiano -
Eric Blake -
Richard W.M. Jones