[project @ 2001-03-15 15:54:35 by simonmar]
[ghc-hetmet.git] / ghc / driver / PackageSrc.hs
1 #include "../includes/config.h"
2
3 module Main (main) where
4
5 import Utils
6
7 import IO
8 import System
9 import Config
10 import Package
11
12 main :: IO ()
13 main = do
14   args <- getArgs
15   case args of
16         [ "install"  ] -> do { putStrLn (dumpPackages (package_details True)) }
17         [ "in-place" ] -> do { putStrLn (dumpPackages (package_details False)) }
18         _ -> do hPutStr stderr "usage: pkgconf (install | in-place)\n"
19                 exitWith (ExitFailure 1)
20
21 package_details :: Bool -> [PackageConfig]
22 package_details installing =
23  [
24         Package {
25         name           = "gmp",  -- GMP is at the bottom of the heap
26         import_dirs    = [],
27         source_dirs    = [],
28         library_dirs   = if cHaveLibGmp == "YES"
29                             then []
30                             else if installing
31                                     then [ clibdir ]
32                                     else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ],
33         hs_libraries   = [],
34         extra_libraries = [ "gmp" ],
35         include_dirs   = [],
36         c_includes     = [],
37         package_deps   = [],
38         extra_ghc_opts = [],
39         extra_cc_opts  = [],
40         extra_ld_opts  = []
41         },
42
43         Package {
44         name           = "rts",  -- The RTS is just another package!
45         import_dirs    = [],
46         source_dirs    = [],
47         library_dirs   = if installing
48                             then [ clibdir ]
49                             else [ ghc_src_dir cGHC_RUNTIME_DIR ],
50         hs_libraries      = [ "HSrts" ],
51 #ifndef mingw32_TARGET_OS
52         extra_libraries   = [],
53 #else
54         extra_libraries   = [ "winmm" ], -- for the threadDelay timer
55 #endif
56         include_dirs   = if installing
57                             then [ clibdir ++ "/includes" ]
58                             else [ ghc_src_dir cGHC_INCLUDE_DIR ],
59         c_includes     = [ "Stg.h" ],           -- ha!
60         package_deps   = [ "gmp" ],
61         extra_ghc_opts = [],
62         extra_cc_opts  = [],
63                 -- the RTS forward-references to a bunch of stuff in the prelude,
64                 -- so we force it to be included with special options to ld.
65         extra_ld_opts  = map (
66 #ifndef LEADING_UNDERSCORE
67                           "-u "
68 #else
69                           "-u _"
70 #endif
71                           ++ ) [
72            "PrelBase_Izh_static_info"
73          , "PrelBase_Czh_static_info"
74          , "PrelFloat_Fzh_static_info"
75          , "PrelFloat_Dzh_static_info"
76          , "PrelPtr_Ptr_static_info"
77          , "PrelWord_Wzh_static_info"
78          , "PrelInt_I8zh_static_info"
79          , "PrelInt_I16zh_static_info"
80          , "PrelInt_I32zh_static_info"
81          , "PrelInt_I64zh_static_info"
82          , "PrelWord_W8zh_static_info"
83          , "PrelWord_W16zh_static_info"
84          , "PrelWord_W32zh_static_info"
85          , "PrelWord_W64zh_static_info"
86          , "PrelStable_StablePtr_static_info"
87          , "PrelBase_Izh_con_info"
88          , "PrelBase_Czh_con_info"
89          , "PrelFloat_Fzh_con_info"
90          , "PrelFloat_Dzh_con_info"
91          , "PrelPtr_Ptr_con_info"
92          , "PrelStable_StablePtr_con_info"
93          , "PrelBase_False_closure"
94          , "PrelBase_True_closure"
95          , "PrelPack_unpackCString_closure"
96          , "PrelIOBase_stackOverflow_closure"
97          , "PrelIOBase_heapOverflow_closure"
98          , "PrelIOBase_NonTermination_closure"
99          , "PrelIOBase_PutFullMVar_closure"
100          , "PrelIOBase_BlockedOnDeadMVar_closure"
101          , "PrelWeak_runFinalizzerBatch_closure"
102          , "__init_Prelude"
103          ]
104         },
105
106         Package {
107         name           = "std",  -- The Prelude & Standard Hs_libraries
108         import_dirs    = if installing
109                             then [ clibdir ++ "/imports/std" ]
110                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
111         source_dirs    = [],
112         library_dirs   = if installing
113                             then [ clibdir ]
114                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
115                                  , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
116         hs_libraries      = [ "HSstd" ],
117         extra_libraries   = [ "HSstd_cbits" ] ++
118 #                           ifdef mingw32_TARGET_OS
119                             ["wsock32", "msvcrt"]
120 #                           else
121                             ["m"]   -- libm, that is
122 #                           endif
123                             ,
124         include_dirs   = if installing
125                             then []
126                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
127         c_includes     = [ "HsStd.h" ],
128         package_deps   = [ "rts" ],
129         extra_ghc_opts = [],
130         extra_cc_opts  = [],
131         extra_ld_opts  = []
132         },
133
134          Package { 
135          name           = "lang",
136          import_dirs    = if installing
137                              then [ clibdir ++ "/imports/lang" ]
138                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
139                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/monads" ],
140          source_dirs    = [],
141          library_dirs   = if installing
142                              then [ clibdir ]
143                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
144                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
145          hs_libraries      = [ "HSlang" ],
146          extra_libraries   = [ "HSlang_cbits" ],
147          include_dirs   = if installing
148                              then []
149                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
150          c_includes     = [ "HsLang.h" ],
151          package_deps   = [],
152          extra_ghc_opts = [],
153          extra_cc_opts  = [],
154          extra_ld_opts  = [
155 #ifndef LEADING_UNDERSCORE
156                           "-u Addr_Azh_static_info"
157 #else
158                           "-u _Addr_Azh_static_info"
159 #endif
160                         ]
161         },
162
163          Package {
164          name           = "concurrent",
165          import_dirs    = if installing
166                              then [ clibdir ++ "/imports/concurrent" ]
167                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
168          source_dirs    = [],
169          library_dirs   = if installing
170                              then [ clibdir ]
171                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
172          hs_libraries      = [ "HSconcurrent" ],
173          extra_libraries   = [],
174          include_dirs   = if installing
175                              then []
176                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ],
177          c_includes     = [],
178          package_deps   = [ "lang" ],
179          extra_ghc_opts = [],
180          extra_cc_opts  = [],
181          extra_ld_opts  = []
182         },
183
184          Package {
185          name           = "data",
186          import_dirs    = if installing
187                              then [ clibdir ++ "/imports/data" ]
188                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data"
189                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison"
190                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Assoc"
191                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Coll"
192                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Seq" ],
193          source_dirs    = [],
194          library_dirs   = if installing
195                              then [clibdir ]
196                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ],
197          hs_libraries      = [ "HSdata" ],
198          extra_libraries   = [],
199          include_dirs   = if installing
200                              then []
201                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ],
202          c_includes     = [],
203          package_deps   = [ "lang", "util" ],
204          extra_ghc_opts = [],
205          extra_cc_opts  = [],
206          extra_ld_opts  = []
207         },
208
209          Package {
210          name           = "net",
211          import_dirs    = if installing
212                              then [ clibdir ++ "/imports/net" ]
213                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" ],
214          source_dirs    = [],
215          library_dirs   = if installing
216                              then [ clibdir ]
217                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net"
218                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
219          hs_libraries      = [ "HSnet" ],
220          extra_libraries   = [ "HSnet_cbits" ] 
221                              ++ if suffixMatch "solaris2" cTARGETPLATFORM
222                                 then [ "nsl",  "socket" ]
223                                 else []
224                              ,
225          include_dirs   = if installing
226                              then []
227                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
228          c_includes     = [ "HsNet.h" ],
229          package_deps   = [ "lang", "text", "concurrent" ],
230          extra_ghc_opts = [],
231          extra_cc_opts  = [],
232          extra_ld_opts  = []
233         },
234
235          Package {
236          name           = "posix",
237          import_dirs    = if installing
238                              then [ clibdir ++ "/imports/posix" ]
239                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" ],
240          source_dirs    = [],
241          library_dirs   = if installing
242                              then [ clibdir ]
243                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix"
244                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
245          hs_libraries      = [ "HSposix" ],
246          extra_libraries   = [ "HSposix_cbits" ],
247          include_dirs   = if installing
248                              then []
249                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
250          c_includes     = [ "HsPosix.h" ],
251          package_deps   = [ "lang" ],
252          extra_ghc_opts = [],
253          extra_cc_opts  = [],
254          extra_ld_opts  = []
255         },
256
257          Package {
258          name           = "text",
259          import_dirs    = if installing
260                              then [ clibdir ++ "/imports/text" ]
261                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text" 
262                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/html" 
263                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/HaXml/lib" 
264                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/parsec" ],
265          source_dirs    = [],
266          library_dirs   = if installing
267                              then [ clibdir ]
268                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text"
269                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
270          hs_libraries      = [ "HStext" ],
271          extra_libraries   = [ "HStext_cbits" ],
272          include_dirs   = if installing
273                              then []
274                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
275          c_includes     = [ "HsText.h" ],
276          package_deps   = [ "lang" ],
277          extra_ghc_opts = [],
278          extra_cc_opts  = [],
279          extra_ld_opts  = []
280         },
281
282          Package {
283          name           = "util",
284          import_dirs    = if installing
285                              then [ clibdir ++ "/imports/util" ]
286                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
287                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/util/check" ],
288          source_dirs    = [],
289          library_dirs   = if installing
290                              then [ clibdir ]
291                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
292                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
293          hs_libraries      = [ "HSutil" ],
294          extra_libraries   = [ "HSutil_cbits" ],
295          include_dirs   = if installing
296                              then []
297                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
298          c_includes     = [ "HsUtil.h" ],
299          package_deps   = [ "lang", "concurrent"
300 #ifndef mingw32_TARGET_OS
301                             , "posix"
302 #endif
303                           ],
304          extra_ghc_opts = [],
305          extra_cc_opts  = [],
306          extra_ld_opts  = words cLibsReadline
307         },
308
309         -- no cbits at the moment, we'll need to add one if this library
310         -- ever calls out to any C libs.
311          Package {
312          name           = "hssource",
313          import_dirs    = if installing
314                              then [ clibdir ++ "/imports/hssource" ]
315                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
316          source_dirs    = [],
317          library_dirs   = if installing
318                              then [ clibdir ]
319                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
320          hs_libraries      = [ "HShssource" ],
321          extra_libraries   = [],
322          include_dirs   = [],
323          c_includes     = [],
324          package_deps   = [ "text" ],
325          extra_ghc_opts = [],
326          extra_cc_opts  = [],
327          extra_ld_opts  = []
328         },
329
330          Package {
331          name         = "greencard",
332          import_dirs    = if installing
333                              then [ clibdir ++ "/imports/greencard" ]
334                              else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ],
335          source_dirs    = [],
336          library_dirs   = if installing
337                              then [ clibdir ]
338                              else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ],
339          hs_libraries      = [ "HSgreencard" ],
340          extra_libraries   = [],
341          include_dirs   = [],
342          c_includes     = [],
343          package_deps   = [ "lang" ],
344          extra_ghc_opts = [],
345          extra_cc_opts  = [],
346          extra_ld_opts  = [],
347         },
348
349          Package {
350          name         = "win32",
351          import_dirs    = if installing
352                              then [ clibdir ++ "/imports/win32" ]
353                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ],
354          source_dirs    = [],
355          library_dirs   = if installing
356                              then [ clibdir ]
357                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ],
358          hs_libraries      = [ "HSwin32" ],
359          extra_libraries   = [ "user32",  "gdi32", "winmm" ],
360          include_dirs   = [],
361          c_includes     = [],           -- ???
362          package_deps   = [ "lang", "greencard" ],
363          extra_ghc_opts = [],
364          extra_cc_opts  = [],
365          extra_ld_opts  = []
366         },
367
368          Package {
369          name           = "com",
370          import_dirs    = if installing
371                              then [ clibdir ++ "/imports/com" ]
372                              else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
373          source_dirs    = [],
374          library_dirs   = if installing
375                              then [ clibdir ]
376                              else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
377          hs_libraries      = [ "HScom" ],
378          extra_libraries   = [ "user32",  "ole32",  "oleaut32", "advapi32" ],
379          include_dirs   = [],
380          c_includes     = [],           -- ???
381          package_deps   = [ "lang" ],
382          extra_ghc_opts = [],
383          extra_cc_opts  = [],
384          extra_ld_opts  = []
385         }
386    ]
387
388 ghc_src_dir :: String -> String
389 ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path