caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] OASIS help
       [not found] <4912b1d7-c491-9462-2220-c08492d1833d@inria.fr>
@ 2016-11-10  9:27 ` Francois BERENGER
  2016-11-10  9:49   ` Laurent Thévenoux
  0 siblings, 1 reply; 10+ messages in thread
From: Francois BERENGER @ 2016-11-10  9:27 UTC (permalink / raw)
  To: caml-list

On 11/10/2016 10:08 AM, Laurent Thévenoux wrote:
> Hello,
> 
> I’m trying to use OASIS to configure a project written in OCaml. I currently use a Makefile which works fine but doesn’t allow enough possibilities. My project uses the menhir parser but OASIS attempts to use ocamlyacc. 
> 
> How can I specify that I need to run ocamlbuild with -use-menhir instead of ocamlyacc ?

Put a BUILFLAGS line as the first line of your Makefile:

---
BUILDFLAGS = " -use-menhir "
# OASIS_START
[...]
---

This part of the Makefile will be kept by oasis.

-- 
Regards,
Francois.
"When in doubt, use more types"

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

* Re: [Caml-list] OASIS help
  2016-11-10  9:27 ` [Caml-list] OASIS help Francois BERENGER
@ 2016-11-10  9:49   ` Laurent Thévenoux
  2016-11-10  9:52     ` Francois BERENGER
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Thévenoux @ 2016-11-10  9:49 UTC (permalink / raw)
  To: Francois BERENGER; +Cc: caml-list

OASIS doesn’t generate me a Makefile. Here my _oasis file (a very basic start):

—
OASISFormat: 0.4
Name:        name
Version:     0.1
Synopsis:    synopsis
Authors:     Laurent
License:     CeCILL

Executable exe
  Path:       src
  BuildTools: ocamlbuild
  BuildDepends: str
  MainIs:     main.ml
—

Then, I run oasis setup, and, ocaml setup.ml -configure, and finally, ocaml setup.ml -build.

It fails during the build because ocamlyacc is called to build a menhir parser.

Did I miss anything?

—
Laurent

> Le 10 nov. 2016 à 10:27, Francois BERENGER <francois.berenger@inria.fr> a écrit :
> 
> On 11/10/2016 10:08 AM, Laurent Thévenoux wrote:
>> Hello,
>> 
>> I’m trying to use OASIS to configure a project written in OCaml. I currently use a Makefile which works fine but doesn’t allow enough possibilities. My project uses the menhir parser but OASIS attempts to use ocamlyacc. 
>> 
>> How can I specify that I need to run ocamlbuild with -use-menhir instead of ocamlyacc ?
> 
> Put a BUILFLAGS line as the first line of your Makefile:
> 
> ---
> BUILDFLAGS = " -use-menhir "
> # OASIS_START
> [...]
> ---
> 
> This part of the Makefile will be kept by oasis.
> 
> -- 
> Regards,
> Francois.
> "When in doubt, use more types"
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


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

* Re: [Caml-list] OASIS help
  2016-11-10  9:49   ` Laurent Thévenoux
@ 2016-11-10  9:52     ` Francois BERENGER
  2016-11-11 10:52       ` Bikal Gurung
  0 siblings, 1 reply; 10+ messages in thread
From: Francois BERENGER @ 2016-11-10  9:52 UTC (permalink / raw)
  Cc: caml-list

On 11/10/2016 10:49 AM, Laurent Thévenoux wrote:
> OASIS doesn’t generate me a Makefile. Here my _oasis file (a very basic start):

Sorry, I forgot: add this line after your License line in your _oasis file:
Plugins: DevFiles (0.4)

cf. http://oasis.forge.ocamlcore.org/MANUAL.html#plugin-devfiles-extra

> —
> OASISFormat: 0.4
> Name:        name
> Version:     0.1
> Synopsis:    synopsis
> Authors:     Laurent
> License:     CeCILL
> 
> Executable exe
>   Path:       src
>   BuildTools: ocamlbuild
>   BuildDepends: str
>   MainIs:     main.ml
> —
> 
> Then, I run oasis setup, and, ocaml setup.ml -configure, and finally, ocaml setup.ml -build.
> 
> It fails during the build because ocamlyacc is called to build a menhir parser.
> 
> Did I miss anything?
> 
> —
> Laurent
> 
>> Le 10 nov. 2016 à 10:27, Francois BERENGER <francois.berenger@inria.fr> a écrit :
>>
>> On 11/10/2016 10:08 AM, Laurent Thévenoux wrote:
>>> Hello,
>>>
>>> I’m trying to use OASIS to configure a project written in OCaml. I currently use a Makefile which works fine but doesn’t allow enough possibilities. My project uses the menhir parser but OASIS attempts to use ocamlyacc. 
>>>
>>> How can I specify that I need to run ocamlbuild with -use-menhir instead of ocamlyacc ?
>>
>> Put a BUILFLAGS line as the first line of your Makefile:
>>
>> ---
>> BUILDFLAGS = " -use-menhir "
>> # OASIS_START
>> [...]
>> ---
>>
>> This part of the Makefile will be kept by oasis.
>>
>> -- 
>> Regards,
>> Francois.
>> "When in doubt, use more types"
>>
>> -- 
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 

-- 
Regards,
Francois.
"When in doubt, use more types"

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

* Re: [Caml-list] OASIS help
  2016-11-10  9:52     ` Francois BERENGER
@ 2016-11-11 10:52       ` Bikal Gurung
  0 siblings, 0 replies; 10+ messages in thread
From: Bikal Gurung @ 2016-11-11 10:52 UTC (permalink / raw)
  To: Francois BERENGER; +Cc: caml-list

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

Alternatively, you could edit _tags file the following after calling oasis
setup.

# OASIS_START
# DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e)
# OASIS_STOP
*true : use_menhir, explain*

On Thu, Nov 10, 2016 at 9:52 AM, Francois BERENGER <
francois.berenger@inria.fr> wrote:

> On 11/10/2016 10:49 AM, Laurent Thévenoux wrote:
> > OASIS doesn’t generate me a Makefile. Here my _oasis file (a very basic
> start):
>
> Sorry, I forgot: add this line after your License line in your _oasis file:
> Plugins: DevFiles (0.4)
>
> cf. http://oasis.forge.ocamlcore.org/MANUAL.html#plugin-devfiles-extra
>
> > —
> > OASISFormat: 0.4
> > Name:        name
> > Version:     0.1
> > Synopsis:    synopsis
> > Authors:     Laurent
> > License:     CeCILL
> >
> > Executable exe
> >   Path:       src
> >   BuildTools: ocamlbuild
> >   BuildDepends: str
> >   MainIs:     main.ml
> > —
> >
> > Then, I run oasis setup, and, ocaml setup.ml -configure, and finally,
> ocaml setup.ml -build.
> >
> > It fails during the build because ocamlyacc is called to build a menhir
> parser.
> >
> > Did I miss anything?
> >
> > —
> > Laurent
> >
> >> Le 10 nov. 2016 à 10:27, Francois BERENGER <francois.berenger@inria.fr>
> a écrit :
> >>
> >> On 11/10/2016 10:08 AM, Laurent Thévenoux wrote:
> >>> Hello,
> >>>
> >>> I’m trying to use OASIS to configure a project written in OCaml. I
> currently use a Makefile which works fine but doesn’t allow enough
> possibilities. My project uses the menhir parser but OASIS attempts to use
> ocamlyacc.
> >>>
> >>> How can I specify that I need to run ocamlbuild with -use-menhir
> instead of ocamlyacc ?
> >>
> >> Put a BUILFLAGS line as the first line of your Makefile:
> >>
> >> ---
> >> BUILDFLAGS = " -use-menhir "
> >> # OASIS_START
> >> [...]
> >> ---
> >>
> >> This part of the Makefile will be kept by oasis.
> >>
> >> --
> >> Regards,
> >> Francois.
> >> "When in doubt, use more types"
> >>
> >> --
> >> Caml-list mailing list.  Subscription management and archives:
> >> https://sympa.inria.fr/sympa/arc/caml-list
> >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> >> Bug reports: http://caml.inria.fr/bin/caml-bugs
> >
>
> --
> Regards,
> Francois.
> "When in doubt, use more types"
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/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: 5527 bytes --]

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

* [Caml-list] OASIS help
@ 2016-11-10  9:08 Laurent Thévenoux
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Thévenoux @ 2016-11-10  9:08 UTC (permalink / raw)
  To: caml-list

Hello,

I’m trying to use OASIS to configure a project written in OCaml. I currently use a Makefile which works fine but doesn’t allow enough possibilities. My project uses the menhir parser but OASIS attempts to use ocamlyacc. 

How can I specify that I need to run ocamlbuild with -use-menhir instead of ocamlyacc ?

Regards,
Laurent Thévenoux

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

* Re: [Caml-list] oasis help
  2015-02-10 13:19 ` Jeremie Dimino
@ 2015-02-10 14:07   ` Jiten Pathy
  0 siblings, 0 replies; 10+ messages in thread
From: Jiten Pathy @ 2015-02-10 14:07 UTC (permalink / raw)
  To: Jeremie Dimino; +Cc: caml-list

Thanks. ocamlbuild seems to have a nice plugin api.

I ended up using
tag_file "target.ml" [Printf.sprintf "open(%s)" module_name]

On Tue, Feb 10, 2015 at 5:19 AM, Jeremie Dimino <jdimino@janestreet.com> wrote:
> You can access the oasis environment from myocamlbuild.ml and setup
> compilation flags according to it. See for instance:
>
>   https://github.com/janestreet/bin_prot/blob/master/myocamlbuild.ml
>
> So you could have this in your _oasis:
>
>   Flag use_b
>   Default: false
>
> And in your myocamlbuild.ml:
>
> ----------------------------------
> (* OASIS_START *)
> (* OASIS_STOP *)
>
> let dispatch = function
>   | After_rules ->
>     let env = BaseEnvLight.load () in
>     let module_name = if BaseEnvLight.var_get "use_b" = "true" then "B" else
> "A" in
>     flag ["ocaml"; "compile"] (S ["-open"; module_name])
>   | _ ->
>     ()
>
> let () = Ocamlbuild_plugin.dispatch (fun hook -> dispatch hook;
> dispatch_default hook)
> ----------------------------------
>
>
> On Tue, Feb 10, 2015 at 12:58 PM, Jiten Pathy <jpathy@fssrv.net> wrote:
>>
>> I have two modules defining the same function.
>> How would i conditionally open modules during compilation using oasis
>> /ocamlbuild?(i.e pass -open A or -open B depending on some flag from
>> oasis?)
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>
>
> --
> Jeremie

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

* Re: [Caml-list] oasis help
  2015-02-10 12:58 [Caml-list] oasis help Jiten Pathy
@ 2015-02-10 13:19 ` Jeremie Dimino
  2015-02-10 14:07   ` Jiten Pathy
  0 siblings, 1 reply; 10+ messages in thread
From: Jeremie Dimino @ 2015-02-10 13:19 UTC (permalink / raw)
  To: Jiten Pathy; +Cc: caml-list

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

You can access the oasis environment from myocamlbuild.ml and setup
compilation flags according to it. See for instance:

  https://github.com/janestreet/bin_prot/blob/master/myocamlbuild.ml

So you could have this in your _oasis:

  Flag use_b
  Default: false

And in your myocamlbuild.ml:

----------------------------------
(* OASIS_START *)
(* OASIS_STOP *)

let dispatch = function
  | After_rules ->
    let env = BaseEnvLight.load () in
    let module_name = if BaseEnvLight.var_get "use_b" = "true" then "B"
else "A" in
    flag ["ocaml"; "compile"] (S ["-open"; module_name])
  | _ ->
    ()

let () = Ocamlbuild_plugin.dispatch (fun hook -> dispatch hook;
dispatch_default hook)
----------------------------------


On Tue, Feb 10, 2015 at 12:58 PM, Jiten Pathy <jpathy@fssrv.net> wrote:

> I have two modules defining the same function.
> How would i conditionally open modules during compilation using oasis
> /ocamlbuild?(i.e pass -open A or -open B depending on some flag from
> oasis?)
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>



-- 
Jeremie

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

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

* [Caml-list] oasis help
@ 2015-02-10 12:58 Jiten Pathy
  2015-02-10 13:19 ` Jeremie Dimino
  0 siblings, 1 reply; 10+ messages in thread
From: Jiten Pathy @ 2015-02-10 12:58 UTC (permalink / raw)
  To: caml-list

I have two modules defining the same function.
How would i conditionally open modules during compilation using oasis
/ocamlbuild?(i.e pass -open A or -open B depending on some flag from
oasis?)

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

* Re: [Caml-list] OASIS help
  2013-11-06 16:09 [Caml-list] OASIS help Robert Soulé
@ 2013-11-10 21:08 ` Sylvain Le Gall
  0 siblings, 0 replies; 10+ messages in thread
From: Sylvain Le Gall @ 2013-11-10 21:08 UTC (permalink / raw)
  To: caml-list

On 06-11-2013, Robert Soulé <soule@cs.cornell.edu> wrote:
>
> --001a11c2f8b65c13b804ea84601f
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello,
>
> I am trying to create an _oasis file with a Test section. My test will
> call an executable that is built in an Executable section. The test
> executable links agains links against my project library, which uses
> some c code. My oasis file is attached.
>
> When I run "oasis setup" and then "make", everything works fine. I see
> Test.native in my directory, as I would expect.
>
> However, I run into problems when I run "make test":
>
> $ ocaml setup.ml -test
> W: Tests are turned off, consider enabling with 'ocaml setup.ml
> -configure --enable-tests'
>
> $ ocaml setup.ml -configure --enable-tests
> ocamlfind: Package `with-c' not found
> W: Field 'pkg_with_c' is not set: Command
> ''/Users/soule/.opam/4.00.1/bin/ocamlfind' query -format %d with-c >
> '/var/folders/q1/hc432vx951b6dlfrvybzm4d40000gn/T/oasis-c91777.txt''
> terminated with error code 2
> E: Cannot find findlib package with-c
> E: Failure("1 configuration error")
>
> Is there an extra Field I need to add in the Test section if I am
> running an executable that links against C code?
>

The _oasis file you send is partial, I see no definition of with-c or
mylibwithc. As far as I read, I think the part you send us is fine.
(well you may not set Run: true).

Can you send us a more complete _oasis ?

Cheers,
Sylvain Le Gall
-- 
Website:     http://sylvain.le-gall.net/
OCaml forge: http://forge.ocamlcore.org
OCaml blogs: http://planet.ocaml.org


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

* [Caml-list] OASIS help
@ 2013-11-06 16:09 Robert Soulé
  2013-11-10 21:08 ` Sylvain Le Gall
  0 siblings, 1 reply; 10+ messages in thread
From: Robert Soulé @ 2013-11-06 16:09 UTC (permalink / raw)
  To: caml-list

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

Hello,

I am trying to create an _oasis file with a Test section. My test will
call an executable that is built in an Executable section. The test
executable links agains links against my project library, which uses
some c code. My oasis file is attached.

When I run "oasis setup" and then "make", everything works fine. I see
Test.native in my directory, as I would expect.

However, I run into problems when I run "make test":

$ ocaml setup.ml -test
W: Tests are turned off, consider enabling with 'ocaml setup.ml
-configure --enable-tests'

$ ocaml setup.ml -configure --enable-tests
ocamlfind: Package `with-c' not found
W: Field 'pkg_with_c' is not set: Command
''/Users/soule/.opam/4.00.1/bin/ocamlfind' query -format %d with-c >
'/var/folders/q1/hc432vx951b6dlfrvybzm4d40000gn/T/oasis-c91777.txt''
terminated with error code 2
E: Cannot find findlib package with-c
E: Failure("1 configuration error")

Is there an extra Field I need to add in the Test section if I am
running an executable that links against C code?

thank you,
Robert

[-- Attachment #2: _oasis --]
[-- Type: application/octet-stream, Size: 281 bytes --]

Executable test
 Install: false
 Build$: flag(is_native)
 Path:       test
 MainIs:     Test.ml
 CompiledObject: native
 BuildDepends:
   oUnit,
   pa_ounit,
   pa_ounit.syntax,
   mylibwithc

Test all_tests
  Type: Custom (0.0.1)
  Command: $test
  Run: true
  TestTools: test




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

end of thread, other threads:[~2016-11-11 10:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4912b1d7-c491-9462-2220-c08492d1833d@inria.fr>
2016-11-10  9:27 ` [Caml-list] OASIS help Francois BERENGER
2016-11-10  9:49   ` Laurent Thévenoux
2016-11-10  9:52     ` Francois BERENGER
2016-11-11 10:52       ` Bikal Gurung
2016-11-10  9:08 Laurent Thévenoux
  -- strict thread matches above, loose matches on Subject: below --
2015-02-10 12:58 [Caml-list] oasis help Jiten Pathy
2015-02-10 13:19 ` Jeremie Dimino
2015-02-10 14:07   ` Jiten Pathy
2013-11-06 16:09 [Caml-list] OASIS help Robert Soulé
2013-11-10 21:08 ` Sylvain Le Gall

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