[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] Fwd: [Xen-devel] [PATCH v3 2/2] tools/ocaml: Fix library generation


  • To: xen-api@xxxxxxxxxxxxx
  • From: Vincent Bernardoff <vb@xxxxxxxxxxxxxx>
  • Date: Mon, 15 Apr 2013 17:27:21 +0100
  • Delivery-date: Mon, 15 Apr 2013 16:27:37 +0000
  • List-id: User and development list for XCP and XAPI <xen-api.lists.xen.org>

This is a patch I sent to the xen-devel list. Dave, Jon, can you please comment on it ?

Thanks in advance,

Vincent


-------- Original Message --------
Subject: [Xen-devel] [PATCH v3 2/2] tools/ocaml: Fix library generation
Date: Mon, 15 Apr 2013 17:02:41 +0100
From: Vincent Bernardoff <vincent.bernardoff@xxxxxxxxxx>
To: <xen-devel@xxxxxxxxxxxxx>
CC: Vincent Bernardoff <vincent.bernardoff@xxxxxxxxxx>

* Summary of changes:

 - .cma are created by using ocamlc with the -dllib -l<libname> option
   that will make a bytecode OCaml program link against <libname> at
   runtime. The -cclib/-ccopt options are only used in "custom
   runtime" mode, which we do not use, so I removed them. I changed
   <libname>.so to -l<libname>, as ocamlc only supports (according to
   its documentation) arguments in the form -l<libname> for -dllib.

- $(CC) -shared is used in lieu and place of $(OCAMLMKLIB). ocamlmklib
  do not provide enough flexibility for doing what we want,
  i.e. linking against specific .so libraries that we give in the
  command line. Using $(CC) directly addresses this issue.

Signed-off-by: Vincent Bernardoff <vincent.bernardoff@xxxxxxxxxx>
---
 tools/ocaml/Makefile.rules |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5e6d81e..1ff5e43 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -54,18 +54,18 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $

mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
- $(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2,MKLIB,$1) + $(call quiet-command, $(AR) rcs $1 $2 && $(CC) -shared -o dll`basename $1 .a | sed -e 's/^lib//'`.so $2 $3,MKLIB,$1)

 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
  $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
  $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo)
- $(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs, $$+)
+       $(call mk-caml-lib-bytecode,$$@, -dllib -l$(1)_stubs, $$+)
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
        $(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-       $(call mk-caml-lib-stubs,$$@, $$+)
+       $(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 endef

 define OCAML_NOC_LIBRARY_template
--
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel




_______________________________________________
Xen-api mailing list
Xen-api@xxxxxxxxxxxxx
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.