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 #ifndef LEADING_UNDERSCORE
92 "PrelBase_Izh_static_info"
93 , "PrelBase_Czh_static_info"
94 , "PrelFloat_Fzh_static_info"
95 , "PrelFloat_Dzh_static_info"
96 , "PrelPtr_Ptr_static_info"
97 , "PrelWord_Wzh_static_info"
98 , "PrelInt_I8zh_static_info"
99 , "PrelInt_I16zh_static_info"
100 , "PrelInt_I32zh_static_info"
101 , "PrelInt_I64zh_static_info"
102 , "PrelWord_W8zh_static_info"
103 , "PrelWord_W16zh_static_info"
104 , "PrelWord_W32zh_static_info"
105 , "PrelWord_W64zh_static_info"
106 , "PrelStable_StablePtr_static_info"
107 , "PrelBase_Izh_con_info"
108 , "PrelBase_Czh_con_info"
109 , "PrelFloat_Fzh_con_info"
110 , "PrelFloat_Dzh_con_info"
111 , "PrelPtr_Ptr_con_info"
112 , "PrelStable_StablePtr_con_info"
113 , "PrelBase_False_closure"
114 , "PrelBase_True_closure"
115 , "PrelPack_unpackCString_closure"
116 , "PrelIOBase_stackOverflow_closure"
117 , "PrelIOBase_heapOverflow_closure"
118 , "PrelIOBase_NonTermination_closure"
119 , "PrelIOBase_BlockedOnDeadMVar_closure"
120 , "PrelWeak_runFinalizzerBatch_closure"
126 name = "std", -- The Prelude & Standard Hs_libraries
127 import_dirs = if installing
128 then [ "$libdir/imports/std" ]
129 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
131 library_dirs = if installing
133 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
134 , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
137 # ifndef mingw32_TARGET_OS
140 -- This splitting is the subject of a totally
141 -- horrible hack, which glues HSstd1 and HSstd2
142 -- back into HSstd for the purposes of static linking.
143 -- See DriverState.getPackageLibraries for details.
144 [ "HSstd1", "HSstd2" ]
147 extra_libraries = [ "HSstd_cbits" ] ++
148 # ifdef mingw32_TARGET_OS
149 [ "wsock32", "msvcrt" ]
151 [ "m" ] -- libm, that is
154 include_dirs = if installing
156 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
157 c_includes = [ "HsStd.h" ],
158 package_deps = [ "rts" ],
166 import_dirs = if installing
167 then [ "$libdir/imports/lang" ]
168 else [ "$libdir/hslibs/lang"
169 , "$libdir/hslibs/lang/monads" ],
171 library_dirs = if installing
173 else [ "$libdir/hslibs/lang"
174 , "$libdir/hslibs/lang/cbits" ],
175 hs_libraries = [ "HSlang" ],
176 extra_libraries = [ "HSlang_cbits" ],
177 include_dirs = if installing
179 else [ "$libdir/hslibs/lang/cbits" ],
180 c_includes = [ "HsLang.h" ],
185 #ifndef LEADING_UNDERSCORE
186 "-u Addr_Azh_static_info"
188 "-u _Addr_Azh_static_info"
195 import_dirs = if installing
196 then [ "$libdir/imports/concurrent" ]
197 else [ "$libdir/hslibs/concurrent" ],
199 library_dirs = if installing
201 else [ "$libdir/hslibs/concurrent" ],
202 hs_libraries = [ "HSconcurrent" ],
203 extra_libraries = [],
204 include_dirs = if installing
206 else [ "$libdir/hslibs/concurrent/cbits" ],
208 package_deps = [ "lang" ],
216 import_dirs = if installing
217 then [ "$libdir/imports/data" ]
218 else [ "$libdir/hslibs/data"
219 , "$libdir/hslibs/data/edison"
220 , "$libdir/hslibs/data/edison/Assoc"
221 , "$libdir/hslibs/data/edison/Coll"
222 , "$libdir/hslibs/data/edison/Seq" ],
224 library_dirs = if installing
226 else [ "$libdir/hslibs/data" ],
227 hs_libraries = [ "HSdata" ],
228 extra_libraries = [],
229 include_dirs = if installing
231 else [ "$libdir/hslibs/data/cbits" ],
233 package_deps = [ "lang", "util" ],
241 import_dirs = if installing
242 then [ "$libdir/imports/net" ]
243 else [ "$libdir/hslibs/net" ],
245 library_dirs = if installing
247 else [ "$libdir/hslibs/net"
248 , "$libdir/hslibs/net/cbits" ],
249 hs_libraries = [ "HSnet" ],
250 extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM
251 then [ "nsl", "socket" ]
254 include_dirs = if installing
256 else [ "$libdir/hslibs/net/cbits" ],
257 c_includes = [ "HsNet.h" ],
258 package_deps = [ "lang", "text", "concurrent" ],
266 import_dirs = if installing
267 then [ "$libdir/imports/posix" ]
268 else [ "$libdir/hslibs/posix" ],
270 library_dirs = if installing
272 else [ "$libdir/hslibs/posix"
273 , "$libdir/hslibs/posix/cbits" ],
274 hs_libraries = [ "HSposix" ],
275 extra_libraries = [ "HSposix_cbits" ],
276 include_dirs = if installing
278 else [ "$libdir/hslibs/posix/cbits" ],
279 c_includes = [ "HsPosix.h" ],
280 package_deps = [ "lang" ],
288 import_dirs = if installing
289 then [ "$libdir/imports/text" ]
290 else [ "$libdir/hslibs/text"
291 , "$libdir/hslibs/text/html"
292 , "$libdir/hslibs/text/HaXml/lib"
293 , "$libdir/hslibs/text/parsec" ],
295 library_dirs = if installing
297 else [ "$libdir/hslibs/text"
298 , "$libdir/hslibs/text/cbits" ],
299 hs_libraries = [ "HStext" ],
300 extra_libraries = [ "HStext_cbits" ],
301 include_dirs = if installing
303 else [ "$libdir/hslibs/text/cbits" ],
304 c_includes = [ "HsText.h" ],
305 package_deps = [ "lang" ],
313 import_dirs = if installing
314 then [ "$libdir/imports/util" ]
315 else [ "$libdir/hslibs/util"
316 , "$libdir/hslibs/util/check" ],
318 library_dirs = if installing
320 else [ "$libdir/hslibs/util"
321 , "$libdir/hslibs/util/cbits" ],
322 hs_libraries = [ "HSutil" ],
323 extra_libraries = [ "HSutil_cbits" ]
324 #ifndef mingw32_TARGET_OS
325 ++ words cLibsReadline
328 include_dirs = if installing
330 else [ "$libdir/hslibs/util/cbits" ],
331 c_includes = [ "HsUtil.h" ],
332 package_deps = [ "lang", "concurrent"
333 #ifndef mingw32_TARGET_OS
342 -- no cbits at the moment, we'll need to add one if this library
343 -- ever calls out to any C libs.
346 import_dirs = if installing
347 then [ "$libdir/imports/hssource" ]
348 else [ "$libdir/hslibs/hssource" ],
350 library_dirs = if installing
352 else [ "$libdir/hslibs/hssource" ],
353 hs_libraries = [ "HShssource" ],
354 extra_libraries = [],
357 package_deps = [ "text" ],
365 import_dirs = if installing
366 then [ "$libdir/imports/greencard" ]
367 else [ "$libdir/green-card/lib/ghc" ],
369 library_dirs = if installing
371 else [ "$libdir/green-card/lib/ghc" ],
372 hs_libraries = [ "HSgreencard" ],
373 extra_libraries = [],
376 package_deps = [ "lang" ],
382 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
385 import_dirs = if installing
386 then [ "$libdir/imports/win32" ]
387 else [ "$libdir/hslibs/win32" ],
389 library_dirs = if installing
391 else [ "$libdir/hslibs/win32" ],
392 hs_libraries = [ "HSwin32" ],
393 extra_libraries = [ "user32", "gdi32", "winmm" ],
395 c_includes = [], -- ???
396 package_deps = [ "lang", "greencard" ],
404 import_dirs = if installing
405 then [ "$libdir/imports/com" ]
406 else [ "$libdir/hdirect/lib" ],
408 library_dirs = if installing
410 else [ "$libdir/hdirect/lib" ],
411 hs_libraries = [ "HScom" ],
412 extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ],
414 c_includes = [], -- ???
415 package_deps = [ "lang" ],
424 import_dirs = if installing
425 then [ "$libdir/imports/xlib" ]
426 else [ "$libdir/hslibs/xlib" ],
428 library_dirs = if installing
430 else [ "$libdir/hslibs/xlib"
431 , "$libdir/hslibs/xlib/cbits" ],
432 hs_libraries = [ "HSxlib" ],
433 extra_libraries = [ "HSxlib_cbits", "X11" ],
434 include_dirs = if installing
436 else [ "$libdir/hslibs/xlib/cbits" ],
437 c_includes = [ "HsXlib.h" ],
438 package_deps = [ "greencard" ],
446 import_dirs = if installing
447 then [ "$libdir/imports/HGL" ]
448 else [ "$libdir/hslibs/graphics/lib/x11" ],
451 hs_libraries = [ "HSHGL" ],
455 package_deps = [ "xlib", "concurrent" ],
463 ghc_src_dir :: String -> String
464 ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path