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

mark an installed lib file as executable #2198

Closed
avsm opened this issue May 24, 2019 · 5 comments
Closed

mark an installed lib file as executable #2198

avsm opened this issue May 24, 2019 · 5 comments

Comments

@avsm
Copy link
Member

avsm commented May 24, 2019

While porting ppx_tools to dune, I had to come up with a bit of a hack to support the ocamlfind ppx_tools/rewriter functionality. This depends on having an executable file installed in lib/ppx_tools/rewriter so that its not in the full bin namespace.

Installing it via (install (section lib)) fails at runtime since the files are not executable when installed. I worked around it with:

https://github.com/dune-universe/ppx_tools/blob/to-dune/dune#L41

(install
 (section bin)
 (files
  (ppx_metaquot.exe as ../lib/ppx_tools/ppx_metaquot)
  (rewriter.exe as ../lib/ppx_tools/rewriter)
  (dumpast.exe as ../lib/ppx_tools/dumpast)
  (genlifter.exe as ../lib/ppx_tools/genlifter)))

which works but is a bit ugly, so opening this bug for some better way to express that files in lib can be executable.

avsm added a commit to dune-universe/opam-overlays that referenced this issue May 24, 2019
This mega PR does the following:

- adds cloud.drone.io CI tests to check that all packages are
  coinstallable.  This will ensure that we can always clone all
  the overrides here into a duniverse and have them build.

- to enforce the above, we remove duplicate packages here,
  unlike the stable opam-repo. This implies that we can't do
  fancy opam solver tricks for versions of things, which is
  steadily being solved by adding smarts to dune to differentiate
  based on build variables (e.g. enabled_if in ocaml/dune#2164)
  See tarides/opam-monorepo#3 for more discussion.

We also add dune ports for:

- ppx_tools: has a small ugly tracked in ocaml/dune#2198.

- ocamlfind: splits up the opam packages into a findlib
  opam package that installs the libraries, and ocamlfind that
  installs the binaries (ocamlfind/ocaml wrapper) to work with
  the toplevel.  This one doesn't have all the bells and whistles
  of the upstream, so we will need to port things like bytecode
  only and non-dynlink arches to the dune configurator.

We remove ports which are now upstream, such as psq and lru
@rgrinberg
Copy link
Member

What about using the libexec field?

@avsm
Copy link
Member Author

avsm commented May 25, 2019

Wouldn't that go into the libexec/ directory though, and still require the ../lib/? My understanding is that ocamlfind only looks in lib/<pkg> for the executed binary (but I might be misunderstand how that works -- it seems odd to look in lib/ for executables)

avsm added a commit to dune-universe/opam-overlays that referenced this issue May 25, 2019
This mega PR does the following:

- adds cloud.drone.io CI tests to check that all packages are
  coinstallable.  This will ensure that we can always clone all
  the overrides here into a duniverse and have them build.

- to enforce the above, we remove duplicate packages here,
  unlike the stable opam-repo. This implies that we can't do
  fancy opam solver tricks for versions of things, which is
  steadily being solved by adding smarts to dune to differentiate
  based on build variables (e.g. enabled_if in ocaml/dune#2164)
  See tarides/opam-monorepo#3 for more discussion.

We also add dune ports for:

- ppx_tools: has a small ugly tracked in ocaml/dune#2198.

- ocamlfind: splits up the opam packages into a findlib
  opam package that installs the libraries, and ocamlfind that
  installs the binaries (ocamlfind/ocaml wrapper) to work with
  the toplevel.  This one doesn't have all the bells and whistles
  of the upstream, so we will need to port things like bytecode
  only and non-dynlink arches to the dune configurator.

We remove ports which are now upstream, such as psq and lru
@ghost
Copy link

ghost commented May 27, 2019

The policy is the same as opam: the libexec is the same as the lib section except that files get their executable bit set

avsm added a commit to dune-universe/ppx_tools that referenced this issue Jun 3, 2019
avsm added a commit to avsm/dune that referenced this issue Jun 3, 2019
This is distilled from the opam manual and worth duplicating here
since it describes a metadata format that can be used independently
of opam.

Closes ocaml#2198

Signed-off-by: Anil Madhavapeddy <anil@recoil.org>
@avsm
Copy link
Member Author

avsm commented Jun 3, 2019

Thanks for the clarification. I've submitted a doc PR to close this in #2237 as it wasn't very clear to me before. I'd also never seen the misc section in opam before, which might violate sandboxing...

@ghost
Copy link

ghost commented Jun 4, 2019

Thanks. Yh, I've never used misc either, not sure what it's meant for 😕

@ghost ghost closed this as completed in 2dceaa8 Jun 20, 2019
mlasson pushed a commit to mlasson/dune that referenced this issue Jul 19, 2019
It regroups the various bits about installing things and clarify the
section semantics for file installation.

Closes ocaml#2198

Signed-off-by: Anil Madhavapeddy <anil@recoil.org>
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Co-Authored-By: Etienne Millon <etienne.millon@gmail.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants