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

Idiomatic way of filtering cli flags with parameters [in opam file field] #4127

Open
anton-trunov opened this issue Apr 5, 2020 · 8 comments

Comments

@anton-trunov
Copy link

anton-trunov commented Apr 5, 2020

If I need to apply a parameterized cli flag like Coq's -native-compiler no I can do something like

build: [
["./configure" <lots-of-flags> "-native-compiler" {os = "macos"} "no" {os = "macos"}]
...
]

Sometimes people do e.g.

...
["./configure" ...] {os = "linux"}
["./configure" ...] {os = "macos"}
...

but I would prefer not to duplicate a sufficiently large list of cli options to ./configure.

Is there a way to mention {os = "macos"} just one time in the first snippet? Thank you in advance.

@hannesm
Copy link
Member

hannesm commented Apr 5, 2020

as far as I know, this is "line-based", i.e.:

...
["./configure" "--my-long" "--argument-list"
 "--this-only-macos" "yes" {os = "macos"}
 "--this-only-linux" "no" {os = "linux"}
  ...
]
...

should work.

@anton-trunov
Copy link
Author

Thank you so much, it worked!

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Apr 5, 2020

It does not seem to be the case. See build failures in ocaml/opam-repository#16148. I think this issue should be reopened.

EDIT: Since the error will change here was the error:

#=== ERROR while compiling coqide.8.11.1 ======================================#
# context              2.0.6 | linux/x86_64 | ocaml-base-compiler.4.10.0 | pinned(https://github.com/coq/coq/archive/V8.11.1.tar.gz)
# path                 ~/.opam/4.10/.opam-switch/build/coqide.8.11.1
# command              ~/.opam/4.10/.opam-switch/build/coqide.8.11.1/./configure -configdir /home/opam/.opam/4.10/lib/coq/config -prefix /home/opam/.opam/4.10 -mandir /home/opam/.opam/4.10/man -docdir /home/opam/.opam/4.10/doc -libdir /home/opam/.opam/4.10/lib/coq -datadir /home/opam/.opam/4.10/share/coq -native-compiler
# exit-code            2
# env-file             ~/.opam/log/coqide-23-4ff676.env
# output-file          ~/.opam/log/coqide-23-4ff676.out
### output ###
# ./configure.ml: option '-native-compiler' needs an argument.
# Available options for configure are:

@hannesm
Copy link
Member

hannesm commented Apr 5, 2020

oops, sorry about that

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Apr 5, 2020

parenthesis seem to be working though ["cmd" ("-native-compiler" "no") {os = "macos"}]
EDIT: this doesn't work, nevermind

@anton-trunov anton-trunov reopened this Apr 5, 2020
@anton-trunov
Copy link
Author

@kit-ty-kate Right, it only worked on my macOS machine, sorry for that.

@rjbou
Copy link
Collaborator

rjbou commented Apr 8, 2020

The syntax, especially build: and <term>, don't permit it. The filter need to be repeated for each term.

@anton-trunov
Copy link
Author

@rjbou I see, thank you. Can we keep this issue open as a feature request then?

@rjbou rjbou added this to To do in Feature Wish Jun 26, 2020
@rjbou rjbou changed the title Idiomatic way of filtering cli flags with parameters Idiomatic way of filtering cli flags with parameters [in opam file field] Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Feature Wish
  
To do
Development

No branches or pull requests

4 participants