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