Commit 4614cf66 authored by pcapriotti's avatar pcapriotti
Browse files

Adapt to changes in Cabal.

parent fdc19e64
......@@ -19,6 +19,7 @@ import Distribution.Verbosity
import qualified Distribution.InstalledPackageInfo as Installed
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Control.Monad
import Data.List
import Data.Maybe
import System.IO
......@@ -184,36 +185,20 @@ doInstall ghc ghcpkg strip topdir directory distDir
htmldir = toPathTemplate "$docdir"
}
progs = withPrograms lbi
ghcProg = ConfiguredProgram {
programId = programName ghcProgram,
programVersion = Nothing,
programDefaultArgs = ["-B" ++ topdir],
programOverrideArgs = [],
programLocation = UserSpecified ghc
}
ghcpkgconf = topdir </> "package.conf.d"
ghcPkgProg = ConfiguredProgram {
programId = programName ghcPkgProgram,
programVersion = Nothing,
programDefaultArgs = ["--global-conf",
ghcpkgconf]
++ if not (null myDestDir)
then ["--force"]
else [],
programOverrideArgs = [],
programLocation = UserSpecified ghcpkg
}
stripProg = ConfiguredProgram {
programId = programName stripProgram,
programVersion = Nothing,
programDefaultArgs = [],
programOverrideArgs = [],
programLocation = UserSpecified strip
}
progs' = updateProgram ghcProg
$ updateProgram ghcPkgProg
$ updateProgram stripProg
progs
ghcProgram' = ghcProgram {
programPostConf = \_ _ -> return ["-B" ++ topdir],
programFindLocation = \_ -> return (Just ghc) }
ghcPkgProgram' = ghcPkgProgram {
programPostConf = \_ _ -> return $ ["--global-conf", ghcpkgconf]
++ ["--force" | not (null myDestDir) ],
programFindLocation = \_ -> return (Just ghcpkg) }
stripProgram' = stripProgram {
programFindLocation = \_ -> return (Just strip) }
configurePrograms ps conf = foldM (flip (configureProgram verbosity)) conf ps
progs' <- configurePrograms [ghcProgram', ghcPkgProgram', stripProgram'] progs
let Just ghcPkgProg = lookupProgram ghcPkgProgram' progs'
instInfos <- dump verbosity ghcPkgProg GlobalPackageDB
let installedPkgs' = PackageIndex.fromList instInfos
let mlc = libraryConfig lbi
......@@ -404,4 +389,3 @@ generate config_args distdir directory
| otherwise = return ("\'" ++ s ++ "\'")
boolToYesNo True = "YES"
boolToYesNo False = "NO"
......@@ -19,10 +19,13 @@ import MonadUtils ( liftIO )
import SrcLoc
-- Every GHC comes with Cabal anyways, so this is not a bad new dependency
import Distribution.Simple.GHC ( ghcOptions )
import Distribution.Simple.GHC ( componentGhcOptions )
import Distribution.Simple.Configure ( getPersistBuildConfig )
import Distribution.Simple.Compiler ( compilerVersion )
import Distribution.Simple.Program.GHC ( renderGhcOptions )
import Distribution.PackageDescription ( library, libBuildInfo )
import Distribution.Simple.LocalBuildInfo ( localPkgDescr, buildDir, libraryConfig )
import Distribution.Simple.LocalBuildInfo ( localPkgDescr, buildDir, libraryConfig, compiler )
import qualified Distribution.Verbosity as V
import Control.Monad hiding (mapM)
import System.Environment
......@@ -184,8 +187,9 @@ flagsFromCabal distPref = do
(Just lib, Just clbi) ->
let bi = libBuildInfo lib
odir = buildDir lbi
opts = ghcOptions lbi bi clbi odir
in return opts
opts = componentGhcOptions V.normal lbi bi clbi odir
version = compilerVersion (compiler lbi)
in return $ renderGhcOptions version opts
_ -> error "no library"
----------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment