X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=libraries%2FinstallPackage.hs;h=65eab5664b1808e7c1b9077429be6c65b4d8f83f;hb=cb906a124e36cb5054784a5bc44eb9d099d20709;hp=3ab4f7eb0c2bbb318040a555df445122d0948dde;hpb=e25d5095e6fd47e0a02404d9532c2f776d3f8a32;p=ghc-hetmet.git diff --git a/libraries/installPackage.hs b/libraries/installPackage.hs index 3ab4f7e..65eab56 100644 --- a/libraries/installPackage.hs +++ b/libraries/installPackage.hs @@ -1,4 +1,5 @@ +import Data.Maybe import Distribution.PackageDescription import Distribution.PackageDescription.Parse import Distribution.ReadE @@ -8,16 +9,18 @@ import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program import Distribution.Simple.Setup import Distribution.Simple.Utils +import Distribution.Text import Distribution.Verbosity import System.Environment +-- XXX This will need to be changed +distPref :: FilePath +distPref = defaultDistPref + main :: IO () main = do args <- getArgs case args of - "register" : "--inplace" :args' -> - let verbosity = mkVerbosity args' - in doRegisterInplace verbosity "install" : ghcpkg : ghcpkgconf : destdir : topdir : iprefix : ibindir : ilibdir : ilibexecdir : idynlibdir : idatadir : idocdir : ihtmldir : ihaddockdir : @@ -34,23 +37,6 @@ mkVerbosity [] = normal mkVerbosity ['-':'v':v] = readEOrFail flagToVerbosity v mkVerbosity args = error ("Bad arguments: " ++ show args) -doRegisterInplace :: Verbosity -> IO () -doRegisterInplace verbosity = - do lbi <- getConfig verbosity - let registerFlags = defaultRegisterFlags { regInPlace = toFlag True } - pd = localPkgDescr lbi - pd_reg = if pkgName (package pd) == "ghc-prim" - then case library pd of - Just lib -> - let ems = "GHC.Prim" : exposedModules lib - lib' = lib { exposedModules = ems } - in pd { library = Just lib' } - Nothing -> - error "Expected a library, but none found" - else pd - (regHook simpleUserHooks) pd_reg lbi simpleUserHooks registerFlags - return () - doInstall :: Verbosity -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath @@ -76,10 +62,11 @@ doInstall verbosity ghcpkg ghcpkgconf destdir topdir -- This is an almighty hack. We need to register -- ghc-prim:GHC.Prim, but it doesn't exist, get built, get -- haddocked, get copied, etc. - pd_reg = if pkgName (package pd) == "ghc-prim" + pd_reg = if packageName pd == PackageName "ghc-prim" then case library pd of Just lib -> - let ems = "GHC.Prim" : exposedModules lib + let ems = fromJust (simpleParse "GHC.Prim") + : exposedModules lib lib' = lib { exposedModules = ems } in pd { library = Just lib' } Nothing -> @@ -136,7 +123,7 @@ replaceTopdir _ p = p -- 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