-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
Latest compat work. Thanks @lpsmith the code has become a lot smaller, which I like. One thing I noticed is that we should add a big disclaimer to the documentation pointing people to the proper bytestring builder, which they should use in new projects.
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,2 @@ | ||
import Distribution.Simple | ||
import Distribution.Simple.Setup | ||
import Distribution.Simple.LocalBuildInfo | ||
import Distribution.PackageDescription | ||
import Distribution.Version | ||
|
||
-- This checks the direct dependency of the bytestring package being | ||
-- compiled against to set the bytestring_has_itoa_c and | ||
-- bytestring_has_builder flags accordingly. | ||
|
||
main = defaultMainWithHooks simpleUserHooks { | ||
confHook = \pkg flags -> | ||
if null (configConstraints flags) | ||
then do | ||
confHook simpleUserHooks pkg flags | ||
else do | ||
let bytestring_version = | ||
case [ versionBranch v | ||
| (Dependency pkg ver) <- configConstraints flags | ||
, pkg == PackageName "bytestring" | ||
, (Just v) <- [isSpecificVersion ver] ] | ||
of | ||
[v] -> v | ||
vs -> error ("error detecting bytestring version " ++ show vs) | ||
|
||
let has_itoa_c = ( FlagName "bytestring_has_itoa_c" | ||
, bytestring_version >= [0,10] ) | ||
|
||
let has_builder = ( FlagName "bytestring_has_builder" | ||
, bytestring_version >= [0,10,4] ) | ||
|
||
let update fs gs = | ||
fs ++ [ g | g <- gs, not $ any (\f -> fst f == fst g) fs] | ||
|
||
let flags' = flags { configConfigurationsFlags = | ||
update [has_itoa_c, has_builder] | ||
(configConfigurationsFlags flags) } | ||
|
||
confHook simpleUserHooks pkg flags' | ||
} | ||
main = defaultMain |
This file was deleted.
This file was deleted.