caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] oasis, inter-dependent libraries and syntax extension
@ 2011-10-31 16:23 Philippe Veber
  2011-10-31 16:40 ` Sebastien Mondet
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Veber @ 2011-10-31 16:23 UTC (permalink / raw)
  To: caml users

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

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: 416 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] oasis, inter-dependent libraries and syntax extension
  2011-10-31 16:23 [Caml-list] oasis, inter-dependent libraries and syntax extension Philippe Veber
@ 2011-10-31 16:40 ` Sebastien Mondet
  2011-10-31 20:09   ` Philippe Veber
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastien Mondet @ 2011-10-31 16:40 UTC (permalink / raw)
  To: Philippe Veber; +Cc: caml users

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

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: 1377 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] oasis, inter-dependent libraries and syntax extension
  2011-10-31 16:40 ` Sebastien Mondet
@ 2011-10-31 20:09   ` Philippe Veber
  2011-11-01 10:33     ` Philippe Veber
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Veber @ 2011-10-31 20:09 UTC (permalink / raw)
  To: Sebastien Mondet; +Cc: caml users

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

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: 2497 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] oasis, inter-dependent libraries and syntax extension
  2011-10-31 20:09   ` Philippe Veber
@ 2011-11-01 10:33     ` Philippe Veber
  2011-11-02 10:08       ` [Caml-list] " Sylvain Le Gall
  0 siblings, 1 reply; 6+ messages in thread
From: Philippe Veber @ 2011-11-01 10:33 UTC (permalink / raw)
  To: Sebastien Mondet; +Cc: caml users

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Caml-list] Re: oasis, inter-dependent libraries and syntax extension
  2011-11-01 10:33     ` Philippe Veber
@ 2011-11-02 10:08       ` Sylvain Le Gall
  2011-11-02 10:33         ` Philippe Veber
  0 siblings, 1 reply; 6+ messages in thread
From: Sylvain Le Gall @ 2011-11-02 10:08 UTC (permalink / raw)
  To: caml-list

Hello,

You are indeed right, syntax extensions remain a second class citizen.
I'll need to fix that situation.

Please report this problem to the bug tracker, along with your solution
(which seems fine). I'll try to implement it in 0.3.

Cheers
Sylvain Le Gall

On 01-11-2011, Philippe Veber <philippe.veber@gmail.com> wrote:
>
> --20cf307abebda8d83d04b0a9e43e
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
>
> 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 () =3D
>   dispatch
>     (fun hook ->
>        dispatch_default hook;
>        match hook with
>          | Before_options ->
>              Options.make_links :=3D false
>
>          | After_rules ->
>              (* Internal syntax extension *)
>              List.iter
>                (fun base ->
>                   let tag =3D "pa_" ^ base and file =3D "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=E9bastien's suggestion is indeed a good start but alas for me not enoug=
> h.
>> 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 a=
> nd
>>>> 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.
>>>>
>>>>
>>>
>>
>
> --=20
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
> --20cf307abebda8d83d04b0a9e43e
> Content-Type: text/html; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
>
> I found a workaround in lwt, which is to add some code in <a href=3D"http:/=
> /myocamlbuild.ml">myocamlbuild.ml</a>, outside the generated part, to defin=
> e 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 ca=
> n use a syntax extension internally, inside a package:<br>
>
><br><span style=3D"font-family: courier new,monospace;">open Ocamlbuild_plu=
> gin</span><br style=3D"font-family: courier new,monospace;"><br style=3D"fo=
> nt-family: courier new,monospace;"><span style=3D"font-family: courier new,=
> monospace;">let () =3D</span><br style=3D"font-family: courier new,monospac=
> e;">
>
><span style=3D"font-family: courier new,monospace;">=A0 dispatch</span><br =
> style=3D"font-family: courier new,monospace;"><span style=3D"font-family: c=
> ourier new,monospace;">=A0=A0=A0 (fun hook -&gt;</span><br style=3D"font-fa=
> mily: courier new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0 disp=
> atch_default hook;</span><br style=3D"font-family: courier new,monospace;">=
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0 matc=
> h hook with</span><br style=3D"font-family: courier new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0 | Before_options -&gt;</span><br style=3D"font-family: courier new,mono=
> space;"><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0=A0=A0 Options.make_links :=3D false</span><br style=3D"font=
> -family: courier new,monospace;">
>
><br style=3D"font-family: courier new,monospace;"><span style=3D"font-famil=
> y: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0 | After_rules -&gt;</sp=
> an><br style=3D"font-family: courier new,monospace;"><span style=3D"font-fa=
> mily: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (* Inter=
> nal syntax extension *)</span><br style=3D"font-family: courier new,monospa=
> ce;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0 List.iter</span><br style=3D"font-family: courier new,monos=
> pace;"><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0=A0=A0=A0=A0 (fun base -&gt;</span><br style=3D"font-family:=
>  courier new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 let tag =3D &quot;pa_&quot; ^ base and file =
>=3D &quot;src/syntax/pa_&quot; ^ base ^ &quot;.cmo&quot; in</span><br style=
>=3D"font-family: courier new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag [&quot;ocaml&quot;; &quot;compile&quot;=
> ; tag] &amp; S[A&quot;-ppopt&quot;; A file];</span><br style=3D"font-family=
>: courier new,monospace;"><span style=3D"font-family: courier new,monospace=
> ;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag [&quot;ocaml&qu=
> ot;; &quot;ocamldep&quot;; tag] &amp; S[A&quot;-ppopt&quot;; A file];</span=
>><br style=3D"font-family: courier new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag [&quot;ocaml&quot;; &quot;doc&quot;; ta=
> g] &amp; S[A&quot;-ppopt&quot;; A file];</span><br style=3D"font-family: co=
> urier new,monospace;"><span style=3D"font-family: courier new,monospace;">=
>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dep [&quot;ocaml&quot;;=
>  &quot;ocamldep&quot;; tag] [file])</span><br style=3D"font-family: courier=
>  new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0=A0=A0=A0=A0=A0=A0 [&quot;syntax_ext1&quot;;&quot;syntax_ext2&quot;];</s=
> pan> <span style=3D"font-family: courier new,monospace;">(* add your syntax=
>  extensions here *)</span><br style=3D"font-family: courier new,monospace;">
>
><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
>=A0 | _ -&gt;</span><br style=3D"font-family: courier new,monospace;"><span=
>  style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=
>=A0=A0=A0 ())</span><br style=3D"font-family: courier new,monospace;">
>
><br><br><br><div class=3D"gmail_quote">2011/10/31 Philippe Veber <span dir=
>=3D"ltr">&lt;<a href=3D"mailto:philippe.veber@gmail.com">philippe.veber@gma=
> il.com</a>&gt;</span><br><blockquote class=3D"gmail_quote" style=3D"margin:=
> 0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
>
> S=E9bastien&#39;s suggestion is indeed a good start but alas for me not eno=
> ugh. The build still fails at ocamldep time, because the library B (with th=
> e syntax extension) seems not to be taken into account. If I replace my syn=
> tax 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?<br>
>
>
><br>Thanks to oasisdb, I&#39;ve browsed a couple of packages that could be =
> in the same situation, like a test executable for a syntax extension, but f=
> ound none. Maybe I&#39;m not dealing correctly with the situation ?<br>
>
>
><br>ph.<div><div></div><div class=3D"h5"><br><br><div class=3D"gmail_quote"=
>>2011/10/31 Sebastien Mondet <span dir=3D"ltr">&lt;<a href=3D"mailto:sebast=
> ien.mondet@gmail.com" target=3D"_blank">sebastien.mondet@gmail.com</a>&gt;<=
> /span><br>
>
><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
> x #ccc solid;padding-left:1ex">
><div><br></div><div>Hi</div><div><br></div><div><br></div><div>I ran into t=
> he same problem last week.</div><div>I added a line to the _tags file after=
>  the OASIS-generated stuff:</div><div><div><br></div><div>=A0 =A0...</div>
>
><div>
>
>
>=A0 =A0# OASIS_STOP</div><div><br></div><div>=A0 =A0&lt;src/*/*.ml&gt;: syn=
> tax_camlp4o</div></div><div><br></div><div><br></div><div>(found in the sli=
> de 18:</div><div><a href=3D"http://oasis.forge.ocamlcore.org/documentation.=
> html" target=3D"_blank">http://oasis.forge.ocamlcore.org/documentation.html=
></a>=A0)</div>
>
>
>
>
><div><br></div><font color=3D"#888888"><div><br></div><div>Sebastien</div><=
> /font><div><div></div><div><div><br></div><div><br></div><div><br></div><di=
> v><br></div><br><br><div class=3D"gmail_quote">On Mon, Oct 31, 2011 at 12:2=
> 3, Philippe Veber <span dir=3D"ltr">&lt;<a href=3D"mailto:philippe.veber@gm=
> ail.com" target=3D"_blank">philippe.veber@gmail.com</a>&gt;</span> wrote:<b=
> r>
>
>
>
>
><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
> x #ccc solid;padding-left:1ex">Hi,<br>I have an oasis project defining thre=
> e inter-dependent libraries A, B and C. B is a syntax extension, and depend=
> s on A. C depends on both A and B. I have written an _oasis file for this, =
> which works fine if I don&#39;t use the extension in C, but fails if I do, =
> during ocamldep (ocamldep lacks the appropriate options to understand the n=
> ew syntax). Has anybody run into this problem ?<br>
>
>
>
>
>
>
><br>ph.<br><br>
></blockquote></div><br>
></div></div></blockquote></div><br>
></div></div></blockquote></div><br>
>
> --20cf307abebda8d83d04b0a9e43e--
>

Cheers,
Sylvain Le Gall
-- 
My company: http://www.ocamlcore.com
Linkedin:   http://fr.linkedin.com/in/sylvainlegall
Start an OCaml project here: http://forge.ocamlcore.org
OCaml blogs:                 http://planet.ocamlcore.org



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] Re: oasis, inter-dependent libraries and syntax extension
  2011-11-02 10:08       ` [Caml-list] " Sylvain Le Gall
@ 2011-11-02 10:33         ` Philippe Veber
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Veber @ 2011-11-02 10:33 UTC (permalink / raw)
  To: Sylvain Le Gall; +Cc: caml-list

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

Done:
https://forge.ocamlcore.org/tracker/index.php?func=detail&aid=1050&group_id=54&atid=291
I find oasis particularly useful, tell me if there is something else I can
do on this.
ph.


2011/11/2 Sylvain Le Gall <sylvain@le-gall.net>

> Hello,
>
> You are indeed right, syntax extensions remain a second class citizen.
> I'll need to fix that situation.
>
> Please report this problem to the bug tracker, along with your solution
> (which seems fine). I'll try to implement it in 0.3.
>
> Cheers
> Sylvain Le Gall
>
> On 01-11-2011, Philippe Veber <philippe.veber@gmail.com> wrote:
> >
> > --20cf307abebda8d83d04b0a9e43e
> > Content-Type: text/plain; charset=ISO-8859-1
> > Content-Transfer-Encoding: quoted-printable
> >
> > 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 () =3D
> >   dispatch
> >     (fun hook ->
> >        dispatch_default hook;
> >        match hook with
> >          | Before_options ->
> >              Options.make_links :=3D false
> >
> >          | After_rules ->
> >              (* Internal syntax extension *)
> >              List.iter
> >                (fun base ->
> >                   let tag =3D "pa_" ^ base and file =3D "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=E9bastien's suggestion is indeed a good start but alas for me not
> enoug=
> > h.
> >> 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
> a=
> > nd
> >>>> 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.
> >>>>
> >>>>
> >>>
> >>
> >
> > --=20
> > Caml-list mailing list.  Subscription management and archives:
> > https://sympa-roc.inria.fr/wws/info/caml-list
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> >
> >
> > --20cf307abebda8d83d04b0a9e43e
> > Content-Type: text/html; charset=ISO-8859-1
> > Content-Transfer-Encoding: quoted-printable
> >
> > I found a workaround in lwt, which is to add some code in <a
> href=3D"http:/=
> > /myocamlbuild.ml">myocamlbuild.ml</a>, outside the generated part, to
> defin=
> > e 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
> ca=
> > n use a syntax extension internally, inside a package:<br>
> >
> ><br><span style=3D"font-family: courier new,monospace;">open
> Ocamlbuild_plu=
> > gin</span><br style=3D"font-family: courier new,monospace;"><br
> style=3D"fo=
> > nt-family: courier new,monospace;"><span style=3D"font-family: courier
> new,=
> > monospace;">let () =3D</span><br style=3D"font-family: courier
> new,monospac=
> > e;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0
> dispatch</span><br =
> > style=3D"font-family: courier new,monospace;"><span
> style=3D"font-family: c=
> > ourier new,monospace;">=A0=A0=A0 (fun hook -&gt;</span><br
> style=3D"font-fa=
> > mily: courier new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0
> disp=
> > atch_default hook;</span><br style=3D"font-family: courier
> new,monospace;">=
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0
> matc=
> > h hook with</span><br style=3D"font-family: courier new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0 | Before_options -&gt;</span><br style=3D"font-family: courier
> new,mono=
> > space;"><span style=3D"font-family: courier
> new,monospace;">=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0=A0=A0 Options.make_links :=3D false</span><br
> style=3D"font=
> > -family: courier new,monospace;">
> >
> ><br style=3D"font-family: courier new,monospace;"><span
> style=3D"font-famil=
> > y: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0 | After_rules
> -&gt;</sp=
> > an><br style=3D"font-family: courier new,monospace;"><span
> style=3D"font-fa=
> > mily: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (*
> Inter=
> > nal syntax extension *)</span><br style=3D"font-family: courier
> new,monospa=
> > ce;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0 List.iter</span><br style=3D"font-family: courier
> new,monos=
> > pace;"><span style=3D"font-family: courier
> new,monospace;">=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0=A0=A0=A0=A0 (fun base -&gt;</span><br
> style=3D"font-family:=
> >  courier new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 let tag =3D &quot;pa_&quot; ^ base and
> file =
> >=3D &quot;src/syntax/pa_&quot; ^ base ^ &quot;.cmo&quot; in</span><br
> style=
> >=3D"font-family: courier new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag [&quot;ocaml&quot;;
> &quot;compile&quot;=
> > ; tag] &amp; S[A&quot;-ppopt&quot;; A file];</span><br
> style=3D"font-family=
> >: courier new,monospace;"><span style=3D"font-family: courier
> new,monospace=
> > ;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag
> [&quot;ocaml&qu=
> > ot;; &quot;ocamldep&quot;; tag] &amp; S[A&quot;-ppopt&quot;; A
> file];</span=
> >><br style=3D"font-family: courier new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 flag [&quot;ocaml&quot;; &quot;doc&quot;;
> ta=
> > g] &amp; S[A&quot;-ppopt&quot;; A file];</span><br style=3D"font-family:
> co=
> > urier new,monospace;"><span style=3D"font-family: courier
> new,monospace;">=
> >=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 dep
> [&quot;ocaml&quot;;=
> >  &quot;ocamldep&quot;; tag] [file])</span><br style=3D"font-family:
> courier=
> >  new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0=A0=A0=A0=A0=A0=A0
> [&quot;syntax_ext1&quot;;&quot;syntax_ext2&quot;];</s=
> > pan> <span style=3D"font-family: courier new,monospace;">(* add your
> syntax=
> >  extensions here *)</span><br style=3D"font-family: courier
> new,monospace;">
> >
> ><span style=3D"font-family: courier new,monospace;">=A0=A0=A0=A0=A0=A0=A0=
> >=A0 | _ -&gt;</span><br style=3D"font-family: courier
> new,monospace;"><span=
> >  style=3D"font-family: courier
> new,monospace;">=A0=A0=A0=A0=A0=A0=A0=A0=A0=
> >=A0=A0=A0 ())</span><br style=3D"font-family: courier new,monospace;">
> >
> ><br><br><br><div class=3D"gmail_quote">2011/10/31 Philippe Veber <span
> dir=
> >=3D"ltr">&lt;<a href=3D"mailto:philippe.veber@gmail.com
> ">philippe.veber@gma=
> > il.com</a>&gt;</span><br><blockquote class=3D"gmail_quote"
> style=3D"margin:=
> > 0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> >
> > S=E9bastien&#39;s suggestion is indeed a good start but alas for me not
> eno=
> > ugh. The build still fails at ocamldep time, because the library B (with
> th=
> > e syntax extension) seems not to be taken into account. If I replace my
> syn=
> > tax 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?<br>
> >
> >
> ><br>Thanks to oasisdb, I&#39;ve browsed a couple of packages that could
> be =
> > in the same situation, like a test executable for a syntax extension,
> but f=
> > ound none. Maybe I&#39;m not dealing correctly with the situation ?<br>
> >
> >
> ><br>ph.<div><div></div><div class=3D"h5"><br><br><div
> class=3D"gmail_quote"=
> >>2011/10/31 Sebastien Mondet <span dir=3D"ltr">&lt;<a href=3D"mailto:
> sebast=
> > ien.mondet@gmail.com" target=3D"_blank">sebastien.mondet@gmail.com
> </a>&gt;<=
> > /span><br>
> >
> ><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
> .8ex;border-left:1p=
> > x #ccc solid;padding-left:1ex">
> ><div><br></div><div>Hi</div><div><br></div><div><br></div><div>I ran into
> t=
> > he same problem last week.</div><div>I added a line to the _tags file
> after=
> >  the OASIS-generated stuff:</div><div><div><br></div><div>=A0
> =A0...</div>
> >
> ><div>
> >
> >
> >=A0 =A0# OASIS_STOP</div><div><br></div><div>=A0 =A0&lt;src/*/*.ml&gt;:
> syn=
> > tax_camlp4o</div></div><div><br></div><div><br></div><div>(found in the
> sli=
> > de 18:</div><div><a href=3D"
> http://oasis.forge.ocamlcore.org/documentation.=
> > html" target=3D"_blank">
> http://oasis.forge.ocamlcore.org/documentation.html=
> ></a>=A0)</div>
> >
> >
> >
> >
> ><div><br></div><font
> color=3D"#888888"><div><br></div><div>Sebastien</div><=
> >
> /font><div><div></div><div><div><br></div><div><br></div><div><br></div><di=
> > v><br></div><br><br><div class=3D"gmail_quote">On Mon, Oct 31, 2011 at
> 12:2=
> > 3, Philippe Veber <span dir=3D"ltr">&lt;<a href=3D"mailto:
> philippe.veber@gm=
> > ail.com" target=3D"_blank">philippe.veber@gmail.com</a>&gt;</span>
> wrote:<b=
> > r>
> >
> >
> >
> >
> ><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0
> .8ex;border-left:1p=
> > x #ccc solid;padding-left:1ex">Hi,<br>I have an oasis project defining
> thre=
> > e inter-dependent libraries A, B and C. B is a syntax extension, and
> depend=
> > s on A. C depends on both A and B. I have written an _oasis file for
> this, =
> > which works fine if I don&#39;t use the extension in C, but fails if I
> do, =
> > during ocamldep (ocamldep lacks the appropriate options to understand
> the n=
> > ew syntax). Has anybody run into this problem ?<br>
> >
> >
> >
> >
> >
> >
> ><br>ph.<br><br>
> ></blockquote></div><br>
> ></div></div></blockquote></div><br>
> ></div></div></blockquote></div><br>
> >
> > --20cf307abebda8d83d04b0a9e43e--
> >
>
> Cheers,
> Sylvain Le Gall
> --
> My company: http://www.ocamlcore.com
> Linkedin:   http://fr.linkedin.com/in/sylvainlegall
> Start an OCaml project here: http://forge.ocamlcore.org
> OCaml blogs:                 http://planet.ocamlcore.org
>
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-02 10:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-31 16:23 [Caml-list] oasis, inter-dependent libraries and syntax extension Philippe Veber
2011-10-31 16:40 ` Sebastien Mondet
2011-10-31 20:09   ` Philippe Veber
2011-11-01 10:33     ` Philippe Veber
2011-11-02 10:08       ` [Caml-list] " Sylvain Le Gall
2011-11-02 10:33         ` Philippe Veber

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).