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

depext: is there support for passing options to the OS package manager? #4343

Open
anton-trunov opened this issue Sep 4, 2020 · 5 comments

Comments

@anton-trunov
Copy link

Hi! I have a use case where to build an OCaml package depending on an foreign library, I need to pass a CLI option to the Homebrew package manager:

brew install <package> --with-foobar-support

Is it possible to do using depext in opam? Thanks in advance.

@dra27
Copy link
Member

dra27 commented Sep 7, 2020

Not yet - this is a feature we're looking at for opam 2.2 next year.

@dra27
Copy link
Member

dra27 commented Sep 7, 2020

At the moment, you can emulate this with depopts - so you have a dummy package to enable foobar support. In opam-repository, ctypes-foreign is an example of this - https://opam.ocaml.org/packages/ctypes/

@AltGr
Copy link
Member

AltGr commented Sep 7, 2020

If it's purely for local use, as opposed to having it in the repository as suggested by @dra27, you can always let opam pause instead of running the package manager itself, run the commands, and then let it continue.

Seems quite ugly, but wouldn't it actually work to have the following ?

depexts: [
  ["<package>" "--with-foobar-support"] {os-distribution = "homebrew" & os = "macos"}
]

opam is pretty lax on what is in the list to the left IIRC

@anton-trunov
Copy link
Author

@dra27 @AltGr Awesome suggestions, thank you very much!

@dra27
Copy link
Member

dra27 commented Jul 9, 2021

An update, following review of issues yesterday: @AltGr's suggested workaround definitely won't work now with the integrated depext in opam 2.1, since it will attempt to detect the presence of a package called --with-foobar-support.

Other package managers either have, or have recently added, features like this, so this is something we should come to. A note at this stage to remember that however this is done it creates a dependency on the setting, so in order to pass a --with-flag in, we'd also need the depext subsystem to be able to detect whether the package was built/installed with that flag and know how to reinstall the package with that flag if necessary.

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

4 participants