1 #include "../includes/config.h"
3 module Main (main) where
15 ("install":rest) -> do { putStrLn (dumpPackages (package_details True rest)) }
16 ("in-place":rest) -> do { putStrLn (dumpPackages (package_details False rest)) }
17 _ -> do hPutStr stderr "usage: pkgconf (install | in-place) ...\n"
18 exitWith (ExitFailure 1)
20 -- The compiler automatically replaces the string "$libdir" at the
21 -- beginning of a path with the directory passed to the compiler via
22 -- the -B<dir> flag. Absolute path names will be unchanged.
24 -- This is how we make package.conf independent of GHC's installation
27 package_details :: Bool -> [String] -> [PackageConfig]
28 package_details installing
41 name = "gmp", -- GMP is at the bottom of the heap
44 library_dirs = if cHaveLibGmp == "YES"
48 else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ],
50 extra_libraries = [ "gmp" ],
60 name = "rts", -- The RTS is just another package!
63 library_dirs = if installing
65 else [ ghc_src_dir cGHC_RUNTIME_DIR ],
66 hs_libraries = [ "HSrts" ],
67 #ifndef mingw32_TARGET_OS
70 extra_libraries = [ "winmm", "wsock32" ], -- winmm for the threadDelay timer, wsock32 for the linker
72 include_dirs = if installing
73 then [ "$libdir/includes" ]
74 else [ ghc_src_dir cGHC_INCLUDE_DIR ],
75 c_includes = [ "Stg.h" ], -- ha!
76 package_deps = [ "gmp" ],
79 -- the RTS forward-references to a bunch of stuff in the prelude,
80 -- so we force it to be included with special options to ld.
82 #ifndef LEADING_UNDERSCORE
88 "PrelBase_Izh_static_info"
89 , "PrelBase_Czh_static_info"
90 , "PrelFloat_Fzh_static_info"
91 , "PrelFloat_Dzh_static_info"
92 , "PrelPtr_Ptr_static_info"
93 , "PrelWord_Wzh_static_info"
94 , "PrelInt_I8zh_static_info"
95 , "PrelInt_I16zh_static_info"
96 , "PrelInt_I32zh_static_info"
97 , "PrelInt_I64zh_static_info"
98 , "PrelWord_W8zh_static_info"
99 , "PrelWord_W16zh_static_info"
100 , "PrelWord_W32zh_static_info"
101 , "PrelWord_W64zh_static_info"
102 , "PrelStable_StablePtr_static_info"
103 , "PrelBase_Izh_con_info"
104 , "PrelBase_Czh_con_info"
105 , "PrelFloat_Fzh_con_info"
106 , "PrelFloat_Dzh_con_info"
107 , "PrelPtr_Ptr_con_info"
108 , "PrelStable_StablePtr_con_info"
109 , "PrelBase_False_closure"
110 , "PrelBase_True_closure"
111 , "PrelPack_unpackCString_closure"
112 , "PrelIOBase_stackOverflow_closure"
113 , "PrelIOBase_heapOverflow_closure"
114 , "PrelIOBase_NonTermination_closure"
115 , "PrelIOBase_BlockedOnDeadMVar_closure"
116 , "PrelWeak_runFinalizzerBatch_closure"
122 name = "std", -- The Prelude & Standard Hs_libraries
123 import_dirs = if installing
124 then [ "$libdir/imports/std" ]
125 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
127 library_dirs = if installing
129 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
130 , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
133 # ifndef mingw32_TARGET_OS
136 [ "HSstd1", "HSstd2" ]
139 extra_libraries = [ "HSstd_cbits" ] ++
140 # ifdef mingw32_TARGET_OS
141 ["wsock32", "msvcrt"]
143 ["m"] -- libm, that is
146 include_dirs = if installing
148 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
149 c_includes = [ "HsStd.h" ],
150 package_deps = [ "rts" ],
158 import_dirs = if installing
159 then [ "$libdir/imports/lang" ]
160 else [ "$libdir/hslibs/lang"
161 , "$libdir/hslibs/lang/monads" ],
163 library_dirs = if installing
165 else [ "$libdir/hslibs/lang"
166 , "$libdir/hslibs/lang/cbits" ],
167 hs_libraries = [ "HSlang" ],
168 extra_libraries = [ "HSlang_cbits" ],
169 include_dirs = if installing
171 else [ "$libdir/hslibs/lang/cbits" ],
172 c_includes = [ "HsLang.h" ],
177 #ifndef LEADING_UNDERSCORE
178 "-u Addr_Azh_static_info"
180 "-u _Addr_Azh_static_info"
187 import_dirs = if installing
188 then [ "$libdir/imports/concurrent" ]
189 else [ "$libdir/hslibs/concurrent" ],
191 library_dirs = if installing
193 else [ "$libdir/hslibs/concurrent" ],
194 hs_libraries = [ "HSconcurrent" ],
195 extra_libraries = [],
196 include_dirs = if installing
198 else [ "$libdir/hslibs/concurrent/cbits" ],
200 package_deps = [ "lang" ],
208 import_dirs = if installing
209 then [ "$libdir/imports/data" ]
210 else [ "$libdir/hslibs/data"
211 , "$libdir/hslibs/data/edison"
212 , "$libdir/hslibs/data/edison/Assoc"
213 , "$libdir/hslibs/data/edison/Coll"
214 , "$libdir/hslibs/data/edison/Seq" ],
216 library_dirs = if installing
218 else [ "$libdir/hslibs/data" ],
219 hs_libraries = [ "HSdata" ],
220 extra_libraries = [],
221 include_dirs = if installing
223 else [ "$libdir/hslibs/data/cbits" ],
225 package_deps = [ "lang", "util" ],
233 import_dirs = if installing
234 then [ "$libdir/imports/net" ]
235 else [ "$libdir/hslibs/net" ],
237 library_dirs = if installing
239 else [ "$libdir/hslibs/net"
240 , "$libdir/hslibs/net/cbits" ],
241 hs_libraries = [ "HSnet" ],
242 extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM
243 then [ "nsl", "socket" ]
246 include_dirs = if installing
248 else [ "$libdir/hslibs/net/cbits" ],
249 c_includes = [ "HsNet.h" ],
250 package_deps = [ "lang", "text", "concurrent" ],
258 import_dirs = if installing
259 then [ "$libdir/imports/posix" ]
260 else [ "$libdir/hslibs/posix" ],
262 library_dirs = if installing
264 else [ "$libdir/hslibs/posix"
265 , "$libdir/hslibs/posix/cbits" ],
266 hs_libraries = [ "HSposix" ],
267 extra_libraries = [ "HSposix_cbits" ],
268 include_dirs = if installing
270 else [ "$libdir/hslibs/posix/cbits" ],
271 c_includes = [ "HsPosix.h" ],
272 package_deps = [ "lang" ],
280 import_dirs = if installing
281 then [ "$libdir/imports/text" ]
282 else [ "$libdir/hslibs/text"
283 , "$libdir/hslibs/text/html"
284 , "$libdir/hslibs/text/HaXml/lib"
285 , "$libdir/hslibs/text/parsec" ],
287 library_dirs = if installing
289 else [ "$libdir/hslibs/text"
290 , "$libdir/hslibs/text/cbits" ],
291 hs_libraries = [ "HStext" ],
292 extra_libraries = [ "HStext_cbits" ],
293 include_dirs = if installing
295 else [ "$libdir/hslibs/text/cbits" ],
296 c_includes = [ "HsText.h" ],
297 package_deps = [ "lang" ],
305 import_dirs = if installing
306 then [ "$libdir/imports/util" ]
307 else [ "$libdir/hslibs/util"
308 , "$libdir/hslibs/util/check" ],
310 library_dirs = if installing
312 else [ "$libdir/hslibs/util"
313 , "$libdir/hslibs/util/cbits" ],
314 hs_libraries = [ "HSutil" ],
315 extra_libraries = [ "HSutil_cbits" ] ++ words cLibsReadline,
316 include_dirs = if installing
318 else [ "$libdir/hslibs/util/cbits" ],
319 c_includes = [ "HsUtil.h" ],
320 package_deps = [ "lang", "concurrent"
321 #ifndef mingw32_TARGET_OS
330 -- no cbits at the moment, we'll need to add one if this library
331 -- ever calls out to any C libs.
334 import_dirs = if installing
335 then [ "$libdir/imports/hssource" ]
336 else [ "$libdir/hslibs/hssource" ],
338 library_dirs = if installing
340 else [ "$libdir/hslibs/hssource" ],
341 hs_libraries = [ "HShssource" ],
342 extra_libraries = [],
345 package_deps = [ "text" ],
353 import_dirs = if installing
354 then [ "$libdir/imports/greencard" ]
355 else [ "$libdir/green-card/lib/ghc" ],
357 library_dirs = if installing
359 else [ "$libdir/green-card/lib/ghc" ],
360 hs_libraries = [ "HSgreencard" ],
361 extra_libraries = [],
364 package_deps = [ "lang" ],
370 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
373 import_dirs = if installing
374 then [ "$libdir/imports/win32" ]
375 else [ "$libdir/hslibs/win32" ],
377 library_dirs = if installing
379 else [ "$libdir/hslibs/win32" ],
380 hs_libraries = [ "HSwin32" ],
381 extra_libraries = [ "user32", "gdi32", "winmm" ],
383 c_includes = [], -- ???
384 package_deps = [ "lang", "greencard" ],
392 import_dirs = if installing
393 then [ "$libdir/imports/com" ]
394 else [ "$libdir/hdirect/lib" ],
396 library_dirs = if installing
398 else [ "$libdir/hdirect/lib" ],
399 hs_libraries = [ "HScom" ],
400 extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ],
402 c_includes = [], -- ???
403 package_deps = [ "lang" ],
412 import_dirs = if installing
413 then [ "$libdir/imports/xlib" ]
414 else [ "$libdir/hslibs/xlib" ],
416 library_dirs = if installing
418 else [ "$libdir/hslibs/xlib"
419 , "$libdir/hslibs/xlib/cbits" ],
420 hs_libraries = [ "HSxlib" ],
421 extra_libraries = [ "HSxlib_cbits", "X11" ],
422 include_dirs = if installing
424 else [ "$libdir/hslibs/xlib/cbits" ],
425 c_includes = [ "HsXlib.h" ],
426 package_deps = [ "greencard" ],
434 ghc_src_dir :: String -> String
435 ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path