caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] for-pack, ocamlbuild and polluted namespace
@ 2011-06-03 10:14 Pietro Abate
  0 siblings, 0 replies; only message in thread
From: Pietro Abate @ 2011-06-03 10:14 UTC (permalink / raw)
  To: caml-list

Hello,

I'm trying to fix the build system of my project to fit the
debian policy, but I having few problems with ocamlbuild...
I'm using the ocaml 3.12.

suppose I've 3 modules. A, B, C where

A does not have any dependencies
B depends on A
and C depends on A and B.

assume further that B and C use the same file name for a submodule.
the situation looks like :

A/a.ml
B/aa.ml B/b1.ml
C/aa.ml C/c1.ml

I want to build three libraries avoiding name space clashes using
for-pack. So at the end of the compilation I will have.

A.cmxa (containing A/A.cmx)
B.cmxa (containing B/Aa.cmx , B/B1.cmx)
C.cmxa (containing C/Aa.cmx , C/C1.cmx)

now using ocamlbuild I set up a _tags file with

<b/*.ml> or <b/*.mli>: use_a
<c/*.ml> or <c/*.mli>: use_a, use_b

<a/*.cmx> : for-pack(A)
<b/*.cmx> : for-pack(B)
<c/*.cmx> : for-pack(C)
-------

and my myocmamlbuild looks like :

open Ocamlbuild_plugin;;
ocaml_lib ~dir:"a" "a/a";
ocaml_lib ~dir:"b" "b/b";
ocaml_lib ~dir:"c" "c/c";

-----
so far so good. 

A.cmxa is ok, no dependencies.
B.cmxa is also ok. The problem is with C.cmxa that tries to resolve its
dependencies with the interface of the wrong module in b (b/Aa.cmi)
instead of the module in c (this is because of the -I b added by the
ocaml_lib directive). Of course this is just a leftover of the
compilation since everything is already packed. I don't need the cmi of
the individual submodules. If I remove _build/b/Aa.* by hand everything
works as expected...

my question is : How can write an ocamlbuild rule to remove all the 
submodules leftover in the directory _build/b leaving only the cmi of
the packed module ? Or more generally, would not be a good idea to
remove these leftovers automatically is -for-pack is used to put all
submodules together ?

Reg the first question what I need is a way to get the list of all the
submodules and then issuing a rm_f command after packing the library...
but how can I get this list ?

thanks,
pietro

-- 
----
http://en.wikipedia.org/wiki/Posting_style

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-03 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-03 10:14 [Caml-list] for-pack, ocamlbuild and polluted namespace Pietro Abate

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).