[project @ 2000-12-23 17:45:03 by qrczak]
[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   = [ "dl" ],
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          , "PrelAddr_Azh_static_info"
71          , "PrelAddr_Wzh_static_info"
72          , "PrelAddr_I64zh_static_info"
73          , "PrelAddr_W64zh_static_info"
74          , "PrelStable_StablePtr_static_info"
75          , "PrelBase_Izh_con_info"
76          , "PrelBase_Czh_con_info"
77          , "PrelFloat_Fzh_con_info"
78          , "PrelFloat_Dzh_con_info"
79          , "PrelAddr_Azh_con_info"
80          , "PrelAddr_Wzh_con_info"
81          , "PrelAddr_I64zh_con_info"
82          , "PrelAddr_W64zh_con_info"
83          , "PrelStable_StablePtr_con_info"
84          , "PrelBase_False_closure"
85          , "PrelBase_True_closure"
86          , "PrelPack_unpackCString_closure"
87          , "PrelIOBase_stackOverflow_closure"
88          , "PrelIOBase_heapOverflow_closure"
89          , "PrelIOBase_NonTermination_closure"
90          , "PrelIOBase_PutFullMVar_closure"
91          , "PrelIOBase_BlockedOnDeadMVar_closure"
92          , "PrelWeak_runFinalizzerBatch_closure"
93          , "__init_Prelude"
94          ]
95         },
96
97         Package {
98         name           = "std",  -- The Prelude & Standard Hs_libraries
99         import_dirs    = if installing
100                             then [ clibdir ++ "/imports/std" ]
101                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
102         library_dirs   = if installing
103                             then [ clibdir ]
104                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
105                                  , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
106         hs_libraries      = [ "HSstd" ],
107         extra_libraries   = [ "HSstd_cbits" ],
108         include_dirs   = if installing
109                             then []
110                             else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
111         c_includes     = [ "HsStd.h" ],
112         package_deps   = [ "rts" ],
113         extra_ghc_opts = [],
114         extra_cc_opts  = [],
115         extra_ld_opts  = [ "-lm"
116 #ifdef mingw32_TARGET_OS
117                          , "-lwsock32"
118 #endif
119                          ]
120         },
121
122          Package { 
123          name           = "lang",
124          import_dirs    = if installing
125                              then [ clibdir ++ "/imports/lang" ]
126                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
127                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/monads" ],
128          library_dirs   = if installing
129                              then [ clibdir ]
130                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
131                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
132          hs_libraries      = [ "HSlang" ],
133          extra_libraries   = [ "HSlang_cbits" ],
134          include_dirs   = if installing
135                              then []
136                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
137          c_includes     = [ "HsLang.h" ],
138          package_deps   = [],
139          extra_ghc_opts = [],
140          extra_cc_opts  = [],
141          extra_ld_opts  = []
142         },
143
144          Package {
145          name           = "concurrent",
146          import_dirs    = if installing
147                              then [ clibdir ++ "/imports/concurrent" ]
148                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
149          library_dirs   = if installing
150                              then [ clibdir ]
151                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
152          hs_libraries      = [ "HSconcurrent" ],
153          extra_libraries   = [],
154          include_dirs   = if installing
155                              then []
156                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ],
157          c_includes     = [],
158          package_deps   = [ "lang" ],
159          extra_ghc_opts = [],
160          extra_cc_opts  = [],
161          extra_ld_opts  = []
162         },
163
164          Package {
165          name           = "data",
166          import_dirs    = if installing
167                              then [ clibdir ++ "/imports/data" ]
168                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data"
169                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison"
170                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Assoc"
171                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Coll"
172                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Seq" ],
173          library_dirs   = if installing
174                              then [clibdir ]
175                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ],
176          hs_libraries      = [ "HSdata" ],
177          extra_libraries   = [],
178          include_dirs   = if installing
179                              then []
180                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ],
181          c_includes     = [],
182          package_deps   = [ "lang" ],
183          extra_ghc_opts = [],
184          extra_cc_opts  = [],
185          extra_ld_opts  = []
186         },
187
188          Package {
189          name           = "net",
190          import_dirs    = if installing
191                              then [ clibdir ++ "/imports/net" ]
192                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" ],
193          library_dirs   = if installing
194                              then [ clibdir ]
195                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net"
196                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
197          hs_libraries      = [ "HSnet" ],
198          extra_libraries   = [ "HSnet_cbits" ],
199          include_dirs   = if installing
200                              then []
201                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
202          c_includes     = [ "HsNet.h" ],
203          package_deps   = [ "lang", "text" ],
204          extra_ghc_opts = [],
205          extra_cc_opts  = [],
206          extra_ld_opts  = if suffixMatch "solaris2" cTARGETPLATFORM
207                              then [ "-lnsl",  "-lsocket" ]
208                              else []
209         },
210
211          Package {
212          name           = "posix",
213          import_dirs    = if installing
214                              then [ clibdir ++ "/imports/posix" ]
215                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" ],
216          library_dirs   = if installing
217                              then [ clibdir ]
218                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix"
219                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
220          hs_libraries      = [ "HSposix" ],
221          extra_libraries   = [ "HSposix_cbits" ],
222          include_dirs   = if installing
223                              then []
224                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
225          c_includes     = [ "HsPosix.h" ],
226          package_deps   = [ "lang" ],
227          extra_ghc_opts = [],
228          extra_cc_opts  = [],
229          extra_ld_opts  = []
230         },
231
232          Package {
233          name           = "text",
234          import_dirs    = if installing
235                              then [ clibdir ++ "/imports/text" ]
236                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text" 
237                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/html" 
238                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/HaXml/lib" 
239                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/parsec" ],
240          library_dirs   = if installing
241                              then [ clibdir ]
242                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text"
243                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
244          hs_libraries      = [ "HStext" ],
245          extra_libraries   = [ "HStext_cbits" ],
246          include_dirs   = if installing
247                              then []
248                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
249          c_includes     = [ "HsText.h" ],
250          package_deps   = [ "lang", "data" ],
251          extra_ghc_opts = [],
252          extra_cc_opts  = [],
253          extra_ld_opts  = []
254         },
255
256          Package {
257          name           = "util",
258          import_dirs    = if installing
259                              then [ clibdir ++ "/imports/util" ]
260                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
261                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/util/check" ],
262          library_dirs   = if installing
263                              then [ clibdir ]
264                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
265                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
266          hs_libraries      = [ "HSutil" ],
267          extra_libraries   = [ "HSutil_cbits" ],
268          include_dirs   = if installing
269                              then []
270                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
271          c_includes     = [ "HsUtil.h" ],
272          package_deps   = [ "lang", "concurrent"
273 #ifndef mingw32_TARGET_OS
274                             , "posix"
275 #endif
276                           ],
277          extra_ghc_opts = [],
278          extra_cc_opts  = [],
279          extra_ld_opts  = words cLibsReadline
280         },
281
282         -- no cbits at the moment, we'll need to add one if this library
283         -- ever calls out to any C libs.
284          Package {
285          name           = "hssource",
286          import_dirs    = if installing
287                              then [ clibdir ++ "/imports/hssource" ]
288                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
289          library_dirs   = if installing
290                              then [ clibdir ]
291                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
292          hs_libraries      = [ "HShssource" ],
293          extra_libraries   = [],
294          include_dirs   = [],
295          c_includes     = [],
296          package_deps   = [ "text" ],
297          extra_ghc_opts = [],
298          extra_cc_opts  = [],
299          extra_ld_opts  = []
300         },
301
302          Package {
303          name         = "greencard",
304          import_dirs    = if installing
305                              then [ clibdir ++ "/imports/greencard" ]
306                              else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ],
307          library_dirs   = if installing
308                              then [ clibdir ]
309                              else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ],
310          hs_libraries      = [ "HSgreencard" ],
311          extra_libraries   = [],
312          include_dirs   = [],
313          c_includes     = [],
314          package_deps   = [],
315          extra_ghc_opts = [],
316          extra_cc_opts  = [],
317          extra_ld_opts  = [],
318         },
319
320          Package {
321          name         = "win32",
322          import_dirs    = if installing
323                              then [ clibdir ++ "/imports/win32" ]
324                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ],
325          library_dirs   = if installing
326                              then [ clibdir ]
327                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ],
328          hs_libraries      = [ "HSwin32" ],
329          extra_libraries   = [],
330          include_dirs   = [],
331          c_includes     = [],           -- ???
332          package_deps   = [ "lang", "greencard" ],
333          extra_ghc_opts = [],
334          extra_cc_opts  = [],
335          extra_ld_opts  = [ "-luser32",  "-lgdi32" ]
336         },
337
338          Package {
339          name           = "com",
340          import_dirs    = if installing
341                              then [ clibdir ++ "/imports/com" ]
342                              else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
343          library_dirs   = if installing
344                              then [ clibdir ]
345                              else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
346          hs_libraries      = [ "HScom" ],
347          extra_libraries   = [],
348          include_dirs   = [],
349          c_includes     = [],           -- ???
350          package_deps   = [ "lang" ],
351          extra_ghc_opts = [],
352          extra_cc_opts  = [],
353          extra_ld_opts  = [ "-luser32",  "-lole32",  "-loleaut32", "-ladvapi32" ]
354         }
355    ]
356
357 ghc_src_dir :: String -> String
358 ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path