Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building ocaml toplevels with OASIS #546

Open
gildor478 opened this issue Oct 24, 2020 · 0 comments
Open

Building ocaml toplevels with OASIS #546

gildor478 opened this issue Oct 24, 2020 · 0 comments

Comments

@gildor478
Copy link
Member

This feature request has been migrated from artifact #740 on forge.ocamlcore.org. It was assigned to user102.

user145 posted on 2010-09-06 08:53:17:

I have not find how to build an ocaml toplevel using OASIS. The "Executable" section try to compile the target "foo.byte" or "foo.native" but not "foo.top".

user102 replied on 2010-09-06 09:09:03:

Indeed. I need to add a section "Toplevel" just like "Executable".

Sylvain Le Gall

user102 replied on 2010-09-09 13:41:36:

I don't often build toplevels, so I have no real idea how to it the right way.

Could you give me an example? E.g. a toplevel section as should be written in _oasis and the corresponding step to build it (using ocamlbuild maybe).

_oasis:
Toplevel lablgtktop
Path: top/
BuildDepends: lablgtk
XXXX

build:
create a file top/lablgtktop.mltop with content
...

Thank you for you time.

user145 replied on 2010-09-09 14:43:21:

I think the specific fields for toplevel sections should be "Modules", "InternalModules" and maybe "Expunge":

_oasis:
Toplevel lablgtktop
Path: top/
Modules: Gtk_toplevel
InternalModules: Foo, Bar
BuildDepends: lablgtk
Expunge: true

build (without expunge):

  • create a file lablgtktop.mltop containing the list of modules (publics and internals)
  • build the target lablgtktop.top with ocamlbuild
  • copy lablgtktop.top to lablgtktop

note: toplevels must also be linked with the "-linkpkg" switch if using ocamlfind

build (with expunge):

  • create a file lablgtktop.mltop containing the list of modules (publics and internals)
  • build the target lablgtktop.top with ocamlbuild
  • list all modules that should be accessible in the toplevel i.e:
    • all modules of the "Modules" field
    • all public modules of libraries (internals and externals) linked with the toplevel
  • call "expunge lablgtktop.top lablgtktop "

install:

  • install lablgtktop

The expunge phase is not mandatory but it avoids name clashes with internal modules of the compiler (such as Types, Env, ...). The expunge executable is located in the standard library directory.

user102 replied on 2010-09-09 15:28:06:

The difference between InternalModules and Modules is that with expunge, you don't list InternalModules?

How can you list public modules modules of libraries ?

I will use ocamlfind anyway.

user145 replied on 2010-09-09 16:10:25:

The difference between InternalModules and Modules is that with expunge, you don't list InternalModules?

Yes.

How can you list public modules modules of libraries ?

I get the library path with ocamlfind and list .cmi files it contains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant