caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: Dario Teixeira <darioteixeira@yahoo.com>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Ocamlbuild plugins
Date: Tue, 06 Nov 2007 20:29:30 +0100	[thread overview]
Message-ID: <1194376648-sup-4076@ausone.local> (raw)
In-Reply-To: <402653.93475.qm@web54603.mail.re2.yahoo.com>

Excerpts from Dario Teixeira's message of Tue Nov 06 17:23:01 +0100 2007:
> Hi,
> 
> And thanks a lot for your reply!
> 
> > On  my  page [1] there is also a plugin example [2] and the API [3],
> > where the module  signature [4] can be a good starting point about what
> > tools we have in an ocamlbuild plugin.
> 
> I had seen those; what was missing was an overview of what exactly was
> a plugin, and how it was supposed to be called -- the big picture stuff.
> 
> 
> > There  is  certainly  some  missing pieces. Roughly an ocamlbuild plugin
> > is an OCaml  module  called  Myocamlbuild  that should take place a
> > the root of your project  (myocamlbuild.ml).  Automatically  ocamlbuild
> > will take care of it by compiling  it  and  by  making  a  myocamlbuild
> > binary  that is the classical ocamlbuild plus your module.
> 
> Yeap, I kind of assumed something like that was going on, though of course
> I wasn't sure about the details.  This little piece of information would
> have made a huge difference if it was included in the documentation!
> 
> Also, when introducing a new library, it is always good practice to fully
> qualify values.  I know that for people used to a library this might
> seem like a waste of time, but for those learning it makes everything
> a lot clearer.
> 
> 
> > Firstly since you want to use ocamlfind you should start with this plugin
> 
> I have looked into it, but it has one huge problem: it assumes that all
> files will use the same packages.  Though in practice it doesn't hurt
> to pass unnecessary packages to the compiler, it's still killing a fly*
> with a bazooka.  Moreover, while the comment at the bottom of that page
> addresses this issue ("A more fine grained version can provide specific
> -package options depending on the compiled file. This can be easily
> done using the tag system"), I find the use of "this can easily be done"
> a bit ironic given the present meagerness of Ocamlbuild's documentation...

At this time, you're right.

> >  let flags in = S[A"-package"; A"pgocaml.statements"; A"-syntax"; 
> A"camlp4o"] in
> >  flag ["ocaml"; "compile"; "use_pgocaml_statements"];
> >  flag ["ocaml"; "ocamldep"; "use_pgocaml_statements"];
> >
> >  You can then tag your files in the _tags file:
> >
> >  "database.ml": use_pgocaml_statements, thread
> 
> Yap, that was precisely what I wanted to express.  Though I am having
> trouble parsing that example you just gave.  Is "flag" the function
> "flag" from module Flags, or just a misspelling of the "flags" value
> you just declared?  Also, "let flags in" doesn't seem grammatical.
> (This just illustrates the need of always using fully qualified values
> when giving examples!).

Sorry this example is totally badly wrote (due to the lack of email type checking).

Here is a correct one:

open Ocamlbuild_plugin;;
open Command;;
dispatch begin function
| After_rules ->
    let some_flags =
      S[A"-package"; A"pgocaml.statements"; A"-syntax"; A"camlp4o"]
    in
    flag ["ocaml"; "compile"; "use_pgocaml_statements"]  some_flags;
    flag ["ocaml"; "ocamldep"; "use_pgocaml_statements"] some_flags;
| _ -> ()
end;;

flag  [1]  refer  to  Ocamlbuild_plugin.flag  that  is  an  exported alias for
Ocamlbuild_pack.Flags.flag.

[1]: http://gallium.inria.fr/~pouillar/ocamlbuild/html/Signatures.PLUGIN.html

> >  I don't know if GODI properly install as many things as ocamlbuild needs.
> 
> I would assume it does, but perhaps the GODI folks can enlighten us on that?

Does anyone use ocamlbuild with plugins with a GODI setup?

> Anyway, thanks again for your help, and I hope you'll find the time
> to expand a little on the user guide...

I hope too.

>  It seems the biggest obstacle
> to a wider adoption of Ocamlbuild is the lack of proper documentation
> (a common complaint in the OCaml world, unfortunately).

Sadly you're right. As always any help/contribution will be appreciated :)

-- 
Nicolas Pouillard aka Ertai


  reply	other threads:[~2007-11-06 19:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05 20:34 Dario Teixeira
2007-11-06 14:23 ` [Caml-list] " Nicolas Pouillard
2007-11-06 16:23   ` Dario Teixeira
2007-11-06 19:29     ` Nicolas Pouillard [this message]
2007-11-07 13:39       ` Dario Teixeira
2007-11-07 16:01         ` Nicolas Pouillard
2007-11-07 16:07       ` Alan Falloon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1194376648-sup-4076@ausone.local \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=darioteixeira@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).