Commit 7fcb2045 authored by Oleg Grenrus's avatar Oleg Grenrus

Rename Flag types

There was three Flag's. Now they are
- `Flag` (cli parsing)
- `PackageFlag`
- `CompilerFlag`

This allows wild-imports without `hiding (Flag)`, and make tags
navigaton work!
parent 26702a35
......@@ -12,7 +12,7 @@ import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Package
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.PackageDescription
import Distribution.Simple.BuildToolDepends
import Distribution.Simple.LocalBuildInfo
import Distribution.Types.ComponentRequestedSpec
......
......@@ -27,14 +27,14 @@ import Distribution.Backpack.ReadyComponent
import Distribution.Backpack.ComponentsGraph
import Distribution.Backpack.Id
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.Package
import qualified Distribution.InstalledPackageInfo as Installed
import Distribution.InstalledPackageInfo (InstalledPackageInfo
,emptyInstalledPackageInfo)
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (InstalledPackageIndex)
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.PackageDescription
import Distribution.ModuleName
import Distribution.Simple.Setup as Setup
import Distribution.Simple.LocalBuildInfo
......
......@@ -35,7 +35,7 @@ import Distribution.Types.LibraryName
import Distribution.Types.UnqualComponentName
import Distribution.Types.ComponentInclude
import Distribution.Package
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.PackageDescription
import Distribution.Simple.BuildToolDepends
import Distribution.Simple.Setup as Setup
import Distribution.Simple.LocalBuildInfo
......
......@@ -11,8 +11,8 @@ import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Types.UnqualComponentName
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.PackageDescription
import Distribution.Simple.Setup as Setup
import qualified Distribution.Simple.InstallDirs as InstallDirs
import Distribution.Simple.LocalBuildInfo
......
......@@ -35,7 +35,7 @@ import Distribution.Types.ComponentInclude
import Distribution.Types.ComponentId
import Distribution.Types.PackageId
import Distribution.Package
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.PackageDescription
import Distribution.ModuleName
import Distribution.Simple.LocalBuildInfo
import Distribution.Verbosity
......
{-# LANGUAGE OverloadedStrings #-}
module Distribution.Fields.ConfVar (parseConditionConfVar) where
import Distribution.Compat.CharParsing (char, integral)
import Distribution.Compat.CharParsing (char, integral)
import Distribution.Compat.Prelude
import Distribution.Parsec (Parsec (..), runParsecParser, Position (..))
import Distribution.Parsec.FieldLineStream (fieldLineStreamFromBS)
import Distribution.Fields.Field (SectionArg (..))
import Distribution.Fields.Field (SectionArg (..))
import Distribution.Fields.ParseResult
import Distribution.Parsec (Parsec (..), Position (..), runParsecParser)
import Distribution.Parsec.FieldLineStream (fieldLineStreamFromBS)
import Distribution.Types.Condition
import Distribution.Types.ConfVar (ConfVar (..))
import Distribution.Types.ConfVar (ConfVar (..))
import Distribution.Version
(anyVersion, earlierVersion, intersectVersionRanges, laterVersion, majorBoundVersion,
mkVersion, noVersion, orEarlierVersion, orLaterVersion, thisVersion, unionVersionRanges,
......@@ -52,7 +52,7 @@ parser = condOr
boolLiteral = Lit <$> boolLiteral'
osCond = Var . OS <$ string "os" <*> parens fromParsec
flagCond = Var . Flag <$ string "flag" <*> parens fromParsec
flagCond = Var . PackageFlag <$ string "flag" <*> parens fromParsec
archCond = Var . Arch <$ string "arch" <*> parens fromParsec
implCond = Var <$ string "impl" <*> parens implCond'
......
......@@ -91,7 +91,7 @@ module Distribution.PackageDescription (
-- * package configuration
GenericPackageDescription(..),
Flag(..), emptyFlag,
PackageFlag(..), emptyFlag,
FlagName, mkFlagName, unFlagName,
FlagAssignment, mkFlagAssignment, unFlagAssignment,
nullFlagAssignment, showFlagValue,
......
......@@ -1500,12 +1500,12 @@ checkUnusedFlags gpd
used :: Set.Set FlagName
used = mconcat
[ toSetOf (L.condLibrary . traverse . traverseCondTreeV . L._Flag) gpd
, toSetOf (L.condSubLibraries . traverse . _2 . traverseCondTreeV . L._Flag) gpd
, toSetOf (L.condForeignLibs . traverse . _2 . traverseCondTreeV . L._Flag) gpd
, toSetOf (L.condExecutables . traverse . _2 . traverseCondTreeV . L._Flag) gpd
, toSetOf (L.condTestSuites . traverse . _2 . traverseCondTreeV . L._Flag) gpd
, toSetOf (L.condBenchmarks . traverse . _2 . traverseCondTreeV . L._Flag) gpd
[ toSetOf (L.condLibrary . traverse . traverseCondTreeV . L._PackageFlag) gpd
, toSetOf (L.condSubLibraries . traverse . _2 . traverseCondTreeV . L._PackageFlag) gpd
, toSetOf (L.condForeignLibs . traverse . _2 . traverseCondTreeV . L._PackageFlag) gpd
, toSetOf (L.condExecutables . traverse . _2 . traverseCondTreeV . L._PackageFlag) gpd
, toSetOf (L.condTestSuites . traverse . _2 . traverseCondTreeV . L._PackageFlag) gpd
, toSetOf (L.condBenchmarks . traverse . _2 . traverseCondTreeV . L._PackageFlag) gpd
]
checkUnicodeXFields :: GenericPackageDescription -> [PackageCheck]
......@@ -1650,14 +1650,14 @@ checkDevelopmentOnlyFlags pkg =
-- We've basically got three-values logic here: True, False or unknown
-- hence this pattern to propagate the unknown cases properly.
definitelyFalse (Var (Flag n)) = maybe False not (Map.lookup n manualFlags)
definitelyFalse (Var (PackageFlag n)) = maybe False not (Map.lookup n manualFlags)
definitelyFalse (Var _) = False
definitelyFalse (Lit b) = not b
definitelyFalse (CNot c) = definitelyTrue c
definitelyFalse (COr c1 c2) = definitelyFalse c1 && definitelyFalse c2
definitelyFalse (CAnd c1 c2) = definitelyFalse c1 || definitelyFalse c2
definitelyTrue (Var (Flag n)) = fromMaybe False (Map.lookup n manualFlags)
definitelyTrue (Var (PackageFlag n)) = fromMaybe False (Map.lookup n manualFlags)
definitelyTrue (Var _) = False
definitelyTrue (Lit b) = b
definitelyTrue (CNot c) = definitelyFalse c
......
......@@ -88,7 +88,7 @@ simplifyWithSysParams os arch cinfo cond = (cond', flags)
Just compat -> Right (any matchImpl compat)
where
matchImpl (CompilerId c v) = comp == c && v `withinRange` vr
interp (Flag f) = Left f
interp (PackageFlag f) = Left f
-- TODO: Add instances and check
--
......@@ -125,7 +125,7 @@ parseCondition = condOr
boolLiteral = fmap Lit parsec
archIdent = fmap Arch parsec
osIdent = fmap OS parsec
flagIdent = fmap (Flag . mkFlagName . lowercase) (munch1 isIdentChar)
flagIdent = fmap (PackageFlag . mkFlagName . lowercase) (munch1 isIdentChar)
isIdentChar c = isAlphaNum c || c == '_' || c == '-'
oper s = sp >> string s >> sp
sp = spaces
......@@ -327,7 +327,7 @@ fromDepMapUnion :: DepMapUnion -> [Dependency]
fromDepMapUnion m = [ Dependency p vr cs | (p,(vr,cs)) <- Map.toList (unDepMapUnion m) ]
freeVars :: CondTree ConfVar c a -> [FlagName]
freeVars t = [ f | Flag f <- freeVars' t ]
freeVars t = [ f | PackageFlag f <- freeVars' t ]
where
freeVars' (CondNode _ _ ifs) = concatMap compfv ifs
compfv (CondBranch c ct mct) = condfv c ++ freeVars' ct ++ maybe [] freeVars' mct
......@@ -478,7 +478,7 @@ finalizePD userflags enabled satisfyDep
++ map (\(name,tree) -> mapTreeData (SubComp name . CTest) tree) tests0
++ map (\(name,tree) -> mapTreeData (SubComp name . CBench) tree) bms0
flagChoices = map (\(MkFlag n _ d manual) -> (n, d2c manual n d)) flags
flagChoices = map (\(MkPackageFlag n _ d manual) -> (n, d2c manual n d)) flags
d2c manual n b = case lookupFlagAssignment n userflags of
Just val -> [val]
Nothing
......
......@@ -505,14 +505,14 @@ lookupLens k f p@(PerCompilerFlavor ghc ghcjs)
-------------------------------------------------------------------------------
flagFieldGrammar
:: (FieldGrammar g, Applicative (g Flag))
=> FlagName -> g Flag Flag
flagFieldGrammar name = MkFlag name
:: (FieldGrammar g, Applicative (g PackageFlag))
=> FlagName -> g PackageFlag PackageFlag
flagFieldGrammar name = MkPackageFlag name
<$> freeTextFieldDef "description" L.flagDescription
<*> booleanFieldDef "default" L.flagDefault True
<*> booleanFieldDef "manual" L.flagManual False
{-# SPECIALIZE flagFieldGrammar :: FlagName -> ParsecFieldGrammar' Flag #-}
{-# SPECIALIZE flagFieldGrammar :: FlagName -> PrettyFieldGrammar' Flag #-}
{-# SPECIALIZE flagFieldGrammar :: FlagName -> ParsecFieldGrammar' PackageFlag #-}
{-# SPECIALIZE flagFieldGrammar :: FlagName -> PrettyFieldGrammar' PackageFlag #-}
-------------------------------------------------------------------------------
-- SourceRepo
......
......@@ -100,11 +100,11 @@ ppSetupBInfo v (Just sbi)
| otherwise = pure $ PrettySection () "custom-setup" [] $
prettyFieldGrammar v (setupBInfoFieldGrammar False) sbi
ppGenPackageFlags :: CabalSpecVersion -> [Flag] -> [PrettyField ()]
ppGenPackageFlags :: CabalSpecVersion -> [PackageFlag] -> [PrettyField ()]
ppGenPackageFlags = map . ppFlag
ppFlag :: CabalSpecVersion -> Flag -> PrettyField ()
ppFlag v flag@(MkFlag name _ _ _) = PrettySection () "flag" [ppFlagName name] $
ppFlag :: CabalSpecVersion -> PackageFlag -> PrettyField ()
ppFlag v flag@(MkPackageFlag name _ _ _) = PrettySection () "flag" [ppFlagName name] $
prettyFieldGrammar v (flagFieldGrammar name) flag
ppCondTree2 :: CabalSpecVersion -> PrettyFieldGrammar' s -> CondTree ConfVar [Dependency] s -> [PrettyField ()]
......@@ -176,10 +176,10 @@ ppCondition (COr c1 c2) = parens (hsep [ppCondition c1, text "|
ppCondition (CAnd c1 c2) = parens (hsep [ppCondition c1, text "&&"
<+> ppCondition c2])
ppConfVar :: ConfVar -> Doc
ppConfVar (OS os) = text "os" <<>> parens (pretty os)
ppConfVar (Arch arch) = text "arch" <<>> parens (pretty arch)
ppConfVar (Flag name) = text "flag" <<>> parens (ppFlagName name)
ppConfVar (Impl c v) = text "impl" <<>> parens (pretty c <+> pretty v)
ppConfVar (OS os) = text "os" <<>> parens (pretty os)
ppConfVar (Arch arch) = text "arch" <<>> parens (pretty arch)
ppConfVar (PackageFlag name) = text "flag" <<>> parens (ppFlagName name)
ppConfVar (Impl c v) = text "impl" <<>> parens (pretty c <+> pretty v)
ppFlagName :: FlagName -> Doc
ppFlagName = text . unFlagName
......
......@@ -61,10 +61,10 @@ import Prelude ()
import Distribution.Compat.Prelude
-- local
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.Simple.UserHooks
import Distribution.Package
import Distribution.PackageDescription hiding (Flag)
import Distribution.PackageDescription
import Distribution.PackageDescription.Configuration
import Distribution.Simple.Program
import Distribution.Simple.Program.Db
......
......@@ -57,8 +57,8 @@ import Distribution.Simple.Build.Macros (generateCabalMacrosHeader)
import Distribution.Simple.Build.PathsModule (generatePathsModule)
import qualified Distribution.Simple.Program.HcPkg as HcPkg
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.PackageDescription hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.PackageDescription
import qualified Distribution.InstalledPackageInfo as IPI
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import qualified Distribution.ModuleName as ModuleName
......
......@@ -47,7 +47,7 @@ module Distribution.Simple.Compiler (
flagToDebugInfoLevel,
-- * Support for language extensions
Flag,
CompilerFlag,
languageToFlags,
unsupportedLanguages,
extensionsToFlags,
......@@ -93,9 +93,9 @@ data Compiler = Compiler {
compilerCompat :: [CompilerId],
-- ^ Other implementations that this compiler claims to be
-- compatible with.
compilerLanguages :: [(Language, Flag)],
compilerLanguages :: [(Language, CompilerFlag)],
-- ^ Supported language standards.
compilerExtensions :: [(Extension, Maybe Flag)],
compilerExtensions :: [(Extension, Maybe CompilerFlag)],
-- ^ Supported extensions.
compilerProperties :: Map String String
-- ^ A key-value map for properties not covered by the above fields.
......@@ -279,12 +279,12 @@ unsupportedLanguages comp langs =
[ lang | lang <- langs
, isNothing (languageToFlag comp lang) ]
languageToFlags :: Compiler -> Maybe Language -> [Flag]
languageToFlags :: Compiler -> Maybe Language -> [CompilerFlag]
languageToFlags comp = filter (not . null)
. catMaybes . map (languageToFlag comp)
. maybe [Haskell98] (\x->[x])
languageToFlag :: Compiler -> Language -> Maybe Flag
languageToFlag :: Compiler -> Language -> Maybe CompilerFlag
languageToFlag comp ext = lookup ext (compilerLanguages comp)
......@@ -294,16 +294,16 @@ unsupportedExtensions comp exts =
[ ext | ext <- exts
, isNothing (extensionToFlag' comp ext) ]
type Flag = String
type CompilerFlag = String
-- |For the given compiler, return the flags for the supported extensions.
extensionsToFlags :: Compiler -> [Extension] -> [Flag]
extensionsToFlags :: Compiler -> [Extension] -> [CompilerFlag]
extensionsToFlags comp = nub . filter (not . null)
. catMaybes . map (extensionToFlag comp)
-- | Looks up the flag for a given extension, for a given compiler.
-- Ignores the subtlety of extensions which lack associated flags.
extensionToFlag :: Compiler -> Extension -> Maybe Flag
extensionToFlag :: Compiler -> Extension -> Maybe CompilerFlag
extensionToFlag comp ext = join (extensionToFlag' comp ext)
-- | Looks up the flag for a given extension, for a given compiler.
......@@ -315,7 +315,7 @@ extensionToFlag comp ext = join (extensionToFlag' comp ext)
-- the inner layer indicates whether it has a flag.
-- When building strings, it is often more convenient to use 'extensionToFlag',
-- which ignores the difference.
extensionToFlag' :: Compiler -> Extension -> Maybe (Maybe Flag)
extensionToFlag' :: Compiler -> Extension -> Maybe (Maybe CompilerFlag)
extensionToFlag' comp ext = lookup ext (compilerExtensions comp)
-- | Does this compiler support parallel --make mode?
......
......@@ -60,15 +60,15 @@ import Distribution.Compat.Prelude
import Distribution.Compiler
import Distribution.Types.IncludeRenaming
import Distribution.Utils.NubList
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.Simple.PreProcess
import Distribution.Package
import qualified Distribution.InstalledPackageInfo as Installed
import qualified Distribution.InstalledPackageInfo as IPI
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import qualified Distribution.Simple.PackageIndex as PackageIndex
import Distribution.Simple.PackageIndex (InstalledPackageIndex)
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.Types.PackageDescription as PD
import Distribution.PackageDescription
import Distribution.Types.PackageDescription
import Distribution.PackageDescription.PrettyPrint
import Distribution.PackageDescription.Configuration
import Distribution.PackageDescription.Check hiding (doesFileExist)
......@@ -902,7 +902,7 @@ getInternalPackages pkg_descr0 =
-- | Returns true if a dependency is satisfiable. This function may
-- report a dependency satisfiable even when it is not, but not vice
-- versa. This is to be passed to finalizePD.
-- versa. This is to be passed to finalize
dependencySatisfiable
:: Bool -- ^ use external internal deps?
-> Bool -- ^ exact configuration?
......@@ -977,7 +977,7 @@ dependencySatisfiable
-- library yet, so we just return a bool and later report a generic error.
visible lib = maybe
False -- Does not even exist (wasn't in the depsMap)
(\ipi -> Installed.libVisibility ipi == LibraryVisibilityPublic
(\ipi -> IPI.libVisibility ipi == LibraryVisibilityPublic
-- If the override is enabled, the visibility does
-- not matter (it's handled externally)
|| allow_private_deps
......@@ -986,7 +986,7 @@ dependencySatisfiable
-- This is only triggered when passing a component
-- of the same package as --dependency, such as in:
-- cabal-testsuite/PackageTests/ConfigureComponent/SubLib/setup-explicit.test.hs
|| pkgName (Installed.sourcePackageId ipi) == pn)
|| pkgName (IPI.sourcePackageId ipi) == pn)
maybeIPI
where maybeIPI = Map.lookup (depName, CLibName lib) requiredDepsMap
......@@ -1040,7 +1040,7 @@ configureFinalizedPackage verbosity cfg enabled
addExtraIncludeLibDirs pkg_descr =
let extraBi = mempty { extraLibDirs = configExtraLibDirs cfg
, extraFrameworkDirs = configExtraFrameworkDirs cfg
, PD.includeDirs = configExtraIncludeDirs cfg}
, includeDirs = configExtraIncludeDirs cfg}
modifyLib l = l{ libBuildInfo = libBuildInfo l
`mappend` extraBi }
modifyExecutable e = e{ buildInfo = buildInfo e
......@@ -1072,13 +1072,13 @@ checkCompilerProblems verbosity comp pkg_descr enabled = do
++ "package flags. To use this feature you must use "
++ "GHC 7.9 or later."
when (any (not.null.PD.reexportedModules) (PD.allLibraries pkg_descr)
when (any (not.null.reexportedModules) (allLibraries pkg_descr)
&& not (reexportedModulesSupported comp)) $
die' verbosity $
"Your compiler does not support module re-exports. To use "
++ "this feature you must use GHC 7.9 or later."
when (any (not.null.PD.signatures) (PD.allLibraries pkg_descr)
when (any (not.null.signatures) (allLibraries pkg_descr)
&& not (backpackSupported comp)) $
die' verbosity $
"Your compiler does not support Backpack. To use "
......@@ -1684,11 +1684,11 @@ ccLdOptionsBuildInfo cflags ldflags =
(extraLibs', ldflags') = partition ("-l" `isPrefixOf`) ldflags
(extraLibDirs', ldflags'') = partition ("-L" `isPrefixOf`) ldflags'
in mempty {
PD.includeDirs = map (drop 2) includeDirs',
PD.extraLibs = map (drop 2) extraLibs',
PD.extraLibDirs = map (drop 2) extraLibDirs',
PD.ccOptions = cflags',
PD.ldOptions = ldflags''
includeDirs = map (drop 2) includeDirs',
extraLibs = map (drop 2) extraLibs',
extraLibDirs = map (drop 2) extraLibDirs',
ccOptions = cflags',
ldOptions = ldflags''
}
-- -----------------------------------------------------------------------------
......@@ -1734,8 +1734,8 @@ checkForeignDeps pkg lbi verbosity =
missingHdr <- findOffendingHdr
explainErrors missingHdr missingLibs)
where
allHeaders = collectField PD.includes
allLibs = collectField PD.extraLibs
allHeaders = collectField includes
allLibs = collectField extraLibs
ifBuildsWith headers args success failure = do
checkDuplicateHeaders
......@@ -1755,7 +1755,7 @@ checkForeignDeps pkg lbi verbosity =
-- including file. As such we need to take drastic measures
-- and delete the offending file in the source directory.
checkDuplicateHeaders = do
let relIncDirs = filter (not . isAbsolute) (collectField PD.includeDirs)
let relIncDirs = filter (not . isAbsolute) (collectField includeDirs)
isHeader = isSuffixOf ".h"
genHeaders <- forM relIncDirs $ \dir ->
fmap (dir </>) . filter isHeader <$>
......@@ -1808,42 +1808,42 @@ checkForeignDeps pkg lbi verbosity =
++ [ "-I" ++ buildDir lbi </> "autogen" ]
-- `configure' may generate headers in the build directory
++ [ "-I" ++ buildDir lbi </> dir
| dir <- ordNub (collectField PD.includeDirs)
| dir <- ordNub (collectField includeDirs)
, not (isAbsolute dir)]
-- we might also reference headers from the
-- packages directory.
++ [ "-I" ++ baseDir lbi </> dir
| dir <- ordNub (collectField PD.includeDirs)
| dir <- ordNub (collectField includeDirs)
, not (isAbsolute dir)]
++ [ "-I" ++ dir | dir <- ordNub (collectField PD.includeDirs)
++ [ "-I" ++ dir | dir <- ordNub (collectField includeDirs)
, isAbsolute dir]
++ ["-I" ++ baseDir lbi]
++ collectField PD.cppOptions
++ collectField PD.ccOptions
++ collectField cppOptions
++ collectField ccOptions
++ [ "-I" ++ dir
| dir <- ordNub [ dir
| dep <- deps
, dir <- Installed.includeDirs dep ]
, dir <- IPI.includeDirs dep ]
-- dedupe include dirs of dependencies
-- to prevent quadratic blow-up
]
++ [ opt
| dep <- deps
, opt <- Installed.ccOptions dep ]
, opt <- IPI.ccOptions dep ]
commonCcArgs = commonCppArgs
++ collectField PD.ccOptions
++ collectField ccOptions
++ [ opt
| dep <- deps
, opt <- Installed.ccOptions dep ]
, opt <- IPI.ccOptions dep ]
commonLdArgs = [ "-L" ++ dir
| dir <- ordNub (collectField PD.extraLibDirs) ]
++ collectField PD.ldOptions
| dir <- ordNub (collectField extraLibDirs) ]
++ collectField ldOptions
++ [ "-L" ++ dir
| dir <- ordNub [ dir
| dep <- deps
, dir <- Installed.libraryDirs dep ]
, dir <- IPI.libraryDirs dep ]
]
--TODO: do we also need dependent packages' ld options?
makeLdArgs libs = [ "-l"++lib | lib <- libs ] ++ commonLdArgs
......@@ -2012,8 +2012,8 @@ checkRelocatable verbosity pkg lbi
traverse_ (doCheck pkgr) ipkgs
where
doCheck pkgr ipkg
| maybe False (== pkgr) (Installed.pkgRoot ipkg)
= forM_ (Installed.libraryDirs ipkg) $ \libdir -> do
| maybe False (== pkgr) (IPI.pkgRoot ipkg)
= forM_ (IPI.libraryDirs ipkg) $ \libdir -> do
-- When @prefix@ is not under @pkgroot@,
-- @shortRelativePath prefix pkgroot@ will return a path with
-- @..@s and following check will fail without @canonicalizePath@.
......
......@@ -25,8 +25,8 @@ import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.GHCJS as GHCJS
-- local
import Distribution.PackageDescription as PD hiding (Flag)
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.PackageDescription
import Distribution.Simple.Compiler
import Distribution.Simple.Program.GHC
import Distribution.Simple.Program
import Distribution.Simple.PreProcess
......
......@@ -99,7 +99,7 @@ import qualified Distribution.Simple.Program.Strip as Strip
import Distribution.Simple.Program.GHC
import Distribution.Simple.Setup
import qualified Distribution.Simple.Setup as Cabal
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.Version
import Distribution.System
import Distribution.Verbosity
......
......@@ -51,12 +51,11 @@ import Distribution.Compat.Prelude
import Distribution.Simple.GHC.ImplInfo
import Distribution.Types.ComponentLocalBuildInfo
import Distribution.Backpack
import Distribution.InstalledPackageInfo
import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo
import Distribution.PackageDescription as PD hiding (Flag)
import qualified Distribution.InstalledPackageInfo as IPI
import Distribution.PackageDescription
import Distribution.Compat.Exception
import Distribution.Lex
import Distribution.Simple.Compiler hiding (Flag)
import Distribution.Simple.Compiler
import Distribution.Simple.Program.GHC
import Distribution.Simple.Setup
import qualified Distribution.ModuleName as ModuleName
......@@ -281,10 +280,10 @@ componentCcGhcOptions verbosity _implInfo lbi bi clbi odir filename =
,autogenPackageModulesDir lbi
,odir]
-- includes relative to the package
++ PD.includeDirs bi
++ includeDirs bi
-- potential includes generated by `configure'
-- in the build directory
++ [buildDir lbi </> dir | dir <- PD.includeDirs bi],
++ [buildDir lbi </> dir | dir <- includeDirs bi],
ghcOptHideAllPackages= toFlag True,
ghcOptPackageDBs = withPackageDB lbi,
ghcOptPackages = toNubListR $ mkGhcOptPackages clbi,
......@@ -296,7 +295,7 @@ componentCcGhcOptions verbosity _implInfo lbi bi clbi odir filename =
MinimalDebugInfo -> ["-g1"]
NormalDebugInfo -> ["-g"]
MaximalDebugInfo -> ["-g3"]) ++
PD.ccOptions bi,
ccOptions bi,
ghcOptObjDir = toFlag odir
}
......@@ -317,10 +316,10 @@ componentCxxGhcOptions verbosity _implInfo lbi bi clbi odir filename =
,autogenPackageModulesDir lbi
,odir]
-- includes relative to the package
++ PD.includeDirs bi
++ includeDirs bi
-- potential includes generated by `configure'
-- in the build directory
++ [buildDir lbi </> dir | dir <- PD.includeDirs bi],
++ [buildDir lbi </> dir | dir <- includeDirs bi],
ghcOptHideAllPackages= toFlag True,
ghcOptPackageDBs = withPackageDB lbi,
ghcOptPackages = toNubListR $ mkGhcOptPackages clbi,
......@@ -332,7 +331,7 @@ componentCxxGhcOptions verbosity _implInfo lbi bi clbi odir filename =
MinimalDebugInfo -> ["-g1"]
NormalDebugInfo -> ["-g"]
MaximalDebugInfo -> ["-g3"]) ++
PD.cxxOptions bi,
cxxOptions bi,
ghcOptObjDir = toFlag odir
}
......@@ -353,10 +352,10 @@ componentAsmGhcOptions verbosity _implInfo lbi bi clbi odir filename =
,autogenPackageModulesDir lbi
,odir]
-- includes relative to the package
++ PD.includeDirs bi
++ includeDirs bi
-- potential includes generated by `configure'
-- in the build directory
++ [buildDir lbi </> dir | dir <- PD.includeDirs bi],
++ [buildDir lbi </> dir | dir <- includeDirs bi],
ghcOptHideAllPackages= toFlag True,
ghcOptPackageDBs = withPackageDB lbi,
ghcOptPackages = toNubListR $ mkGhcOptPackages clbi,
......@@ -368,7 +367,7 @@ componentAsmGhcOptions verbosity _implInfo lbi bi clbi odir filename =
MinimalDebugInfo -> ["-g1"]
NormalDebugInfo -> ["-g"]
MaximalDebugInfo -> ["-g3"]) ++
PD.asmOptions bi,
asmOptions bi,
ghcOptObjDir = toFlag odir
}
......@@ -412,14 +411,14 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir =
,autogenPackageModulesDir lbi
,odir]
-- includes relative to the package
++ PD.includeDirs bi
++ includeDirs bi
-- potential includes generated by `configure'
-- in the build directory
++ [buildDir lbi </> dir | dir <- PD.includeDirs bi],
++ [buildDir lbi </> dir | dir <- includeDirs bi],
ghcOptCppOptions = cppOptions bi,
ghcOptCppIncludes = toNubListR $
[autogenComponentModulesDir lbi clbi </> cppHeaderName],
ghcOptFfiIncludes = toNubListR $ PD.includes bi,
ghcOptFfiIncludes = toNubListR $ includes bi,
ghcOptObjDir = toFlag odir,
ghcOptHiDir = toFlag odir,
ghcOptStubDir = toFlag odir,
......@@ -461,10 +460,10 @@ componentCmmGhcOptions verbosity _implInfo lbi bi clbi odir filename =
,autogenPackageModulesDir lbi
,odir]
-- includes relative to the package