From 2c56a409e77eaf7ab73225d09e31a896cba7c4d3 Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sat, 19 Aug 2017 00:34:05 +0200 Subject: [PATCH] Fix minor regression in flag assignment marshalling to custom-setup This was introduced by f8dc46a0fe68e35ec0397da92d7e9d4f168aa126 which resulted in passing `--flags=+foo` to older custom setup scripts which wouldn't recognize the `+` prefix. This was reported by @cocreature --- Cabal/Distribution/Simple/Setup.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Cabal/Distribution/Simple/Setup.hs b/Cabal/Distribution/Simple/Setup.hs index 1b6abbcfe..ac714dd1f 100644 --- a/Cabal/Distribution/Simple/Setup.hs +++ b/Cabal/Distribution/Simple/Setup.hs @@ -674,7 +674,7 @@ configureOptions showOrParseArgs = configConfigurationsFlags (\v flags -> flags { configConfigurationsFlags = v }) (reqArg "FLAGS" (readP_to_E (\err -> "Invalid flag assignment: " ++ err) parseFlagAssignment) - (map showFlagValue)) + (map showFlagValue')) ,option "" ["extra-include-dirs"] "A list of directories to search for header files" @@ -778,6 +778,13 @@ configureOptions showOrParseArgs = reqArgFlag title _sf _lf d (fmap fromPathTemplate . get) (set . fmap toPathTemplate) + -- We can't use 'showFlagValue' because legacy custom-setups don't + -- support the '+' prefix in --flags; so we omit the (redundant) + prefix; + -- NB: we assume that we never have to set/enable '-'-prefixed flags here. + showFlagValue' :: (FlagName, Bool) -> String + showFlagValue' (f, True) = unFlagName f + showFlagValue' (f, False) = '-' : unFlagName f + readPackageDbList :: String -> [Maybe PackageDB] readPackageDbList "clear" = [Nothing] readPackageDbList "global" = [Just GlobalPackageDB] -- 2.11.4.GIT