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 -- This splitting is the subject of a totally
137 -- horrible hack, which glues HSstd1 and HSstd2
138 -- back into HSstd for the purposes of static linking.
139 -- See DriverState.getPackageLibraries for details.
140 [ "HSstd1", "HSstd2" ]
143 extra_libraries = [ "HSstd_cbits" ] ++
144 # ifdef mingw32_TARGET_OS
145 [ "wsock32", "msvcrt" ]
147 [ "m" ] -- libm, that is
150 include_dirs = if installing
152 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
153 c_includes = [ "HsStd.h" ],
154 package_deps = [ "rts" ],
162 import_dirs = if installing
163 then [ "$libdir/imports/lang" ]
164 else [ "$libdir/hslibs/lang"
165 , "$libdir/hslibs/lang/monads" ],
167 library_dirs = if installing
169 else [ "$libdir/hslibs/lang"
170 , "$libdir/hslibs/lang/cbits" ],
171 hs_libraries = [ "HSlang" ],
172 extra_libraries = [ "HSlang_cbits" ],
173 include_dirs = if installing
175 else [ "$libdir/hslibs/lang/cbits" ],
176 c_includes = [ "HsLang.h" ],
181 #ifndef LEADING_UNDERSCORE
182 "-u Addr_Azh_static_info"
184 "-u _Addr_Azh_static_info"
191 import_dirs = if installing
192 then [ "$libdir/imports/concurrent" ]
193 else [ "$libdir/hslibs/concurrent" ],
195 library_dirs = if installing
197 else [ "$libdir/hslibs/concurrent" ],
198 hs_libraries = [ "HSconcurrent" ],
199 extra_libraries = [],
200 include_dirs = if installing
202 else [ "$libdir/hslibs/concurrent/cbits" ],
204 package_deps = [ "lang" ],
212 import_dirs = if installing
213 then [ "$libdir/imports/data" ]
214 else [ "$libdir/hslibs/data"
215 , "$libdir/hslibs/data/edison"
216 , "$libdir/hslibs/data/edison/Assoc"
217 , "$libdir/hslibs/data/edison/Coll"
218 , "$libdir/hslibs/data/edison/Seq" ],
220 library_dirs = if installing
222 else [ "$libdir/hslibs/data" ],
223 hs_libraries = [ "HSdata" ],
224 extra_libraries = [],
225 include_dirs = if installing
227 else [ "$libdir/hslibs/data/cbits" ],
229 package_deps = [ "lang", "util" ],
237 import_dirs = if installing
238 then [ "$libdir/imports/net" ]
239 else [ "$libdir/hslibs/net" ],
241 library_dirs = if installing
243 else [ "$libdir/hslibs/net"
244 , "$libdir/hslibs/net/cbits" ],
245 hs_libraries = [ "HSnet" ],
246 extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM
247 then [ "nsl", "socket" ]
250 include_dirs = if installing
252 else [ "$libdir/hslibs/net/cbits" ],
253 c_includes = [ "HsNet.h" ],
254 package_deps = [ "lang", "text", "concurrent" ],
262 import_dirs = if installing
263 then [ "$libdir/imports/posix" ]
264 else [ "$libdir/hslibs/posix" ],
266 library_dirs = if installing
268 else [ "$libdir/hslibs/posix"
269 , "$libdir/hslibs/posix/cbits" ],
270 hs_libraries = [ "HSposix" ],
271 extra_libraries = [ "HSposix_cbits" ],
272 include_dirs = if installing
274 else [ "$libdir/hslibs/posix/cbits" ],
275 c_includes = [ "HsPosix.h" ],
276 package_deps = [ "lang" ],
284 import_dirs = if installing
285 then [ "$libdir/imports/text" ]
286 else [ "$libdir/hslibs/text"
287 , "$libdir/hslibs/text/html"
288 , "$libdir/hslibs/text/HaXml/lib"
289 , "$libdir/hslibs/text/parsec" ],
291 library_dirs = if installing
293 else [ "$libdir/hslibs/text"
294 , "$libdir/hslibs/text/cbits" ],
295 hs_libraries = [ "HStext" ],
296 extra_libraries = [ "HStext_cbits" ],
297 include_dirs = if installing
299 else [ "$libdir/hslibs/text/cbits" ],
300 c_includes = [ "HsText.h" ],
301 package_deps = [ "lang" ],
309 import_dirs = if installing
310 then [ "$libdir/imports/util" ]
311 else [ "$libdir/hslibs/util"
312 , "$libdir/hslibs/util/check" ],
314 library_dirs = if installing
316 else [ "$libdir/hslibs/util"
317 , "$libdir/hslibs/util/cbits" ],
318 hs_libraries = [ "HSutil" ],
319 extra_libraries = [ "HSutil_cbits" ]
320 #ifndef mingw32_TARGET_OS
321 ++ words cLibsReadline
324 include_dirs = if installing
326 else [ "$libdir/hslibs/util/cbits" ],
327 c_includes = [ "HsUtil.h" ],
328 package_deps = [ "lang", "concurrent"
329 #ifndef mingw32_TARGET_OS
338 -- no cbits at the moment, we'll need to add one if this library
339 -- ever calls out to any C libs.
342 import_dirs = if installing
343 then [ "$libdir/imports/hssource" ]
344 else [ "$libdir/hslibs/hssource" ],
346 library_dirs = if installing
348 else [ "$libdir/hslibs/hssource" ],
349 hs_libraries = [ "HShssource" ],
350 extra_libraries = [],
353 package_deps = [ "text" ],
361 import_dirs = if installing
362 then [ "$libdir/imports/greencard" ]
363 else [ "$libdir/green-card/lib/ghc" ],
365 library_dirs = if installing
367 else [ "$libdir/green-card/lib/ghc" ],
368 hs_libraries = [ "HSgreencard" ],
369 extra_libraries = [],
372 package_deps = [ "lang" ],
378 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
381 import_dirs = if installing
382 then [ "$libdir/imports/win32" ]
383 else [ "$libdir/hslibs/win32" ],
385 library_dirs = if installing
387 else [ "$libdir/hslibs/win32" ],
388 hs_libraries = [ "HSwin32" ],
389 extra_libraries = [ "user32", "gdi32", "winmm" ],
391 c_includes = [], -- ???
392 package_deps = [ "lang", "greencard" ],
400 import_dirs = if installing
401 then [ "$libdir/imports/com" ]
402 else [ "$libdir/hdirect/lib" ],
404 library_dirs = if installing
406 else [ "$libdir/hdirect/lib" ],
407 hs_libraries = [ "HScom" ],
408 extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ],
410 c_includes = [], -- ???
411 package_deps = [ "lang" ],
420 import_dirs = if installing
421 then [ "$libdir/imports/xlib" ]
422 else [ "$libdir/hslibs/xlib" ],
424 library_dirs = if installing
426 else [ "$libdir/hslibs/xlib"
427 , "$libdir/hslibs/xlib/cbits" ],
428 hs_libraries = [ "HSxlib" ],
429 extra_libraries = [ "HSxlib_cbits", "X11" ],
430 include_dirs = if installing
432 else [ "$libdir/hslibs/xlib/cbits" ],
433 c_includes = [ "HsXlib.h" ],
434 package_deps = [ "greencard" ],
442 import_dirs = if installing
443 then [ "$libdir/imports/HGL" ]
444 else [ "$libdir/hslibs/graphics/lib/x11" ],
447 hs_libraries = [ "HSHGL" ],
451 package_deps = [ "xlib", "concurrent" ],
459 ghc_src_dir :: String -> String
460 ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path