caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@gmail.com>
To: Sebastien Mondet <sebastien.mondet@gmail.com>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] oasis, inter-dependent libraries and syntax extension
Date: Tue, 1 Nov 2011 11:33:38 +0100	[thread overview]
Message-ID: <CAOOOohTBCyYOoz_xUTDkr1NJOXsGBfQ=nTwRGibsHjS3Wj=apw@mail.gmail.com> (raw)
In-Reply-To: <CAOOOohQcEXYXCQm3FQUPEkAGWu_A+gw4MHwRn5KX8LO16rEE8g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2860 bytes --]

I found a workaround in lwt, which is to add some code in myocamlbuild.ml,
outside the generated part, to define appropriate tags that can then be
used in _tags (more generally, lwt has several interesting tricks about
oasis). For the record, here is how you can use a syntax extension
internally, inside a package:

open Ocamlbuild_plugin

let () =
  dispatch
    (fun hook ->
       dispatch_default hook;
       match hook with
         | Before_options ->
             Options.make_links := false

         | After_rules ->
             (* Internal syntax extension *)
             List.iter
               (fun base ->
                  let tag = "pa_" ^ base and file = "src/syntax/pa_" ^ base
^ ".cmo" in
                  flag ["ocaml"; "compile"; tag] & S[A"-ppopt"; A file];
                  flag ["ocaml"; "ocamldep"; tag] & S[A"-ppopt"; A file];
                  flag ["ocaml"; "doc"; tag] & S[A"-ppopt"; A file];
                  dep ["ocaml"; "ocamldep"; tag] [file])
               ["syntax_ext1";"syntax_ext2"]; (* add your syntax extensions
here *)
         | _ ->
             ())



2011/10/31 Philippe Veber <philippe.veber@gmail.com>

> Sébastien's suggestion is indeed a good start but alas for me not enough.
> The build still fails at ocamldep time, because the library B (with the
> syntax extension) seems not to be taken into account. If I replace my
> syntax extension with some findlib package (say tyxml), the compilation
> works fine. So the question remains, how can I specify that a
> library/executable in a package depends on a syntax extension that is
> defined as a library of the same package?
>
> Thanks to oasisdb, I've browsed a couple of packages that could be in the
> same situation, like a test executable for a syntax extension, but found
> none. Maybe I'm not dealing correctly with the situation ?
>
> ph.
>
>
> 2011/10/31 Sebastien Mondet <sebastien.mondet@gmail.com>
>
>>
>> Hi
>>
>>
>> I ran into the same problem last week.
>> I added a line to the _tags file after the OASIS-generated stuff:
>>
>>    ...
>>     # OASIS_STOP
>>
>>    <src/*/*.ml>: syntax_camlp4o
>>
>>
>> (found in the slide 18:
>> http://oasis.forge.ocamlcore.org/documentation.html )
>>
>>
>> Sebastien
>>
>>
>>
>>
>>
>>
>> On Mon, Oct 31, 2011 at 12:23, Philippe Veber <philippe.veber@gmail.com>wrote:
>>
>>> Hi,
>>> I have an oasis project defining three inter-dependent libraries A, B
>>> and C. B is a syntax extension, and depends on A. C depends on both A and
>>> B. I have written an _oasis file for this, which works fine if I don't use
>>> the extension in C, but fails if I do, during ocamldep (ocamldep lacks the
>>> appropriate options to understand the new syntax). Has anybody run into
>>> this problem ?
>>>
>>> ph.
>>>
>>>
>>
>

[-- Attachment #2: Type: text/html, Size: 6470 bytes --]

  reply	other threads:[~2011-11-01 10:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 16:23 Philippe Veber
2011-10-31 16:40 ` Sebastien Mondet
2011-10-31 20:09   ` Philippe Veber
2011-11-01 10:33     ` Philippe Veber [this message]
2011-11-02 10:08       ` [Caml-list] " Sylvain Le Gall
2011-11-02 10:33         ` Philippe Veber

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='CAOOOohTBCyYOoz_xUTDkr1NJOXsGBfQ=nTwRGibsHjS3Wj=apw@mail.gmail.com' \
    --to=philippe.veber@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=sebastien.mondet@gmail.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).