Commit ebc2a161 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Add Text instances for PackageIdentifier and Dependency

And change all uses.
parent 66bb76be
...@@ -62,14 +62,13 @@ import Distribution.ParseUtils ( ...@@ -62,14 +62,13 @@ import Distribution.ParseUtils (
showFreeText) showFreeText)
import Distribution.License ( License(..) ) import Distribution.License ( License(..) )
import Distribution.Package import Distribution.Package
( PackageIdentifier(..), packageName, packageVersion ( PackageIdentifier(..), packageName, packageVersion )
, showPackageId, parsePackageId )
import qualified Distribution.Package as Package import qualified Distribution.Package as Package
( Package(..), PackageFixedDeps(..) ) ( Package(..), PackageFixedDeps(..) )
import Distribution.Version import Distribution.Version
( Version(..) ) ( Version(..) )
import Distribution.Text import Distribution.Text
( Text(disp) ) ( Text(disp, parse) )
import qualified Distribution.Compat.ReadP as ReadP import qualified Distribution.Compat.ReadP as ReadP
import Control.Monad ( foldM ) import Control.Monad ( foldM )
...@@ -270,7 +269,7 @@ installedFieldDescrs = [ ...@@ -270,7 +269,7 @@ installedFieldDescrs = [
showFilePath parseFilePathQ showFilePath parseFilePathQ
includes (\xs pkg -> pkg{includes=xs}) includes (\xs pkg -> pkg{includes=xs})
, listField "depends" , listField "depends"
(text.showPackageId) parsePackageId' disp parsePackageId'
depends (\xs pkg -> pkg{depends=xs}) depends (\xs pkg -> pkg{depends=xs})
, listField "hugs-options" , listField "hugs-options"
showToken parseTokenQ showToken parseTokenQ
...@@ -296,4 +295,4 @@ installedFieldDescrs = [ ...@@ -296,4 +295,4 @@ installedFieldDescrs = [
] ]
parsePackageId' :: ReadP.ReadP [PackageIdentifier] PackageIdentifier parsePackageId' :: ReadP.ReadP [PackageIdentifier] PackageIdentifier
parsePackageId' = parseQuoted parsePackageId ReadP.<++ parsePackageId parsePackageId' = parseQuoted parse ReadP.<++ parse
...@@ -42,24 +42,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} ...@@ -42,24 +42,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Package ( module Distribution.Package (
-- * Package ids -- * Package ids
PackageIdentifier(..), PackageIdentifier(..),
showPackageId, parsePackageId, parsePackageName, parsePackageName,
-- * Package dependencies -- * Package dependencies
Dependency(..), Dependency(..),
showDependency, parseDependency,
-- * Package classes -- * Package classes
Package(..), packageName, packageVersion, Package(..), packageName, packageVersion,
PackageFixedDeps(..), PackageFixedDeps(..),
) where ) where
import Distribution.Version import Distribution.Version (Version(..), VersionRange(AnyVersion))
import Distribution.Text
( Text(..), display ) import Distribution.Text (Text(..))
import Distribution.Compat.ReadP as ReadP import qualified Distribution.Compat.ReadP as Parse
import qualified Text.PrettyPrint as Pretty import Distribution.Compat.ReadP ((<++))
import Text.PrettyPrint ((<+>)) import qualified Text.PrettyPrint as Disp
import Data.Char ( isDigit, isAlphaNum ) import Text.PrettyPrint ((<>), (<+>))
import qualified Data.Char as Char ( isDigit, isAlphaNum )
import Data.List ( intersperse ) import Data.List ( intersperse )
-- | The name and version of a package. -- | The name and version of a package.
...@@ -70,28 +70,25 @@ data PackageIdentifier ...@@ -70,28 +70,25 @@ data PackageIdentifier
} }
deriving (Read, Show, Eq, Ord) deriving (Read, Show, Eq, Ord)
-- |Creates a string like foo-1.2 instance Text PackageIdentifier where
showPackageId :: PackageIdentifier -> String disp (PackageIdentifier n v) = case v of
showPackageId (PackageIdentifier n (Version [] _)) = n -- if no version, don't show version. Version [] _ -> Disp.text n -- if no version, don't show version.
showPackageId pkgid = _ -> Disp.text n <> Disp.char '-' <> disp v
pkgName pkgid ++ '-': display (packageVersion pkgid)
parse = do
n <- parsePackageName
v <- (Parse.char '-' >> parse) <++ return (Version [] [])
return (PackageIdentifier n v)
parsePackageName :: ReadP r String parsePackageName :: Parse.ReadP r String
parsePackageName = do ns <- sepBy1 component (char '-') parsePackageName = do ns <- Parse.sepBy1 component (Parse.char '-')
return (concat (intersperse "-" ns)) return (concat (intersperse "-" ns))
where component = do where component = do
cs <- munch1 isAlphaNum cs <- Parse.munch1 Char.isAlphaNum
if all isDigit cs then pfail else return cs if all Char.isDigit cs then Parse.pfail else return cs
-- each component must contain an alphabetic character, to avoid -- each component must contain an alphabetic character, to avoid
-- ambiguity in identifiers like foo-1 (the 1 is the version number). -- ambiguity in identifiers like foo-1 (the 1 is the version number).
-- |A package ID looks like foo-1.2.
parsePackageId :: ReadP r PackageIdentifier
parsePackageId = do
n <- parsePackageName
v <- (ReadP.char '-' >> parse) <++ return (Version [] [])
return PackageIdentifier{pkgName=n,pkgVersion=v}
-- ------------------------------------------------------------ -- ------------------------------------------------------------
-- * Package dependencies -- * Package dependencies
-- ------------------------------------------------------------ -- ------------------------------------------------------------
...@@ -99,16 +96,15 @@ parsePackageId = do ...@@ -99,16 +96,15 @@ parsePackageId = do
data Dependency = Dependency String VersionRange data Dependency = Dependency String VersionRange
deriving (Read, Show, Eq) deriving (Read, Show, Eq)
showDependency :: Dependency -> Pretty.Doc instance Text Dependency where
showDependency (Dependency name ver) = disp (Dependency name ver) =
Pretty.text name <+> disp ver Disp.text name <+> disp ver
parseDependency :: ReadP r Dependency parse = do name <- parsePackageName
parseDependency = do name <- parsePackageName Parse.skipSpaces
skipSpaces ver <- parse <++ return AnyVersion
ver <- parse <++ return AnyVersion Parse.skipSpaces
skipSpaces return (Dependency name ver)
return $ Dependency name ver
-- | Class of things that can be identified by a 'PackageIdentifier' -- | Class of things that can be identified by a 'PackageIdentifier'
-- --
......
...@@ -72,9 +72,8 @@ import Distribution.Compat.ReadP hiding (get) ...@@ -72,9 +72,8 @@ import Distribution.Compat.ReadP hiding (get)
import Distribution.ParseUtils import Distribution.ParseUtils
import Distribution.PackageDescription import Distribution.PackageDescription
import Distribution.Package import Distribution.Package
( PackageIdentifier(..), packageName, packageVersion ( PackageIdentifier(..), packageName, packageVersion, parsePackageName
, parsePackageName , Dependency(..) )
, Dependency(..), showDependency, parseDependency )
import Distribution.Version import Distribution.Version
( isAnyVersion ) ( isAnyVersion )
import Distribution.Verbosity (Verbosity) import Distribution.Verbosity (Verbosity)
...@@ -114,7 +113,7 @@ pkgDescrFieldDescrs = ...@@ -114,7 +113,7 @@ pkgDescrFieldDescrs =
showFreeText (munch (const True)) showFreeText (munch (const True))
maintainer (\val pkg -> pkg{maintainer=val}) maintainer (\val pkg -> pkg{maintainer=val})
, commaListField "build-depends" , commaListField "build-depends"
showDependency parseDependency disp parse
buildDepends (\xs pkg -> pkg{buildDepends=xs}) buildDepends (\xs pkg -> pkg{buildDepends=xs})
, simpleField "stability" , simpleField "stability"
showFreeText (munch (const True)) showFreeText (munch (const True))
...@@ -206,7 +205,7 @@ binfoFieldDescrs = ...@@ -206,7 +205,7 @@ binfoFieldDescrs =
disp parse disp parse
buildable (\val binfo -> binfo{buildable=val}) buildable (\val binfo -> binfo{buildable=val})
, commaListField "build-tools" , commaListField "build-tools"
showDependency parseBuildTool disp parseBuildTool
buildTools (\xs binfo -> binfo{buildTools=xs}) buildTools (\xs binfo -> binfo{buildTools=xs})
, listField "cpp-options" , listField "cpp-options"
showToken parseTokenQ showToken parseTokenQ
...@@ -218,7 +217,7 @@ binfoFieldDescrs = ...@@ -218,7 +217,7 @@ binfoFieldDescrs =
showToken parseTokenQ showToken parseTokenQ
ldOptions (\val binfo -> binfo{ldOptions=val}) ldOptions (\val binfo -> binfo{ldOptions=val})
, commaListField "pkgconfig-depends" , commaListField "pkgconfig-depends"
showDependency parsePkgconfigDependency disp parsePkgconfigDependency
pkgconfigDepends (\xs binfo -> binfo{pkgconfigDepends=xs}) pkgconfigDepends (\xs binfo -> binfo{pkgconfigDepends=xs})
, listField "frameworks" , listField "frameworks"
showToken parseTokenQ showToken parseTokenQ
...@@ -351,7 +350,7 @@ constraintFieldNames = ["build-depends"] ...@@ -351,7 +350,7 @@ constraintFieldNames = ["build-depends"]
-- field descriptor. -- field descriptor.
parseConstraint :: Field -> ParseResult [Dependency] parseConstraint :: Field -> ParseResult [Dependency]
parseConstraint (F l n v) parseConstraint (F l n v)
| n == "build-depends" = runP l n (parseCommaList parseDependency) v | n == "build-depends" = runP l n (parseCommaList parse) v
parseConstraint f = bug $ "Constraint was expected (got: " ++ show f ++ ")" parseConstraint f = bug $ "Constraint was expected (got: " ++ show f ++ ")"
{- {-
......
...@@ -51,7 +51,7 @@ import Distribution.PackageDescription ...@@ -51,7 +51,7 @@ import Distribution.PackageDescription
( PackageDescription(..), BuildInfo(..), ( PackageDescription(..), BuildInfo(..),
Executable(..), Library(..) ) Executable(..), Library(..) )
import Distribution.Package import Distribution.Package
( packageVersion, showPackageId, Package(..) ) ( Package(..), packageVersion )
import Distribution.Simple.Setup ( CopyDest(..), BuildFlags(..), import Distribution.Simple.Setup ( CopyDest(..), BuildFlags(..),
MakefileFlags(..), fromFlag ) MakefileFlags(..), fromFlag )
import Distribution.Simple.PreProcess ( preprocessSources, PPSuffixHandler ) import Distribution.Simple.PreProcess ( preprocessSources, PPSuffixHandler )
...@@ -79,6 +79,8 @@ import qualified Distribution.Simple.Hugs as Hugs ...@@ -79,6 +79,8 @@ import qualified Distribution.Simple.Hugs as Hugs
import Distribution.PackageDescription (hasLibs) import Distribution.PackageDescription (hasLibs)
import Distribution.Verbosity import Distribution.Verbosity
import Distribution.Text
( display )
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- |Build the libraries and executables in this package. -- |Build the libraries and executables in this package.
...@@ -126,7 +128,7 @@ initialBuildSteps pkg_descr lbi verbosity suffixes = do ...@@ -126,7 +128,7 @@ initialBuildSteps pkg_descr lbi verbosity suffixes = do
map libBuildInfo (maybeToList (library pkg_descr)) ++ map libBuildInfo (maybeToList (library pkg_descr)) ++
map buildInfo (executables pkg_descr) map buildInfo (executables pkg_descr)
unless (any buildable buildInfos) $ do unless (any buildable buildInfos) $ do
let name = showPackageId (packageId pkg_descr) let name = display (packageId pkg_descr)
die ("Package " ++ name ++ " can't be built on this system.") die ("Package " ++ name ++ " can't be built on this system.")
createDirectoryIfMissingVerbose verbosity True (buildDir lbi) createDirectoryIfMissingVerbose verbosity True (buildDir lbi)
......
...@@ -63,7 +63,7 @@ module Distribution.Simple.BuildPaths ( ...@@ -63,7 +63,7 @@ module Distribution.Simple.BuildPaths (
import System.FilePath (FilePath, (</>), (<.>)) import System.FilePath (FilePath, (</>), (<.>))
import Distribution.Package import Distribution.Package
( PackageIdentifier(pkgName), packageName, showPackageId ) ( PackageIdentifier(pkgName), packageName )
import Distribution.Compiler import Distribution.Compiler
( CompilerId(..), showCompilerFlavor ) ( CompilerId(..), showCompilerFlavor )
import Distribution.PackageDescription (PackageDescription) import Distribution.PackageDescription (PackageDescription)
...@@ -107,7 +107,7 @@ haddockName pkg_descr = packageName pkg_descr <.> "haddock" ...@@ -107,7 +107,7 @@ haddockName pkg_descr = packageName pkg_descr <.> "haddock"
-- Library file names -- Library file names
mkLibName :: PackageIdentifier -> String mkLibName :: PackageIdentifier -> String
mkLibName lib = "libHS" ++ showPackageId lib <.> "a" mkLibName lib = "libHS" ++ display lib <.> "a"
mkProfLibName :: PackageIdentifier -> String mkProfLibName :: PackageIdentifier -> String
mkProfLibName lib = mkLibName lib { pkgName = pkgName lib ++ "_p" } mkProfLibName lib = mkLibName lib { pkgName = pkgName lib ++ "_p" }
...@@ -117,7 +117,7 @@ mkProfLibName lib = mkLibName lib { pkgName = pkgName lib ++ "_p" } ...@@ -117,7 +117,7 @@ mkProfLibName lib = mkLibName lib { pkgName = pkgName lib ++ "_p" }
-- e.g. libHSbase-2.1-ghc6.6.1.so -- e.g. libHSbase-2.1-ghc6.6.1.so
mkSharedLibName :: PackageIdentifier -> CompilerId -> String mkSharedLibName :: PackageIdentifier -> CompilerId -> String
mkSharedLibName lib (CompilerId compilerFlavor compilerVersion) mkSharedLibName lib (CompilerId compilerFlavor compilerVersion)
= "libHS" ++ showPackageId lib ++ "-" ++ comp <.> dllExtension = "libHS" ++ display lib ++ "-" ++ comp <.> dllExtension
where comp = showCompilerFlavor compilerFlavor where comp = showCompilerFlavor compilerFlavor
++ display compilerVersion ++ display compilerVersion
......
...@@ -59,8 +59,7 @@ import Distribution.Simple.Compiler ...@@ -59,8 +59,7 @@ import Distribution.Simple.Compiler
, showCompilerId, unsupportedExtensions, PackageDB(..) ) , showCompilerId, unsupportedExtensions, PackageDB(..) )
import Distribution.Package import Distribution.Package
( PackageIdentifier(PackageIdentifier), packageVersion, Package(..) ( PackageIdentifier(PackageIdentifier), packageVersion, Package(..)
, showPackageId, parsePackageId , Dependency(Dependency) )
, Dependency(..), showDependency )
import Distribution.InstalledPackageInfo import Distribution.InstalledPackageInfo
( InstalledPackageInfo, emptyInstalledPackageInfo ) ( InstalledPackageInfo, emptyInstalledPackageInfo )
import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo
...@@ -75,8 +74,6 @@ import Distribution.PackageDescription.Configuration ...@@ -75,8 +74,6 @@ import Distribution.PackageDescription.Configuration
( finalizePackageDescription ) ( finalizePackageDescription )
import Distribution.PackageDescription.Check import Distribution.PackageDescription.Check
( PackageCheck(..), checkPackage, checkPackageFiles ) ( PackageCheck(..), checkPackage, checkPackageFiles )
import Distribution.Compat.ReadP
( readP_to_S )
import Distribution.Simple.Program import Distribution.Simple.Program
( Program(..), ProgramLocation(..), ConfiguredProgram(..) ( Program(..), ProgramLocation(..), ConfiguredProgram(..)
, ProgramConfiguration, defaultProgramConfiguration , ProgramConfiguration, defaultProgramConfiguration
...@@ -131,7 +128,7 @@ import qualified System.Info ...@@ -131,7 +128,7 @@ import qualified System.Info
import System.IO import System.IO
( hPutStrLn, stderr, hGetContents, openFile, hClose, IOMode(ReadMode) ) ( hPutStrLn, stderr, hGetContents, openFile, hClose, IOMode(ReadMode) )
import Distribution.Text import Distribution.Text
( display, simpleParse ) ( Text(disp), display, simpleParse )
import Text.PrettyPrint.HughesPJ import Text.PrettyPrint.HughesPJ
( comma, punctuate, render, nest, sep ) ( comma, punctuate, render, nest, sep )
...@@ -171,14 +168,14 @@ tryGetConfigStateFile filename = do ...@@ -171,14 +168,14 @@ tryGetConfigStateFile filename = do
badVersion cabalId compilerId badVersion cabalId compilerId
= "You need to re-run the 'configure' command. " = "You need to re-run the 'configure' command. "
++ "The version of Cabal being used has changed (was " ++ "The version of Cabal being used has changed (was "
++ showPackageId cabalId ++ ", now " ++ display cabalId ++ ", now "
++ showPackageId currentCabalId ++ ")." ++ display currentCabalId ++ ")."
++ badcompiler compilerId ++ badcompiler compilerId
badcompiler compilerId | compilerId == currentCompilerId = "" badcompiler compilerId | compilerId == currentCompilerId = ""
| otherwise | otherwise
= " Additionally the compiler is different (was " = " Additionally the compiler is different (was "
++ showPackageId compilerId ++ ", now " ++ display compilerId ++ ", now "
++ showPackageId currentCompilerId ++ display currentCompilerId
++ ") which is probably the cause of the problem." ++ ") which is probably the cause of the problem."
-- internal function -- internal function
...@@ -211,9 +208,9 @@ writePersistBuildConfig lbi = do ...@@ -211,9 +208,9 @@ writePersistBuildConfig lbi = do
showHeader :: PackageIdentifier -> String showHeader :: PackageIdentifier -> String
showHeader pkgid = showHeader pkgid =
"Saved package config for " ++ showPackageId pkgid "Saved package config for " ++ display pkgid
++ " written by " ++ showPackageId currentCabalId ++ " written by " ++ display currentCabalId
++ " using " ++ showPackageId currentCompilerId ++ " using " ++ display currentCompilerId
where where
currentCabalId :: PackageIdentifier currentCabalId :: PackageIdentifier
...@@ -229,17 +226,14 @@ parseHeader :: String -> Maybe (PackageIdentifier, PackageIdentifier) ...@@ -229,17 +226,14 @@ parseHeader :: String -> Maybe (PackageIdentifier, PackageIdentifier)
parseHeader header = case words header of parseHeader header = case words header of
["Saved", "package", "config", "for", pkgid, ["Saved", "package", "config", "for", pkgid,
"written", "by", cabalid, "using", compilerid] "written", "by", cabalid, "using", compilerid]
-> case (readPackageId pkgid, -> case (simpleParse pkgid :: Maybe PackageIdentifier,
readPackageId cabalid, simpleParse cabalid,
readPackageId compilerid) of simpleParse compilerid) of
(Just _, (Just _,
Just cabalid', Just cabalid',
Just compilerid') -> Just (cabalid', compilerid') Just compilerid') -> Just (cabalid', compilerid')
_ -> Nothing _ -> Nothing
_ -> Nothing _ -> Nothing
where readPackageId str = case readP_to_S parsePackageId str of
[] -> Nothing
ok -> Just (fst (last ok))
-- |Check that localBuildInfoFile is up-to-date with respect to the -- |Check that localBuildInfoFile is up-to-date with respect to the
-- .cabal file. -- .cabal file.
...@@ -306,7 +300,7 @@ configure (pkg_descr0, pbi) cfg ...@@ -306,7 +300,7 @@ configure (pkg_descr0, pbi) cfg
Left missing -> Left missing ->
die $ "At least the following dependencies are missing:\n" die $ "At least the following dependencies are missing:\n"
++ (render . nest 4 . sep . punctuate comma $ ++ (render . nest 4 . sep . punctuate comma $
map showDependency missing) map disp missing)
Right pd -> return (pd,[]) Right pd -> return (pd,[])
-- add extra include/lib dirs as specified in cfg -- add extra include/lib dirs as specified in cfg
...@@ -346,9 +340,9 @@ configure (pkg_descr0, pbi) cfg ...@@ -346,9 +340,9 @@ configure (pkg_descr0, pbi) cfg
++ " packages they depend on are missing. These broken " ++ " packages they depend on are missing. These broken "
++ "packages must be rebuilt before they can be used.\n" ++ "packages must be rebuilt before they can be used.\n"
++ unlines [ "package " ++ unlines [ "package "
++ showPackageId (packageId pkg) ++ display (packageId pkg)
++ " is broken due to missing package " ++ " is broken due to missing package "
++ intercalate ", " (map showPackageId deps) ++ intercalate ", " (map display deps)
| (pkg, deps) <- broken ] | (pkg, deps) <- broken ]
let pseudoTopPkg = emptyInstalledPackageInfo { let pseudoTopPkg = emptyInstalledPackageInfo {
...@@ -361,8 +355,8 @@ configure (pkg_descr0, pbi) cfg ...@@ -361,8 +355,8 @@ configure (pkg_descr0, pbi) cfg
warn verbosity $ warn verbosity $
"This package indirectly depends on multiple versions of the same " "This package indirectly depends on multiple versions of the same "
++ "package. This is highly likely to cause a compile failure.\n" ++ "package. This is highly likely to cause a compile failure.\n"
++ unlines [ "package " ++ showPackageId pkg ++ " requires " ++ unlines [ "package " ++ display pkg ++ " requires "
++ showPackageId (PackageIdentifier name ver) ++ display (PackageIdentifier name ver)
| (name, uses) <- inconsistencies | (name, uses) <- inconsistencies
, (pkg, ver) <- uses ] , (pkg, ver) <- uses ]
...@@ -498,7 +492,7 @@ configDependency verbosity index dep@(Dependency pkgname vrange) = ...@@ -498,7 +492,7 @@ configDependency verbosity index dep@(Dependency pkgname vrange) =
pkgs -> do let pkgid = maximumBy (comparing packageVersion) (map packageId pkgs) pkgs -> do let pkgid = maximumBy (comparing packageVersion) (map packageId pkgs)
info verbosity $ "Dependency " ++ pkgname info verbosity $ "Dependency " ++ pkgname
++ display vrange ++ display vrange
++ ": using " ++ showPackageId pkgid ++ ": using " ++ display pkgid
return pkgid return pkgid
getInstalledPackages :: Verbosity -> Compiler -> PackageDB -> ProgramConfiguration getInstalledPackages :: Verbosity -> Compiler -> PackageDB -> ProgramConfiguration
......
...@@ -66,7 +66,7 @@ import Distribution.Simple.LocalBuildInfo ...@@ -66,7 +66,7 @@ import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.BuildPaths import Distribution.Simple.BuildPaths
import Distribution.Simple.Utils import Distribution.Simple.Utils
import Distribution.Package import Distribution.Package
( PackageIdentifier, showPackageId, Package(..) ) ( PackageIdentifier, Package(..) )
import Distribution.Simple.Program import Distribution.Simple.Program
( Program(..), ConfiguredProgram(..), ProgramConfiguration ( Program(..), ConfiguredProgram(..), ProgramConfiguration
, rawSystemProgram, rawSystemProgramConf , rawSystemProgram, rawSystemProgramConf
...@@ -340,7 +340,7 @@ build pkg_descr lbi verbosity = do ...@@ -340,7 +340,7 @@ build pkg_descr lbi verbosity = do
createDirectoryIfMissingVerbose verbosity True libTargetDir createDirectoryIfMissingVerbose verbosity True libTargetDir
-- TODO: do we need to put hs-boot files into place for mutually recurive modules? -- TODO: do we need to put hs-boot files into place for mutually recurive modules?
let ghcArgs = let ghcArgs =
["-package-name", showPackageId pkgid ] ["-package-name", display pkgid ]
++ constructGHCCmdLine lbi libBi libTargetDir verbosity ++ constructGHCCmdLine lbi libBi libTargetDir verbosity
++ (libModules pkg_descr) ++ (libModules pkg_descr)
ghcArgsProf = ghcArgs ghcArgsProf = ghcArgs
...@@ -446,8 +446,8 @@ build pkg_descr lbi verbosity = do ...@@ -446,8 +446,8 @@ build pkg_descr lbi verbosity = do
"-dynamic", "-dynamic",
"-o", sharedLibFilePath ] "-o", sharedLibFilePath ]
++ ghcSharedObjArgs ++ ghcSharedObjArgs
++ ["-package-name", showPackageId pkgid ] ++ ["-package-name", display pkgid ]
++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ]) ++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ ["-l"++extraLib | extraLib <- extraLibs libBi] ++ ["-l"++extraLib | extraLib <- extraLibs libBi]
++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi] ++ ["-L"++extraLibDir | extraLibDir <- extraLibDirs libBi]
...@@ -590,7 +590,7 @@ ghcOptions lbi bi odir ...@@ -590,7 +590,7 @@ ghcOptions lbi bi odir
++ [ "-odir", odir, "-hidir", odir ] ++ [ "-odir", odir, "-hidir", odir ]
++ (if compilerVersion c >= Version [6,8] [] ++ (if compilerVersion c >= Version [6,8] []
then ["-stubdir", odir] else []) then ["-stubdir", odir] else [])
++ (concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ]) ++ (concat [ ["-package", display pkg] | pkg <- packageDeps lbi ])
++ (case withOptimization lbi of ++ (case withOptimization lbi of
NoOptimisation -> [] NoOptimisation -> []
NormalOptimisation -> ["-O"] NormalOptimisation -> ["-O"]
...@@ -616,7 +616,7 @@ constructCcCmdLine lbi bi pref filename verbosity ...@@ -616,7 +616,7 @@ constructCcCmdLine lbi bi pref filename verbosity
ghcCcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String] ghcCcOptions :: LocalBuildInfo -> BuildInfo -> FilePath -> [String]
ghcCcOptions lbi bi odir ghcCcOptions lbi bi odir
= ["-I" ++ dir | dir <- includeDirs bi] = ["-I" ++ dir | dir <- includeDirs bi]
++ concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ] ++ concat [ ["-package", display pkg] | pkg <- packageDeps lbi ]
++ ["-optc" ++ opt | opt <- ccOptions bi] ++ ["-optc" ++ opt | opt <- ccOptions bi]
++ (case withOptimization lbi of ++ (case withOptimization lbi of
NoOptimisation -> [] NoOptimisation -> []
...@@ -624,7 +624,7 @@ ghcCcOptions lbi bi odir ...@@ -624,7 +624,7 @@ ghcCcOptions lbi bi odir
++ ["-odir", odir] ++ ["-odir", odir]
mkGHCiLibName :: PackageIdentifier -> String mkGHCiLibName :: PackageIdentifier -> String
mkGHCiLibName lib = "HS" ++ showPackageId lib <.> "o" mkGHCiLibName lib = "HS" ++ display lib <.> "o"
-- ----------------------------------------------------------------------------- -- -----------------------------------------------------------------------------
-- Building a Makefile -- Building a Makefile
...@@ -641,7 +641,7 @@ makefile pkg_descr lbi flags = do ...@@ -641,7 +641,7 @@ makefile pkg_descr lbi flags = do
let Just lib = library pkg_descr let Just lib = library pkg_descr
bi = libBuildInfo lib bi = libBuildInfo lib
packageIdStr = showPackageId (packageId pkg_descr) packageIdStr = display (packageId pkg_descr)
(arProg, _) <- requireProgram verbosity arProgram AnyVersion (arProg, _) <- requireProgram verbosity arProgram AnyVersion
(withPrograms lbi) (withPrograms lbi)
(ldProg, _) <- requireProgram verbosity ldProgram AnyVersion (ldProg, _) <- requireProgram verbosity ldProgram AnyVersion
...@@ -667,7 +667,7 @@ makefile pkg_descr lbi flags = do ...@@ -667,7 +667,7 @@ makefile pkg_descr lbi flags = do
("GHCI_LIB", builddir </> mkGHCiLibName (packageId pkg_descr)), ("GHCI_LIB", builddir </> mkGHCiLibName (packageId pkg_descr)),
("soext", dllExtension), ("soext", dllExtension),
("LIB_LD_OPTS", unwords (["-package-name", packageIdStr] ("LIB_LD_OPTS", unwords (["-package-name", packageIdStr]
++ concat [ ["-package", showPackageId pkg] | pkg <- packageDeps lbi ] ++ concat [ ["-package", display pkg] | pkg <- packageDeps lbi ]
++ ["-l"++libName | libName <- extraLibs bi] ++ ["-l"++libName | libName <- extraLibs bi]