Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Don't pass unsupported flags to setups built with old Cabal versions.

We must not pass '--disable-benchmarks' to setup scripts built with Cabal <
1.14; the same is also true for '--disable-tests' and Cabal < 1.10.

Fixes #932 and #1004.

Without this patch:

    $ cabal install -w /path/to/ghc-7.2.1/bin/ghc syb
    [...]
    unrecognized option `--disable-benchmarks'
    Failed to install syb-0.3.7

With this patch:

    $ cabal install -w /path/to/ghc-7.2.1/bin/ghc syb
    [...]
    Registering syb-0.3.7...
    Installed syb-0.3.7
  • Loading branch information...
commit 582d12e47b884d1196054a2b77250d05c33f2043 1 parent f926569
Mikhail Glushenkov authored

Showing 1 changed file with 14 additions and 3 deletions. Show diff stats Hide diff stats

  1. +14 3 cabal-install/Distribution/Client/Setup.hs
17 cabal-install/Distribution/Client/Setup.hs
@@ -230,9 +230,20 @@ configureOptions = commandOptions configureCommand
230 230
231 231 filterConfigureFlags :: ConfigFlags -> Version -> ConfigFlags
232 232 filterConfigureFlags flags cabalLibVersion
233   - | cabalLibVersion >= Version [1,3,10] [] = flags
234   - -- older Cabal does not grok the constraints flag:
235   - | otherwise = flags { configConstraints = [] }
  233 + | cabalLibVersion >= Version [1,14,0] [] = flags
  234 + | cabalLibVersion < Version [1,3,10] [] = flags_1_3_10
  235 + | cabalLibVersion < Version [1,10,0] [] = flags_1_10_0
  236 + | cabalLibVersion < Version [1,14,0] [] = flags_1_14_0
  237 +
  238 + -- A no-op that silences the "pattern match is non-exhaustive" warning.
  239 + | otherwise = flags
  240 + where
  241 + -- Cabal < 1.14.0 doesn't know about --disable-benchmarks.
  242 + flags_1_14_0 = flags { configBenchmarks = NoFlag }
  243 + -- Cabal < 1.10.0 doesn't know about --disable-tests.
  244 + flags_1_10_0 = flags_1_14_0 { configTests = NoFlag }
  245 + -- Cabal < 1.3.10 does not grok the constraints flag.
  246 + flags_1_3_10 = flags_1_10_0 { configConstraints = [] }
236 247
237 248 -- ------------------------------------------------------------
238 249 -- * Config extra flags

0 comments on commit 582d12e

Please sign in to comment.
Something went wrong with that request. Please try again.