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