Skip to content

Commit

Permalink
Be more fuzzy with os, arch and impl matching in conditions. Fixes bug
Browse files Browse the repository at this point in the history
…haskell#158.

Do all the comparisons case insensitively and add some OS aliases so that
if os(windows)  works if the System.Info.os is actually "mingw32".
  • Loading branch information
dcoutts committed Sep 25, 2007
1 parent af7c668 commit 5eff542
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Distribution/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,20 @@ simplifyWithSysParams :: String -> String -> (String, Version) -> Condition Conf
simplifyWithSysParams os arch (impl, implVer) cond = (cond', flags)
where
(cond', fvs) = simplifyCondition cond interp
interp (OS name) = Right $ name == os
interp (Arch name) = Right $ name == arch
interp (Impl i vr) = Right $ impl == i && implVer `withinRange` vr
interp (OS name) = Right $ lcase name == lcase os
|| lcase name `elem` osAliases (lcase os)
interp (Arch name) = Right $ lcase name == lcase arch
interp (Impl i vr) = Right $ lcase impl == lcase i
&& implVer `withinRange` vr
interp (Flag f) = Left f
flags = [ fname | ConfFlag fname <- fvs ]

--FIXME: use Distribution.System.OS type and alias list:
osAliases "ming32" = ["windows"]
osAliases "solaris2" = ["solaris"]
osAliases _ = []
lcase = map toLower

-- XXX: Add instances and check
--
-- prop_sC_idempotent cond a o = cond' == cond''
Expand Down

0 comments on commit 5eff542

Please sign in to comment.