From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id F2F3CBC6B for ; Wed, 7 Nov 2007 17:02:05 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.21,385,1188770400"; d="scan'208";a="3996125" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail2-relais-roc.national.inria.fr with SMTP; 07 Nov 2007 17:02:05 +0100 Received: by ausone.inria.fr (sSMTP sendmail emulation); Wed, _d Nov 2007 17:01:26 +0100 From: "Nicolas Pouillard" Cc: caml-list Subject: Re: [Caml-list] Ocamlbuild plugins To: Dario Teixeira References: <600766.97480.qm@web54604.mail.re2.yahoo.com> In-Reply-To: <600766.97480.qm@web54604.mail.re2.yahoo.com> Date: Wed, 07 Nov 2007 17:01:26 +0100 Message-Id: <1194450072-sup-4055@port-ext2.ensta.fr> User-Agent: Sup/0.2 Content-Type: text/plain; charset=UTF-8 X-Spam: no; 0.00; camlp:01 ocamlfind:01 ocamlfind:01 -package:01 ocamlc:01 ocamlc:01 ocamlopt:01 ocamlopt:01 ocamldep:01 ocamldep:01 flags:01 -package:01 camlp:01 ocaml:01 flags:01 Excerpts from Dario Teixeira's message of Wed Nov 07 14:39:19 +0100 2007: > Hi, > > > (...) > > Sadly you're right. As always any help/contribution will be appreciated :) > > Well, I'll do my part: once I grok Ocamlbuild I'll profusely document > the myocamlbuild.ml for my project. > > Anyway, thanks again for your help. I have at the moment a myocamlbuild.ml > that can handle almost everything I need; the only bit that isn't working > is precisely the part that handles camlp4. So, here's the myocamlbuild.ml: > ______________________________________________________________ > > open Ocamlbuild_plugin > open Command > > let ocamlfind x = > let packages = "calendar, ocsigen" 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 -> > 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; > flag ["ocaml"; "link"] (A"-linkpkg") > | _ -> () > end;; > ______________________________________________________________ > > I also have a _tags file with just one line: > "database.ml": use_pgocaml_statements, thread > > And this is the error I get when I run "ocamlbuild database.cmo": > ______________________________________________________________ > > + ocamlfind ocamldep -package 'calendar, ocsigen' -package pgocaml.statements > -syntax camlp4o -pp '-package pgocaml.statements -syntax camlp4o' -modules > database.ml > database.ml.depends > Warning: -pp overrides the effect of -syntax partly > sh: Illegal option -p > Preprocessing error on file database.ml > Command exited with code 2. Arg too bad, that's an ocamlbuild bug. I didn't see it since I always use -pp and not -syntax of ocamlfind. You should try to use the .cmo of your syntax extension. Use these declarations and replace pa_openin.cmo by the cmo of pgocaml.statements. (* One add pa_openin.cmo to the ocaml pre-processor when use_opening is set *) flag ["ocaml"; "pp"; "use_openin"] (A"pa_openin.cmo"); (* Running ocamldep on ocaml code that is tagged use_openin will require the cmo *) dep ["ocaml"; "ocamldep"; "use_openin"] ["pa_openin.cmo"]; Let me know if it works... -- Nicolas Pouillard aka Ertai