import Distribution.PackageDescription
+import Distribution.PackageDescription.Parse
+import Distribution.ReadE
import Distribution.Simple
import Distribution.Simple.Configure
import Distribution.Simple.LocalBuildInfo
import Distribution.Verbosity
import System.Environment
+-- XXX This will need to be changed
+distPref :: FilePath
+distPref = defaultDistPref
+
main :: IO ()
main
= do args <- getArgs
mkVerbosity :: [String] -> Verbosity
mkVerbosity [] = normal
-mkVerbosity ['-':'v':v] = let m = case v of
- "" -> Nothing
- _ -> Just v
- in flagToVerbosity m
+mkVerbosity ['-':'v':v] = readEOrFail flagToVerbosity v
mkVerbosity args = error ("Bad arguments: " ++ show args)
doRegisterInplace :: Verbosity -> IO ()
do lbi <- getConfig verbosity
let registerFlags = defaultRegisterFlags { regInPlace = toFlag True }
pd = localPkgDescr lbi
- pd_reg = if pkgName (package pd) == "base"
+ pd_reg = if pkgName (package pd) == "ghc-prim"
then case library pd of
Just lib ->
let ems = "GHC.Prim" : exposedModules lib
copyto = if null destdir then NoCopyDest else CopyTo destdir
copyFlags = defaultCopyFlags {
copyDest = toFlag copyto,
- copyVerbose = toFlag verbosity
+ copyVerbosity = toFlag verbosity
}
registerFlags = defaultRegisterFlags {
regPackageDB = toFlag GlobalPackageDB,
- regVerbose = toFlag verbosity,
+ regVerbosity = toFlag verbosity,
regGenScript = toFlag $ False,
regInPlace = toFlag $ False
}
let pd = localPkgDescr lbi
i = installDirTemplates lbi
-- This is an almighty hack. We need to register
- -- base:GHC.Prim, but it doesn't exist, get built, get
+ -- ghc-prim:GHC.Prim, but it doesn't exist, get built, get
-- haddocked, get copied, etc.
- pd_reg = if pkgName (package pd) == "base"
+ pd_reg = if pkgName (package pd) == "ghc-prim"
then case library pd of
Just lib ->
let ems = "GHC.Prim" : exposedModules lib
-- Get the build info, merging the setup-config and buildinfo files.
getConfig :: Verbosity -> IO LocalBuildInfo
getConfig verbosity = do
- lbi <- getPersistBuildConfig
+ lbi <- getPersistBuildConfig distPref
maybe_infoFile <- defaultHookedPackageDesc
case maybe_infoFile of
Nothing -> return lbi