From: Dario Teixeira <darioteixeira@yahoo.com>
To: caml-list@yquem.inria.fr
Subject: Ocamlbuild with findlib + camlp4
Date: Wed, 5 Mar 2008 13:41:11 +0000 (GMT) [thread overview]
Message-ID: <644528.65296.qm@web54604.mail.re2.yahoo.com> (raw)
Hi,
I'm trying to create an Ocamlbuild plugin for an application that uses
PG'OCaml. This library relies on a Camlp4 syntax extension, and comes by
default with a META file for findlib that enables one to simply type on the
command line:
ocamlfind ocamlc -package pgocaml.statements -syntax camlp4o -c test.ml
I still don't grok Ocamlbuild quite enough to automate this behaviour.
The best I have so far is the plugin below; it adds support for findlib, and
creates a "use_pgocaml" tag that explicitly loads all the modules required by
the syntax extension. Note that "use_pgocaml" makes no use of the findlib
support; while it works, this is of course hackish and ugly. Ideally,
"use_pgocaml" should simply tell ocamlbuild to use findlib to automatically
load all the modules.
Any ideas on how this could be achieved? (And incidentally, I vote for
"built-in findlib support" as my #1 wish for Ocamlbuild).
Thanks in advance!
Dario Teixeira
##############################################################################
open Ocamlbuild_plugin
open Command
let ocamlfind x =
let packages = "pcre,extlib,lwt,ocsigen,pgocaml,json-wheel" in
S[A"ocamlfind"; x; A"-package"; A packages];;
dispatch begin function
| Before_options ->
Options.ocamlc := ocamlfind & A"ocamlc";
Options.ocamlopt := ocamlfind & A"ocamlopt";
Options.ocamldep := ocamlfind & A"ocamldep"
| After_rules ->
flag ["ocaml"; "link"] (A"-linkpkg");
let root = "/home/dario/.godi/lib/ocaml/" in
let str = root ^ "std-lib/str.cma"
and pcre = root ^ "pkg-lib/pcre/pcre.cma"
and extlib = root ^ "pkg-lib/extlib/extLib.cma"
and calendar = root ^ "pkg-lib/calendar/calendar.cma"
and csv = root ^ "pkg-lib/csv/csv.cma"
and pgocaml = root ^ "site-lib/pgocaml/pgocaml.cma"
and pa_pgsql = root ^ "site-lib/pgocaml/pa_pgsql.cmo" in
flag ["ocaml"; "pp"; "use_pgsql"] (S[A str; A pcre; A extlib; A
calendar; A csv; A pgocaml; A pa_pgsql])
| _ -> ()
end;;
##############################################################################
___________________________________________________________
Rise to the challenge for Sport Relief with Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/
next reply other threads:[~2008-03-05 13:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 13:41 Dario Teixeira [this message]
2008-03-05 15:08 ` [Caml-list] " Romain Bardou
2008-03-06 15:31 ` Dario Teixeira
2008-03-06 15:46 ` Pietro Abate
2008-03-06 19:45 ` Dario Teixeira
2008-03-06 22:14 ` Pietro Abate
2008-03-07 9:26 ` Romain Bardou
2008-03-07 14:46 ` Dario Teixeira
2008-03-07 15:01 ` Nicolas Pouillard
2008-03-07 16:12 ` Dario Teixeira
2008-03-08 11:36 ` Nicolas Pouillard
2008-03-10 15:33 ` Dario Teixeira
2008-03-10 16:15 ` Romain Bardou
2008-03-10 21:13 ` Dario Teixeira
2008-03-10 19:56 ` Arnaud Spiwack
2008-03-10 21:15 ` Dario Teixeira
2008-03-11 10:37 ` Nicolas Pouillard
2008-03-11 13:49 ` Romain Bardou
2008-03-11 15:03 ` Romain Bardou
2008-03-11 17:32 ` Dario Teixeira
2008-03-11 20:17 ` Richard Jones
2008-03-11 10:41 ` Nicolas Pouillard
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=644528.65296.qm@web54604.mail.re2.yahoo.com \
--to=darioteixeira@yahoo.com \
--cc=caml-list@yquem.inria.fr \
/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