Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocamlbuild plugins
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dario Teixeira <darioteixeira@y...>
Subject: Ocamlbuild plugins
Hi,

(I sent a similar message to this ocaml-beginner's list, but I have the
feeling this will require the assistance of some heavy-weights...)

First, -- and sorry if the answer is obvious -- I still haven't been able
to find Ocamlbuild's documentation about the construction of plugins.  All
I discovered about Ocamlbuild is a brief presentation, the (incomplete)
user manual, and the wiki, which are found at the following addresses:

http://gallium.inria.fr/~pouillar/ocamlbuild/ocamlbuild-presentation.html
http://gallium.inria.fr/~pouillar/ocamlbuild/ocamlbuild-user-guide.html
http://brion.inria.fr/gallium/index.php/Ocamlbuild

Now, the wiki has a few example plugins, and I've tried to dissect
them, but I still have this nagging feeling there must be somewhere
some documentation that introduces how these plugins work.  I've been
cursing at google for a while now, so I am asking directly on this
list -- where are those missing pieces?  (It's okay if they're not
in English)

Anyway, what I intend to do is actually very simple.  In "classic"
makefile notation it is expressed as follows:  (note the use of findlib)

database.cmo: database.ml
        PGDATABASE=lambdium ocamlfind ocamlc -package
threads,pgocaml.statements -syntax camlp4o -thread -c $<

So basically I declare an environment variable PGDATABASE, and
invoke the compiler (via findlib) with a Camlp4 preprocessing stage.
(The pgocaml.statements package instructs findlib about the module to
use for Camlp4; the contents of findlib's META file are listed at the
end of this message).

I've been looking at how to encode this in Ocamlbuild but I've tripped
over some basic problems.  First, how are plugins invoked?  Second,
I cannot find the "Ocamlbuild_plugin" module that is opened by all the
examples (I am using GODI).  Third, how do I even start to implement
the Ocamlbuild code to compile the code above?

Thanks in advance for your help!
Cheers,
Dario Teixeira

________________________________________________________________________________
name="pgocaml"
version="1.0"
description="PG'OCaml is a set of OCaml bindings for the PostgreSQL database."
requires="unix,extlib,csv,pcre,calendar"
archive(byte)="pgocaml.cma"
archive(native)="pgocaml.cmxa"

package "statements" (
  requires = "pgocaml,camlp4"
  version = "1.0"
  description = "Syntax extension: PostgreSQL statements checked at
compile-time"
  archive(syntax,preprocessor) = "pa_pgsql.cmo"
  archive(syntax,toploop) = "pa_pgsql.cmo"
)






      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/