Skip to content

Commit

Permalink
Float-out badAutoconfCharacters
Browse files Browse the repository at this point in the history
Withouth that GHC-8.2.2 exhausts simplifier ticks,
even when increased to 300.
  • Loading branch information
phadej committed Feb 23, 2020
1 parent 64532b8 commit 2520aff
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions Cabal/Distribution/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,13 @@ runConfigureScript verbosity backwardsCompatHack flags lbi = do
let configureFile' = intercalate "/" $ splitDirectories configureFile
for_ badAutoconfCharacters $ \(c, cname) ->
when (c `elem` dropDrive configureFile') $
warn verbosity $
"The path to the './configure' script, '" ++ configureFile'
++ "', contains the character '" ++ [c] ++ "' (" ++ cname ++ ")."
++ " This may cause the script to fail with an obscure error, or for"
++ " building the package to fail later."
warn verbosity $ concat
[ "The path to the './configure' script, '", configureFile'
, "', contains the character '", [c], "' (", cname, ")."
, " This may cause the script to fail with an obscure error, or for"
, " building the package to fail later."
]

let extraPath = fromNubList $ configProgramPathExtra flags
let cflagsEnv = maybe (unwords ccFlags) (++ (" " ++ unwords ccFlags))
$ lookup "CFLAGS" env
Expand All @@ -766,40 +768,40 @@ runConfigureScript verbosity backwardsCompatHack flags lbi = do
(programInvocation (sh {programOverrideEnv = overEnv}) args')
{ progInvokeCwd = Just (buildDir lbi) }
Nothing -> die' verbosity notFoundMsg

where
args = configureArgs backwardsCompatHack flags

badAutoconfCharacters =
[ (' ', "space")
, ('\t', "tab")
, ('\n', "newline")
, ('\0', "null")
, ('"', "double quote")
, ('#', "hash")
, ('$', "dollar sign")
, ('&', "ampersand")
, ('\'', "single quote")
, ('(', "left bracket")
, (')', "right bracket")
, ('*', "star")
, (';', "semicolon")
, ('<', "less-than sign")
, ('=', "equals sign")
, ('>', "greater-than sign")
, ('?', "question mark")
, ('[', "left square bracket")
, ('\\', "backslash")
, ('`', "backtick")
, ('|', "pipe")
]

notFoundMsg = "The package has a './configure' script. "
++ "If you are on Windows, This requires a "
++ "Unix compatibility toolchain such as MinGW+MSYS or Cygwin. "
++ "If you are not on Windows, ensure that an 'sh' command "
++ "is discoverable in your path."

badAutoconfCharacters :: [(Char, String)]
badAutoconfCharacters =
[ (' ', "space")
, ('\t', "tab")
, ('\n', "newline")
, ('\0', "null")
, ('"', "double quote")
, ('#', "hash")
, ('$', "dollar sign")
, ('&', "ampersand")
, ('\'', "single quote")
, ('(', "left bracket")
, (')', "right bracket")
, ('*', "star")
, (';', "semicolon")
, ('<', "less-than sign")
, ('=', "equals sign")
, ('>', "greater-than sign")
, ('?', "question mark")
, ('[', "left square bracket")
, ('\\', "backslash")
, ('`', "backtick")
, ('|', "pipe")
]

getHookedBuildInfo :: Verbosity -> FilePath -> IO HookedBuildInfo
getHookedBuildInfo verbosity build_dir = do
maybe_infoFile <- findHookedPackageDesc verbosity build_dir
Expand Down

0 comments on commit 2520aff

Please sign in to comment.