Open leana8959 opened 1 month ago
I can reproduce with cabal-head.
The freeze file produced is:
active-repositories: hackage.haskell.org:merge
constraints: any.base ==4.18.2.1,
any.ghc-bignum ==1.3,
any.ghc-prim ==0.10.0,
any.rts ==1.0.2,
simple +dev -release
index-state: hackage.haskell.org 2024-05-31T06:57:26Z
and so we see that +dev
is the default.
Unrelated to whether or not this should be in cabal.project
file (matter of taste), this seems to be an infidelity in how the flags are processed.
Same deal with the alternate flag syntax:
$ cabal build --flags="-release +dev" --dry-run
Build profile: -w ghc-9.6.5 -O1
In order, the following would be built (use -v for more details):
- simple-0.1.0.0 (exe:simple-bin) (first run)
It looks like the message is wrong but what is passed to GHC is correct.
$ cabal clean && cabal build -f-release -fdev -v | grep 'O.'
Build profile: -w ghc-9.8.2 -O1
Running: /home/andrea/.ghcup/bin/ghc ... src/Main.hs -O0 -hide-all-packages
Running: /home/andrea/.ghcup/bin/ghc ... -O0 -hide-all-packages
Describe the bug Hello,
I tried to use conditions with flags. I tried to use a
dev
flag that sets-O0
and arelease
flag that sets-O1
. However, no matter what I set the flags to, dry-running cabal always shows that it's building with-O1
.To Reproduce Steps to reproduce the behavior: Here's my repository with a minimal example: https://github.com/leana8959/cabal-opts-repr
Setting
release=false
,dev=true
Setting
release=true
,dev=false
Expected behavior I should be able to toggle the conditionals using flags in the command line.
System information
cabal-install
package fromnixpkgs
, version3.10.3.0
ghc
package fromnixpkgs
, version9.6.5