Commit 9325ecbb authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Use componentPackageDeps, remove packageDeps, add externalPackageDeps

So now when building, we actually use per-component set of package deps.
There's no actual change in behaviour yet as we're still setting each of
the componentPackageDeps to the union of all the package deps.
parent d1659f40
......@@ -27,7 +27,7 @@ import Distribution.Version
import Distribution.PackageDescription
( PackageDescription )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(packageDeps) )
( LocalBuildInfo, externalPackageDeps )
import Distribution.Text
( display )
......@@ -46,7 +46,7 @@ generate _pkg_descr lbi = concat $
," (major1) == ",major1," && (major2) == ",major2," && (minor) <= ",minor
,"\n\n"
]
| pkgid@(PackageIdentifier name version) <- packageDeps lbi
| pkgid@(PackageIdentifier name version) <- externalPackageDeps lbi
, let (major1:major2:minor:_) = map show (versionBranch version ++ repeat 0)
pkgname = map fixchar (display name)
]
......
......@@ -415,7 +415,6 @@ configure (pkg_descr0, pbi) cfg
scratchDir = fromFlagOrDefault
(distPref </> "scratch")
(configScratchDir cfg),
packageDeps = dep_pkgs,
libraryConfig = (\_ -> ComponentLocalBuildInfo dep_pkgs)
`fmap` library pkg_descr',
executableConfigs = (\exe -> (exeName exe, ComponentLocalBuildInfo dep_pkgs))
......
......@@ -461,7 +461,7 @@ substTopDir topDir ipo
--
buildLib :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib _clbi = do
buildLib verbosity pkg_descr lbi lib clbi = do
let pref = buildDir lbi
pkgid = packageId pkg_descr
runGhcProg = rawSystemProgramConf verbosity ghcProgram (withPrograms lbi)
......@@ -481,7 +481,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
-- TODO: do we need to put hs-boot files into place for mutually recurive modules?
let ghcArgs =
["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi libTargetDir verbosity
++ constructGHCCmdLine lbi libBi clbi libTargetDir verbosity
++ map display (libModules lib)
ghcArgsProf = ghcArgs
++ ["-prof",
......@@ -503,7 +503,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
-- build any C sources
unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..."
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi pref
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi clbi pref
filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
......@@ -588,7 +588,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
"-o", sharedLibFilePath ]
++ ghcSharedObjArgs
++ ["-package-name", display pkgid ]
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-package", display pkg] | pkg <- componentPackageDeps clbi ])
++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
......@@ -627,7 +627,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Executable -> ComponentLocalBuildInfo -> IO ()
buildExe verbosity _pkg_descr lbi
exe@Executable { exeName = exeName', modulePath = modPath } _clbi = do
exe@Executable { exeName = exeName', modulePath = modPath } clbi = do
let pref = buildDir lbi
runGhcProg = rawSystemProgramConf verbosity ghcProgram (withPrograms lbi)
......@@ -648,7 +648,7 @@ buildExe verbosity _pkg_descr lbi
-- build executables
unless (null (cSources exeBi)) $ do
info verbosity "Building C Sources."
sequence_ [do let (odir,args) = constructCcCmdLine lbi exeBi
sequence_ [do let (odir,args) = constructCcCmdLine lbi exeBi clbi
exeDir filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
......@@ -661,7 +661,7 @@ buildExe verbosity _pkg_descr lbi
(if linkExe
then ["-o", targetDir </> exeNameReal]
else ["-c"])
++ constructGHCCmdLine lbi exeBi exeDir verbosity
++ constructGHCCmdLine lbi exeBi clbi exeDir verbosity
++ [exeDir </> x | x <- cObjs]
++ [srcMainFile]
++ ["-optl" ++ opt | opt <- PD.ldOptions exeBi]
......@@ -723,14 +723,15 @@ getHaskellObjects lib lbi pref wanted_obj_ext allow_split_objs
constructGHCCmdLine
:: LocalBuildInfo
-> BuildInfo
-> ComponentLocalBuildInfo
-> FilePath
-> Verbosity
-> [String]
constructGHCCmdLine lbi bi odir verbosity =
constructGHCCmdLine lbi bi clbi odir verbosity =
["--make"]
++ ghcVerbosityOptions verbosity
-- Unsupported extensions have already been checked by configure
++ ghcOptions lbi bi odir
++ ghcOptions lbi bi clbi odir
ghcVerbosityOptions :: Verbosity -> [String]
ghcVerbosityOptions verbosity
......@@ -738,8 +739,9 @@ ghcVerbosityOptions verbosity
| verbosity >= normal = []
| otherwise = ["-w", "-v0"]
ghcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcOptions lbi bi odir
ghcOptions :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> [String]
ghcOptions lbi bi clbi odir
= ["-hide-all-packages"]
++ (case withPackageDB lbi of
GlobalPackageDB -> ["-no-user-package-conf"]
......@@ -760,7 +762,7 @@ ghcOptions lbi bi odir
++ [ "-odir", odir, "-hidir", odir ]
++ (if compilerVersion c >= Version [6,8] []
then ["-stubdir", odir] else [])
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-package", display pkg] | pkg <- componentPackageDeps clbi ])
++ (case withOptimization lbi of
NoOptimisation -> []
NormalOptimisation -> ["-O"]
......@@ -769,27 +771,28 @@ ghcOptions lbi bi odir
++ extensionsToFlags c (extensions bi)
where c = compiler lbi
constructCcCmdLine :: LocalBuildInfo -> BuildInfo -> FilePath
-> FilePath -> Verbosity -> (FilePath,[String])
constructCcCmdLine lbi bi pref filename verbosity
constructCcCmdLine :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> FilePath -> Verbosity -> (FilePath,[String])
constructCcCmdLine lbi bi clbi pref filename verbosity
= let odir | compilerVersion (compiler lbi) >= Version [6,4,1] [] = pref
| otherwise = pref </> takeDirectory filename
-- ghc 6.4.1 fixed a bug in -odir handling
-- for C compilations.
in
(odir,
ghcCcOptions lbi bi odir
ghcCcOptions lbi bi clbi odir
++ (if verbosity >= deafening then ["-v"] else [])
++ ["-c",filename])
ghcCcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcCcOptions lbi bi odir
ghcCcOptions :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> [String]
ghcCcOptions lbi bi clbi odir
= ["-I" ++ dir | dir <- PD.includeDirs bi]
++ (case withPackageDB lbi of
SpecificPackageDB db -> ["-package-conf", db]
_ -> [])
++ concat [ ["-package", display pkg] | pkg <- packageDeps lbi ]
++ concat [ ["-package", display pkg] | pkg <- componentPackageDeps clbi ]
++ ["-optc" ++ opt | opt <- PD.ccOptions bi]
++ (case withOptimization lbi of
NoOptimisation -> []
......
......@@ -73,7 +73,9 @@ import Distribution.Simple.InstallDirs (InstallDirs(..), PathTemplate,
toPathTemplate, fromPathTemplate,
substPathTemplate,
initialPathTemplateEnv)
import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) )
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), externalPackageDeps
, ComponentLocalBuildInfo(..) )
import Distribution.Simple.BuildPaths ( haddockName,
hscolourPref, autogenModulesDir,
)
......@@ -197,15 +199,19 @@ haddock pkg_descr lbi suffixes flags = do
withLib pkg_descr $ \lib -> do
let bi = libBuildInfo lib
libArgs <- fromLibrary lbi lib
--TODO: need a withLib variant that gives us the per-component info
let Just clbi = libraryConfig lbi
libArgs <- fromLibrary lbi lib clbi
prepareSources verbosity lbi isVersion2 bi (args `mappend` libArgs) $
runHaddock verbosity confHaddock
when (flag haddockExecutables) $
withExe pkg_descr $ \exe -> do
let bi = buildInfo exe
exeArgs <- fromExecutable lbi exe
prepareSources verbosity lbi isVersion2 bi (args `mappend` exeArgs) $
--TODO: need a withLib variant that gives us the per-component info
let Just clbi = lookup (exeName exe) (executableConfigs lbi)
exeArgs <- fromExecutable lbi exe clbi
prepareSources verbosity lbi isVersion2 bi (args `mappend` exeArgs) $
runHaddock verbosity confHaddock
where
......@@ -284,22 +290,22 @@ fromPackageDescription pkg_descr =
subtitle | null (synopsis pkg_descr) = ""
| otherwise = ": " ++ synopsis pkg_descr
fromLibrary :: LocalBuildInfo -> Library -> IO HaddockArgs
fromLibrary lbi lib =
fromLibrary :: LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO HaddockArgs
fromLibrary lbi lib clbi =
do inFiles <- map snd `fmap` getLibSourceFiles lbi lib
return $ mempty {
argHideModules = (mempty,otherModules $ bi),
argGhcFlags = ghcOptions lbi bi (buildDir lbi),
argGhcFlags = ghcOptions lbi bi clbi (buildDir lbi),
argTargets = inFiles
}
where
bi = libBuildInfo lib
fromExecutable :: LocalBuildInfo -> Executable -> IO HaddockArgs
fromExecutable lbi exe =
fromExecutable :: LocalBuildInfo -> Executable -> ComponentLocalBuildInfo -> IO HaddockArgs
fromExecutable lbi exe clbi =
do inFiles <- map snd `fmap` getExeSourceFiles lbi exe
return $ mempty {
argGhcFlags = ghcOptions lbi bi (buildDir lbi),
argGhcFlags = ghcOptions lbi bi clbi (buildDir lbi),
argOutputDir = Dir (exeName exe),
argTitle = Flag (exeName exe),
argTargets = inFiles
......@@ -400,7 +406,7 @@ haddockPackageFlags :: LocalBuildInfo
-> IO ([(FilePath,Maybe FilePath)], Maybe String)
haddockPackageFlags lbi htmlTemplate = do
let allPkgs = installedPkgs lbi
directDeps = packageDeps lbi
directDeps = externalPackageDeps lbi
transitiveDeps <- case dependencyClosure allPkgs directDeps of
Left x -> return x
Right _ -> die "Can't find transitive deps for haddock"
......
......@@ -138,10 +138,10 @@ getInstalledPackages verbosity packageDBs conf = do
-- Currently C source files are not supported.
buildLib :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib _clbi = do
buildLib verbosity pkg_descr lbi lib clbi = do
let Just jhcProg = lookupProgram jhcProgram (withPrograms lbi)
let libBi = libBuildInfo lib
let args = constructJHCCmdLine lbi libBi (buildDir lbi) verbosity
let args = constructJHCCmdLine lbi libBi clbi (buildDir lbi) verbosity
rawSystemProgram verbosity jhcProg $
["-c"] ++ args ++ map display (libModules lib)
let pkgid = display (packageId pkg_descr)
......@@ -154,15 +154,16 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
-- Currently C source files are not supported.
buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Executable -> ComponentLocalBuildInfo -> IO ()
buildExe verbosity _pkg_descr lbi exe _clbi = do
buildExe verbosity _pkg_descr lbi exe clbi = do
let Just jhcProg = lookupProgram jhcProgram (withPrograms lbi)
let exeBi = buildInfo exe
let out = buildDir lbi </> exeName exe
let args = constructJHCCmdLine lbi exeBi (buildDir lbi) verbosity
let args = constructJHCCmdLine lbi exeBi clbi (buildDir lbi) verbosity
rawSystemProgram verbosity jhcProg (["-o",out] ++ args ++ [modulePath exe])
constructJHCCmdLine :: LocalBuildInfo -> BuildInfo -> FilePath -> Verbosity -> [String]
constructJHCCmdLine lbi bi _odir verbosity =
constructJHCCmdLine :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> Verbosity -> [String]
constructJHCCmdLine lbi bi clbi _odir verbosity =
(if verbosity >= deafening then ["-v"] else [])
++ extensionsToFlags (compiler lbi) (extensions bi)
++ hcOptions JHC bi
......@@ -170,7 +171,7 @@ constructJHCCmdLine lbi bi _odir verbosity =
++ concat [["-i", l] | l <- nub (hsSourceDirs bi)]
++ ["-i", autogenModulesDir lbi]
++ ["-optc" ++ opt | opt <- PD.ccOptions bi]
++ (concat [ ["-p", display pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-p", display pkg] | pkg <- componentPackageDeps clbi ])
jhcPkgConf :: PackageDescription -> String
jhcPkgConf pd =
......
......@@ -326,7 +326,7 @@ substTopDir topDir ipo
--
buildLib :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib _clbi = do
buildLib verbosity pkg_descr lbi lib clbi = do
let pref = buildDir lbi
pkgid = packageId pkg_descr
runGhcProg = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi)
......@@ -346,7 +346,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
-- TODO: do we need to put hs-boot files into place for mutually recurive modules?
let ghcArgs =
["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi libTargetDir verbosity
++ constructGHCCmdLine lbi libBi clbi libTargetDir verbosity
++ map display (libModules lib)
ghcArgsProf = ghcArgs
++ ["-prof",
......@@ -368,7 +368,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
-- build any C sources
unless (null (cSources libBi)) $ do
info verbosity "Building C Sources..."
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi pref
sequence_ [do let (odir,args) = constructCcCmdLine lbi libBi clbi pref
filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
......@@ -453,7 +453,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
"-o", sharedLibFilePath ]
++ ghcSharedObjArgs
++ ["-package-name", display pkgid ]
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-package", display pkg] | pkg <- componentPackageDeps clbi ])
++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
......@@ -492,7 +492,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Executable -> ComponentLocalBuildInfo -> IO ()
buildExe verbosity _pkg_descr lbi
exe@Executable { exeName = exeName', modulePath = modPath } _clbi = do
exe@Executable { exeName = exeName', modulePath = modPath } clbi = do
let pref = buildDir lbi
runGhcProg = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi)
......@@ -513,7 +513,7 @@ buildExe verbosity _pkg_descr lbi
-- build executables
unless (null (cSources exeBi)) $ do
info verbosity "Building C Sources."
sequence_ [do let (odir,args) = constructCcCmdLine lbi exeBi
sequence_ [do let (odir,args) = constructCcCmdLine lbi exeBi clbi
exeDir filename verbosity
createDirectoryIfMissingVerbose verbosity True odir
runGhcProg args
......@@ -526,7 +526,7 @@ buildExe verbosity _pkg_descr lbi
(if linkExe
then ["-o", targetDir </> exeNameReal]
else ["-c"])
++ constructGHCCmdLine lbi exeBi exeDir verbosity
++ constructGHCCmdLine lbi exeBi clbi exeDir verbosity
++ [exeDir </> x | x <- cObjs]
++ [srcMainFile]
++ ["-optl" ++ opt | opt <- PD.ldOptions exeBi]
......@@ -588,14 +588,15 @@ getHaskellObjects lib lbi pref wanted_obj_ext allow_split_objs
constructGHCCmdLine
:: LocalBuildInfo
-> BuildInfo
-> ComponentLocalBuildInfo
-> FilePath
-> Verbosity
-> [String]
constructGHCCmdLine lbi bi odir verbosity =
constructGHCCmdLine lbi bi clbi odir verbosity =
["--make"]
++ ghcVerbosityOptions verbosity
-- Unsupported extensions have already been checked by configure
++ ghcOptions lbi bi odir
++ ghcOptions lbi bi clbi odir
ghcVerbosityOptions :: Verbosity -> [String]
ghcVerbosityOptions verbosity
......@@ -603,8 +604,9 @@ ghcVerbosityOptions verbosity
| verbosity >= normal = []
| otherwise = ["-w", "-v0"]
ghcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcOptions lbi bi odir
ghcOptions :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> [String]
ghcOptions lbi bi clbi odir
= ["-hide-all-packages"]
++ (case withPackageDB lbi of
GlobalPackageDB -> ["-no-user-package-conf"]
......@@ -625,7 +627,7 @@ ghcOptions lbi bi odir
++ [ "-odir", odir, "-hidir", odir ]
++ (if compilerVersion c >= Version [6,8] []
then ["-stubdir", odir] else [])
++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ (concat [ ["-package", display pkg] | pkg <- componentPackageDeps clbi ])
++ (case withOptimization lbi of
NoOptimisation -> []
NormalOptimisation -> ["-O"]
......@@ -634,27 +636,28 @@ ghcOptions lbi bi odir
++ extensionsToFlags c (extensions bi)
where c = compiler lbi
constructCcCmdLine :: LocalBuildInfo -> BuildInfo -> FilePath
-> FilePath -> Verbosity -> (FilePath,[String])
constructCcCmdLine lbi bi pref filename verbosity
constructCcCmdLine :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> FilePath -> Verbosity -> (FilePath,[String])
constructCcCmdLine lbi bi clbi pref filename verbosity
= let odir | compilerVersion (compiler lbi) >= Version [6,4,1] [] = pref
| otherwise = pref </> takeDirectory filename
-- ghc 6.4.1 fixed a bug in -odir handling
-- for C compilations.
in
(odir,
ghcCcOptions lbi bi odir
ghcCcOptions lbi bi clbi odir
++ (if verbosity >= deafening then ["-v"] else [])
++ ["-c",filename])
ghcCcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcCcOptions lbi bi odir
ghcCcOptions :: LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo
-> FilePath -> [String]
ghcCcOptions lbi bi clbi odir
= ["-I" ++ dir | dir <- PD.includeDirs bi]
++ (case withPackageDB lbi of
SpecificPackageDB db -> ["-package-conf", db]
_ -> [])
++ concat [ ["-package", display pkg] | pkg <- packageDeps lbi ]
++ concat [ ["-package", display pkg] | pkg <- componentPackageDeps clbi ]
++ ["-optc" ++ opt | opt <- PD.ccOptions bi]
++ (case withOptimization lbi of
NoOptimisation -> []
......
......@@ -46,6 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.LocalBuildInfo (
LocalBuildInfo(..),
externalPackageDeps,
ComponentLocalBuildInfo(..),
-- * Installation directories
module Distribution.Simple.InstallDirs,
......@@ -67,6 +68,8 @@ import Distribution.Simple.Compiler
import Distribution.Simple.PackageIndex (PackageIndex)
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import Data.List (nub)
-- |Data cached after configuration step. See also
-- 'Distribution.Setup.ConfigFlags'.
data LocalBuildInfo = LocalBuildInfo {
......@@ -79,15 +82,6 @@ data LocalBuildInfo = LocalBuildInfo {
-- ^ Where to build the package.
scratchDir :: FilePath,
-- ^ Where to put the result of the Hugs build.
--TODO: eliminate packageDeps field
packageDeps :: [PackageId],
-- ^ External package dependencies for the package as a whole,
-- the union of the individual 'targetPackageDeps'.
-- The 'Distribution.PackageDescription.PackageDescription'
-- specifies a set of build dependencies
-- that must be satisfied in terms of version ranges. This
-- field fixes those dependencies to the specific versions
-- available on this machine for this compiler.
libraryConfig :: Maybe ComponentLocalBuildInfo,
executableConfigs :: [(String, ComponentLocalBuildInfo)],
installedPkgs :: PackageIndex InstalledPackageInfo,
......@@ -112,8 +106,21 @@ data LocalBuildInfo = LocalBuildInfo {
} deriving (Read, Show)
data ComponentLocalBuildInfo = ComponentLocalBuildInfo {
componentPackageDeps :: [PackageId]
} deriving (Read, Show)
-- | External package dependencies for this component. The 'BuildInfo'
-- specifies a set of build dependencies that must be satisfied in terms of
-- version ranges. This field fixes those dependencies to the specific
-- versions available on this machine for this compiler.
componentPackageDeps :: [PackageId]
}
deriving (Read, Show)
-- | External package dependencies for the package as a whole, the union of the
-- individual 'targetPackageDeps'.
externalPackageDeps :: LocalBuildInfo -> [PackageId]
externalPackageDeps lbi = nub $
-- TODO: what about non-buildable components?
maybe [] componentPackageDeps (libraryConfig lbi)
++ concatMap (componentPackageDeps . snd) (executableConfigs lbi)
-- -----------------------------------------------------------------------------
-- Wrappers for a couple functions from InstallDirs
......
......@@ -135,7 +135,7 @@ nhcLanguageExtensions =
-- ATM. Re-add later.
buildLib :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Library -> ComponentLocalBuildInfo -> IO ()
buildLib verbosity pkg_descr lbi lib _clbi = do
buildLib verbosity pkg_descr lbi lib clbi = do
let conf = withPrograms lbi
Just nhcProg = lookupProgram nhcProgram conf
let bi = libBuildInfo lib
......@@ -155,7 +155,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
++ maybe [] (hcOptions NHC . libBuildInfo)
(library pkg_descr)
++ concat [ ["-package", display (packageName pkg) ]
| pkg <- packageDeps lbi ]
| pkg <- componentPackageDeps clbi ]
++ inFiles
{-
-- build any C sources
......@@ -195,7 +195,7 @@ buildLib verbosity pkg_descr lbi lib _clbi = do
-- | Building an executable for NHC.
buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo
-> Executable -> ComponentLocalBuildInfo -> IO ()
buildExe verbosity pkg_descr lbi exe _clbi = do
buildExe verbosity pkg_descr lbi exe clbi = do
let conf = withPrograms lbi
Just nhcProg = lookupProgram nhcProgram conf
when (dropExtension (modulePath exe) /= exeName exe) $
......@@ -220,7 +220,7 @@ buildExe verbosity pkg_descr lbi exe _clbi = do
++ maybe [] (hcOptions NHC . libBuildInfo)
(library pkg_descr)
++ concat [ ["-package", display (packageName pkg) ]
| pkg <- packageDeps lbi ]
| pkg <- componentPackageDeps clbi ]
++ inFiles
++ [exeName exe]
......
......@@ -61,9 +61,9 @@ module Distribution.Simple.Register (
removeRegScripts,
) where
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),
InstallDirs(..),
absoluteInstallDirs)
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..), ComponentLocalBuildInfo(..)
, InstallDirs(..), absoluteInstallDirs )
import Distribution.Simple.BuildPaths (haddockName)
import Distribution.Simple.Compiler
( CompilerFlavor(..), compilerFlavor, PackageDB(..) )
......@@ -257,6 +257,8 @@ mkInstalledPackageInfo distPref pkg_descr lbi inplace = do
pwd <- getCurrentDirectory
let
lib = fromJust (library pkg_descr) -- checked for Nothing earlier
clbi = fromJust (libraryConfig lbi)
--TODO: ^^ pass explicitly rather than using fromJust
bi = libBuildInfo lib
build_dir = pwd </> buildDir lbi
installDirs = absoluteInstallDirs (packageId pkg_descr) lbi NoCopyDest
......@@ -312,7 +314,7 @@ mkInstalledPackageInfo distPref pkg_descr lbi inplace = do
then map (pwd </>) relinc
else installIncludeDir,
IPI.includes = includes bi,
IPI.depends = packageDeps lbi,
IPI.depends = componentPackageDeps clbi,
IPI.hugsOptions = concat [opts | (Hugs,opts) <- options bi],
IPI.ccOptions = [], -- NB. NOT ccOptions bi!
-- We don't want cc-options to be
......
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