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/include"
74 #ifdef mingw32_TARGET_OS
75 , "$libdir/include/mingw"
78 else [ ghc_src_dir cGHC_INCLUDE_DIR ],
79 c_includes = [ "Stg.h" ], -- ha!
80 package_deps = [ "gmp" ],
83 -- the RTS forward-references to a bunch of stuff in the prelude,
84 -- so we force it to be included with special options to ld.
86 foldr (\ x xs -> "-u" : x : xs) []
88 #ifndef LEADING_UNDERSCORE
94 "PrelBase_Izh_static_info"
95 , "PrelBase_Czh_static_info"
96 , "PrelFloat_Fzh_static_info"
97 , "PrelFloat_Dzh_static_info"
98 , "PrelPtr_Ptr_static_info"
99 , "PrelWord_Wzh_static_info"
100 , "PrelInt_I8zh_static_info"
101 , "PrelInt_I16zh_static_info"
102 , "PrelInt_I32zh_static_info"
103 , "PrelInt_I64zh_static_info"
104 , "PrelWord_W8zh_static_info"
105 , "PrelWord_W16zh_static_info"
106 , "PrelWord_W32zh_static_info"
107 , "PrelWord_W64zh_static_info"
108 , "PrelStable_StablePtr_static_info"
109 , "PrelBase_Izh_con_info"
110 , "PrelBase_Czh_con_info"
111 , "PrelFloat_Fzh_con_info"
112 , "PrelFloat_Dzh_con_info"
113 , "PrelPtr_Ptr_con_info"
114 , "PrelStable_StablePtr_con_info"
115 , "PrelBase_False_closure"
116 , "PrelBase_True_closure"
117 , "PrelPack_unpackCString_closure"
118 , "PrelIOBase_stackOverflow_closure"
119 , "PrelIOBase_heapOverflow_closure"
120 , "PrelIOBase_NonTermination_closure"
121 , "PrelIOBase_BlockedOnDeadMVar_closure"
122 , "PrelWeak_runFinalizzerBatch_closure"
128 name = "std", -- The Prelude & Standard Hs_libraries
129 import_dirs = if installing
130 then [ "$libdir/imports/std" ]
131 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
133 library_dirs = if installing
135 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
136 , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
139 # ifndef mingw32_TARGET_OS
142 -- This splitting is the subject of a totally
143 -- horrible hack, which glues HSstd1 and HSstd2
144 -- back into HSstd for the purposes of static linking.
145 -- See DriverState.getPackageLibraries for details.
146 [ "HSstd1", "HSstd2" ]
149 extra_libraries = [ "HSstd_cbits" ] ++
150 # ifdef mingw32_TARGET_OS
151 [ "wsock32", "msvcrt" ]
153 [ "m" ] -- libm, that is
156 include_dirs = if installing
158 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
159 c_includes = [ "HsStd.h" ],
160 package_deps = [ "rts" ],
168 import_dirs = if installing
169 then [ "$libdir/imports/lang" ]
170 else [ "$libdir/hslibs/lang"
171 , "$libdir/hslibs/lang/monads" ],
173 library_dirs = if installing
175 else [ "$libdir/hslibs/lang"
176 , "$libdir/hslibs/lang/cbits" ],
177 hs_libraries = [ "HSlang" ],
178 extra_libraries = [ "HSlang_cbits" ],
179 include_dirs = if installing
181 else [ "$libdir/hslibs/lang/cbits" ],
182 c_includes = [ "HsLang.h" ],
187 #ifndef LEADING_UNDERSCORE
188 "-u", "Addr_Azh_static_info"
190 "-u", "_Addr_Azh_static_info"
197 import_dirs = if installing
198 then [ "$libdir/imports/concurrent" ]
199 else [ "$libdir/hslibs/concurrent" ],
201 library_dirs = if installing
203 else [ "$libdir/hslibs/concurrent" ],
204 hs_libraries = [ "HSconcurrent" ],
205 extra_libraries = [],
206 include_dirs = if installing
208 else [ "$libdir/hslibs/concurrent/cbits" ],
210 package_deps = [ "lang" ],
218 import_dirs = if installing
219 then [ "$libdir/imports/data" ]
220 else [ "$libdir/hslibs/data"
221 , "$libdir/hslibs/data/edison"
222 , "$libdir/hslibs/data/edison/Assoc"
223 , "$libdir/hslibs/data/edison/Coll"
224 , "$libdir/hslibs/data/edison/Seq" ],
226 library_dirs = if installing
228 else [ "$libdir/hslibs/data" ],
229 hs_libraries = [ "HSdata" ],
230 extra_libraries = [],
231 include_dirs = if installing
233 else [ "$libdir/hslibs/data/cbits" ],
235 package_deps = [ "lang", "util" ],
243 import_dirs = if installing
244 then [ "$libdir/imports/net" ]
245 else [ "$libdir/hslibs/net" ],
247 library_dirs = if installing
249 else [ "$libdir/hslibs/net"
250 , "$libdir/hslibs/net/cbits" ],
251 hs_libraries = [ "HSnet" ],
252 extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM
253 then [ "nsl", "socket" ]
256 include_dirs = if installing
258 else [ "$libdir/hslibs/net/cbits" ],
259 c_includes = [ "HsNet.h" ],
260 package_deps = [ "lang", "text", "concurrent" ],
268 import_dirs = if installing
269 then [ "$libdir/imports/posix" ]
270 else [ "$libdir/hslibs/posix" ],
272 library_dirs = if installing
274 else [ "$libdir/hslibs/posix"
275 , "$libdir/hslibs/posix/cbits" ],
276 hs_libraries = [ "HSposix" ],
277 extra_libraries = [ "HSposix_cbits" ],
278 include_dirs = if installing
280 else [ "$libdir/hslibs/posix/cbits" ],
281 c_includes = [ "HsPosix.h" ],
282 package_deps = [ "lang" ],
290 import_dirs = if installing
291 then [ "$libdir/imports/text" ]
292 else [ "$libdir/hslibs/text"
293 , "$libdir/hslibs/text/html"
294 , "$libdir/hslibs/text/HaXml/lib"
295 , "$libdir/hslibs/text/parsec" ],
297 library_dirs = if installing
299 else [ "$libdir/hslibs/text"
300 , "$libdir/hslibs/text/cbits" ],
301 hs_libraries = [ "HStext" ],
302 extra_libraries = [ "HStext_cbits" ],
303 include_dirs = if installing
305 else [ "$libdir/hslibs/text/cbits" ],
306 c_includes = [ "HsText.h" ],
307 package_deps = [ "lang" ],
315 import_dirs = if installing
316 then [ "$libdir/imports/util" ]
317 else [ "$libdir/hslibs/util"
318 , "$libdir/hslibs/util/check" ],
320 library_dirs = if installing
322 else [ "$libdir/hslibs/util"
323 , "$libdir/hslibs/util/cbits" ],
324 hs_libraries = [ "HSutil" ],
325 extra_libraries = [ "HSutil_cbits" ]
326 #ifndef mingw32_TARGET_OS
327 ++ words cLibsReadline
330 include_dirs = if installing
332 else [ "$libdir/hslibs/util/cbits" ],
333 c_includes = [ "HsUtil.h" ],
334 package_deps = [ "lang", "concurrent"
335 #ifndef mingw32_TARGET_OS
344 -- no cbits at the moment, we'll need to add one if this library
345 -- ever calls out to any C libs.
348 import_dirs = if installing
349 then [ "$libdir/imports/hssource" ]
350 else [ "$libdir/hslibs/hssource" ],
352 library_dirs = if installing
354 else [ "$libdir/hslibs/hssource" ],
355 hs_libraries = [ "HShssource" ],
356 extra_libraries = [],
359 package_deps = [ "text" ],
367 import_dirs = if installing
368 then [ "$libdir/imports/greencard" ]
369 else [ "$libdir/green-card/lib/ghc" ],
371 library_dirs = if installing
373 else [ "$libdir/green-card/lib/ghc" ],
374 hs_libraries = [ "HSgreencard" ],
375 extra_libraries = [],
378 package_deps = [ "lang" ],
384 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
387 import_dirs = if installing
388 then [ "$libdir/imports/win32" ]
389 else [ "$libdir/hslibs/win32" ],
391 library_dirs = if installing
393 else [ "$libdir/hslibs/win32" ],
394 hs_libraries = [ "HSwin32" ],
395 extra_libraries = [ "user32", "gdi32", "winmm" ],
397 c_includes = [], -- ???
398 package_deps = [ "lang", "greencard" ],
406 import_dirs = if installing
407 then [ "$libdir/imports/com" ]
408 else [ "$libdir/hdirect/lib" ],
410 library_dirs = if installing
412 else [ "$libdir/hdirect/lib" ],
413 hs_libraries = [ "HScom" ],
414 extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ],
416 c_includes = [], -- ???
417 package_deps = [ "lang" ],
426 import_dirs = if installing
427 then [ "$libdir/imports/xlib" ]
428 else [ "$libdir/hslibs/xlib" ],
430 library_dirs = if installing
432 else [ "$libdir/hslibs/xlib"
433 , "$libdir/hslibs/xlib/cbits" ],
434 hs_libraries = [ "HSxlib" ],
435 extra_libraries = [ "HSxlib_cbits", "X11" ],
436 include_dirs = if installing
438 else [ "$libdir/hslibs/xlib/cbits" ],
439 c_includes = [ "HsXlib.h" ],
440 package_deps = [ "greencard" ],
448 import_dirs = if installing
449 then [ "$libdir/imports/HGL" ]
450 else [ "$libdir/hslibs/graphics/lib/x11" ],
453 hs_libraries = [ "HSHGL" ],
457 package_deps = [ "xlib", "concurrent" ],
465 ghc_src_dir :: String -> String
466 ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path