[project @ 2000-06-13 16:07:20 by simonmar]
[ghc-hetmet.git] / ghc / driver / Package.hs
1 module Package where
2
3 import Pretty
4
5 data Package = Package {
6                 import_dirs    :: [String],
7                 library_dirs   :: [String],
8                 libraries      :: [String],
9                 include_dir    :: String,
10                 c_include      :: String,
11                 package_deps   :: [String],
12                 extra_ghc_opts :: String,
13                 extra_cc_opts  :: String,
14                 extra_ld_opts  :: String
15                 }
16   deriving (Read, Show)
17
18 pprPackage :: [(String,Package)] -> String
19 pprPackage pkgs = render (brackets (vcat (punctuate comma (map pprPkg pkgs))))
20
21 pprPkg (name, (Package
22         { import_dirs    = import_dirs    
23         , library_dirs   = library_dirs   
24         , libraries      = libraries      
25         , include_dir    = include_dir    
26         , c_include      = c_include      
27         , package_deps   = package_deps   
28         , extra_ghc_opts = extra_ghc_opts 
29         , extra_cc_opts  = extra_cc_opts  
30         , extra_ld_opts  = extra_ld_opts   }))
31    = parens ( 
32         text (show name) <> comma
33     <+> text "Package" <+> braces (
34         vcat [
35            text "import_dirs = "    <> text (show import_dirs) <> comma,
36            text "library_dirs = "   <> text (show library_dirs) <> comma,
37            text "libraries = "      <> text (show libraries) <> comma,
38            text "include_dir = "    <> text (show include_dir) <> comma,
39            text "c_include = "      <> text (show c_include) <> comma,
40            text "package_deps = "   <> text (show package_deps) <> comma,
41            text "extra_ghc_opts = " <> text (show extra_ghc_opts) <> comma,
42            text "extra_cc_opts = "  <> text (show extra_cc_opts) <> comma,
43            text "extra_ld_opts = "  <> text (show extra_ld_opts)
44         ])
45     )