X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Futils%2Fghc-pkg%2FPackage.hs;h=c43fd6e4e595b1da37cce9cccbba240e15fc28b7;hb=1f8b341a88b6b60935b0ce80b59ed6e356b8cfbf;hp=ae330ab54c9fa47c70af425f8fdf4099309dc32f;hpb=ff21a38c1b219a512e71c133b1c904a16b985265;p=ghc-hetmet.git diff --git a/ghc/utils/ghc-pkg/Package.hs b/ghc/utils/ghc-pkg/Package.hs index ae330ab..c43fd6e 100644 --- a/ghc/utils/ghc-pkg/Package.hs +++ b/ghc/utils/ghc-pkg/Package.hs @@ -1,28 +1,32 @@ ----------------------------------------------------------------------------- --- $Id: Package.hs,v 1.2 2001/03/27 14:10:34 simonmar Exp $ -- --- Package configuration defn. +-- (c) The University of Glasgow 2004 +-- +-- BACKWARDS COMPATIBILITY only. This is the old (pre-6.4) package +-- configuration type, which is still accepted by ghc-pkg for +-- compatibility. The new type is InstalledPackageInfo from the +-- Distribution.InstalledPackageInfo module. +-- ----------------------------------------------------------------------------- -#ifdef PKG_TOOL module Package ( PackageConfig(..), defaultPackageConfig -#ifdef WANT_PRETTY , listPkgs -- :: [PackageConfig] -> String , dumpPackages -- :: [PackageConfig] -> String , dumpPkgGuts -- :: PackageConfig -> Doc , dumpFieldContents -- :: [String] -> Doc -#endif ) where -#endif -#ifdef WANT_PRETTY +#if __GLASGOW_HASKELL__ >= 504 && !defined(INTERNAL_PRETTY) +import Text.PrettyPrint +#else import Pretty #endif data PackageConfig = Package { name :: String, + auto :: Bool, import_dirs :: [String], source_dirs :: [String], library_dirs :: [String], @@ -33,15 +37,15 @@ data PackageConfig package_deps :: [String], extra_ghc_opts :: [String], extra_cc_opts :: [String], - extra_ld_opts :: [String] + extra_ld_opts :: [String], + framework_dirs :: [String], -- ignored everywhere but on Darwin/MacOS X + extra_frameworks:: [String] -- ignored everywhere but on Darwin/MacOS X } -#ifdef PKG_TOOL - deriving (Read) -#endif defaultPackageConfig = Package { name = error "defaultPackage", + auto = False, import_dirs = [], source_dirs = [], library_dirs = [], @@ -52,13 +56,14 @@ defaultPackageConfig package_deps = [], extra_ghc_opts = [], extra_cc_opts = [], - extra_ld_opts = [] + extra_ld_opts = [], + framework_dirs = [], + extra_frameworks= [] } ----------------------------------------------------------------------------- -- Pretty printing package info -#ifdef WANT_PRETTY listPkgs :: [PackageConfig] -> String listPkgs pkgs = render (fsep (punctuate comma (map (text . name) pkgs))) @@ -71,6 +76,7 @@ dumpPkgGuts pkg = text "Package" $$ nest 3 (braces ( sep (punctuate comma [ text "name = " <> text (show (name pkg)), + text "auto = " <> text (show (auto pkg)), dumpField "import_dirs" (import_dirs pkg), dumpField "source_dirs" (source_dirs pkg), dumpField "library_dirs" (library_dirs pkg), @@ -81,7 +87,9 @@ dumpPkgGuts pkg = dumpField "package_deps" (package_deps pkg), dumpField "extra_ghc_opts" (extra_ghc_opts pkg), dumpField "extra_cc_opts" (extra_cc_opts pkg), - dumpField "extra_ld_opts" (extra_ld_opts pkg) + dumpField "extra_ld_opts" (extra_ld_opts pkg), + dumpField "framework_dirs" (framework_dirs pkg), + dumpField "extra_frameworks"(extra_frameworks pkg) ]))) dumpField :: String -> [String] -> Doc @@ -89,5 +97,4 @@ dumpField name val = hang (text name <+> equals) 2 (dumpFieldContents val) dumpFieldContents :: [String] -> Doc dumpFieldContents val = brackets (sep (punctuate comma (map (text . show) val))) -#endif