1 #include "../includes/config.h"
2 #include "../includes/Derived.h"
4 module Main (main) where
16 ("install":rest) -> do { putStrLn (dumpPackages (package_details True rest)) }
17 ("in-place":rest) -> do { putStrLn (dumpPackages (package_details False rest)) }
18 _ -> do hPutStr stderr "usage: pkgconf (install | in-place) ...\n"
19 exitWith (ExitFailure 1)
21 -- The compiler automatically replaces the string "$libdir" at the
22 -- beginning of a path with the directory passed to the compiler via
23 -- the -B<dir> flag. Absolute path names will be unchanged.
25 -- This is how we make package.conf independent of GHC's installation
28 package_details :: Bool -> [String] -> [PackageConfig]
29 package_details installing
42 name = "gmp", -- GMP is at the bottom of the heap
45 library_dirs = if cHaveLibGmp == "YES"
49 else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ],
51 extra_libraries = [ "gmp" ],
61 name = "rts", -- The RTS is just another package!
64 library_dirs = if installing
66 else [ ghc_src_dir cGHC_RUNTIME_DIR ],
67 hs_libraries = [ "HSrts" ],
70 #ifdef mingw32_TARGET_OS
71 "winmm": -- for the threadDelay timer
72 "wsock32": -- for the linker
75 "bfd": "iberty": -- for debugging
78 include_dirs = if installing
79 then [ "$libdir/include"
80 #ifdef mingw32_TARGET_OS
81 , "$libdir/include/mingw"
84 else [ ghc_src_dir cGHC_INCLUDE_DIR ],
85 c_includes = [ "Stg.h" ], -- ha!
86 package_deps = [ "gmp" ],
89 -- the RTS forward-references to a bunch of stuff in the prelude,
90 -- so we force it to be included with special options to ld.
92 foldr (\ x xs -> "-u" : x : xs) []
94 #ifndef LEADING_UNDERSCORE
100 "PrelBase_Izh_static_info"
101 , "PrelBase_Czh_static_info"
102 , "PrelFloat_Fzh_static_info"
103 , "PrelFloat_Dzh_static_info"
104 , "PrelPtr_Ptr_static_info"
105 , "PrelWord_Wzh_static_info"
106 , "PrelInt_I8zh_static_info"
107 , "PrelInt_I16zh_static_info"
108 , "PrelInt_I32zh_static_info"
109 , "PrelInt_I64zh_static_info"
110 , "PrelWord_W8zh_static_info"
111 , "PrelWord_W16zh_static_info"
112 , "PrelWord_W32zh_static_info"
113 , "PrelWord_W64zh_static_info"
114 , "PrelStable_StablePtr_static_info"
115 , "PrelBase_Izh_con_info"
116 , "PrelBase_Czh_con_info"
117 , "PrelFloat_Fzh_con_info"
118 , "PrelFloat_Dzh_con_info"
119 , "PrelPtr_Ptr_con_info"
120 , "PrelStable_StablePtr_con_info"
121 , "PrelBase_False_closure"
122 , "PrelBase_True_closure"
123 , "PrelPack_unpackCString_closure"
124 , "PrelIOBase_stackOverflow_closure"
125 , "PrelIOBase_heapOverflow_closure"
126 , "PrelIOBase_NonTermination_closure"
127 , "PrelIOBase_BlockedOnDeadMVar_closure"
128 , "PrelWeak_runFinalizzerBatch_closure"
129 , "__stginit_Prelude"
134 name = "std", -- The Prelude & Standard Hs_libraries
135 import_dirs = if installing
136 then [ "$libdir/imports/std" ]
137 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
139 library_dirs = if installing
141 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
142 , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
145 # ifndef mingw32_TARGET_OS
148 -- This splitting is the subject of a totally
149 -- horrible hack, which glues HSstd1 and HSstd2
150 -- back into HSstd for the purposes of static linking.
151 -- See DriverState.getPackageLibraries for details.
152 [ "HSstd1", "HSstd2" ]
155 extra_libraries = [ "HSstd_cbits" ] ++
156 # ifdef mingw32_TARGET_OS
157 [ "wsock32", "msvcrt" ]
162 include_dirs = if installing
164 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
165 c_includes = [ "HsStd.h" ],
166 package_deps = [ "rts" ],
174 import_dirs = if installing
175 then [ "$libdir/imports/lang" ]
176 else [ "$libdir/hslibs/lang"
177 , "$libdir/hslibs/lang/monads" ],
179 library_dirs = if installing
181 else [ "$libdir/hslibs/lang"
182 , "$libdir/hslibs/lang/cbits" ],
183 hs_libraries = [ "HSlang" ],
184 extra_libraries = [ "HSlang_cbits" ],
185 include_dirs = if installing
187 else [ "$libdir/hslibs/lang/cbits" ],
188 c_includes = [ "HsLang.h" ],
193 #ifndef LEADING_UNDERSCORE
194 "-u", "Addr_Azh_static_info"
196 "-u", "_Addr_Azh_static_info"
203 import_dirs = if installing
204 then [ "$libdir/imports/concurrent" ]
205 else [ "$libdir/hslibs/concurrent" ],
207 library_dirs = if installing
209 else [ "$libdir/hslibs/concurrent" ],
210 hs_libraries = [ "HSconcurrent" ],
211 extra_libraries = [],
212 include_dirs = if installing
214 else [ "$libdir/hslibs/concurrent/cbits" ],
216 package_deps = [ "lang" ],
224 import_dirs = if installing
225 then [ "$libdir/imports/data" ]
226 else [ "$libdir/hslibs/data"
227 , "$libdir/hslibs/data/edison"
228 , "$libdir/hslibs/data/edison/Assoc"
229 , "$libdir/hslibs/data/edison/Coll"
230 , "$libdir/hslibs/data/edison/Seq" ],
232 library_dirs = if installing
234 else [ "$libdir/hslibs/data" ],
235 hs_libraries = [ "HSdata" ],
236 extra_libraries = [],
237 include_dirs = if installing
239 else [ "$libdir/hslibs/data/cbits" ],
241 package_deps = [ "lang", "util" ],
249 import_dirs = if installing
250 then [ "$libdir/imports/net" ]
251 else [ "$libdir/hslibs/net" ],
253 library_dirs = if installing
255 else [ "$libdir/hslibs/net"
256 , "$libdir/hslibs/net/cbits" ],
257 hs_libraries = [ "HSnet" ],
258 extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM
259 then [ "nsl", "socket" ]
262 include_dirs = if installing
264 else [ "$libdir/hslibs/net/cbits" ],
265 c_includes = [ "HsNet.h" ],
266 package_deps = [ "lang", "text", "concurrent" ],
274 import_dirs = if installing
275 then [ "$libdir/imports/posix" ]
276 else [ "$libdir/hslibs/posix" ],
278 library_dirs = if installing
280 else [ "$libdir/hslibs/posix"
281 , "$libdir/hslibs/posix/cbits" ],
282 hs_libraries = [ "HSposix" ],
283 extra_libraries = [ "HSposix_cbits" ],
284 include_dirs = if installing
286 else [ "$libdir/hslibs/posix/cbits" ],
287 c_includes = [ "HsPosix.h" ],
288 package_deps = [ "lang" ],
296 import_dirs = if installing
297 then [ "$libdir/imports/text" ]
298 else [ "$libdir/hslibs/text"
299 , "$libdir/hslibs/text/html"
300 , "$libdir/hslibs/text/HaXml/lib"
301 , "$libdir/hslibs/text/parsec" ],
303 library_dirs = if installing
305 else [ "$libdir/hslibs/text"
306 , "$libdir/hslibs/text/cbits" ],
307 hs_libraries = [ "HStext" ],
308 extra_libraries = [ "HStext_cbits" ],
309 include_dirs = if installing
311 else [ "$libdir/hslibs/text/cbits" ],
312 c_includes = [ "HsText.h" ],
313 package_deps = [ "lang" ],
321 import_dirs = if installing
322 then [ "$libdir/imports/util" ]
323 else [ "$libdir/hslibs/util"
324 , "$libdir/hslibs/util/check" ],
326 library_dirs = if installing
328 else [ "$libdir/hslibs/util"
329 , "$libdir/hslibs/util/cbits" ],
330 hs_libraries = [ "HSutil" ],
331 extra_libraries = [ "HSutil_cbits" ]
332 #ifndef mingw32_TARGET_OS
333 ++ words cLibsReadline
336 include_dirs = if installing
338 else [ "$libdir/hslibs/util/cbits" ],
339 c_includes = [ "HsUtil.h" ],
340 package_deps = [ "lang", "concurrent"
341 #ifndef mingw32_TARGET_OS
350 -- no cbits at the moment, we'll need to add one if this library
351 -- ever calls out to any C libs.
354 import_dirs = if installing
355 then [ "$libdir/imports/hssource" ]
356 else [ "$libdir/hslibs/hssource" ],
358 library_dirs = if installing
360 else [ "$libdir/hslibs/hssource" ],
361 hs_libraries = [ "HShssource" ],
362 extra_libraries = [],
365 package_deps = [ "text" ],
373 import_dirs = if installing
374 then [ "$libdir/imports/greencard" ]
375 else [ "$libdir/green-card/lib/ghc" ],
377 library_dirs = if installing
379 else [ "$libdir/green-card/lib/ghc" ],
380 hs_libraries = [ "HSgreencard" ],
381 extra_libraries = [],
384 package_deps = [ "lang" ],
390 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
393 import_dirs = if installing
394 then [ "$libdir/imports/win32" ]
395 else [ "$libdir/hslibs/win32" ],
397 library_dirs = if installing
399 else [ "$libdir/hslibs/win32" ],
400 hs_libraries = [ "HSwin321", "HSwin322" ],
401 extra_libraries = [ "user32", "gdi32", "winmm",
402 "kernel32", "advapi32" ],
404 c_includes = [], -- ???
405 package_deps = [ "lang" ], -- greencard now built in
413 import_dirs = if installing
414 then [ "$libdir/imports/com" ]
415 else [ "$libdir/hdirect/lib" ],
417 library_dirs = if installing
419 else [ "$libdir/hdirect/lib" ],
420 hs_libraries = [ "HScom" ],
421 extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ],
423 c_includes = [], -- ???
424 package_deps = [ "lang" ],
433 import_dirs = if installing
434 then [ "$libdir/imports/xlib" ]
435 else [ "$libdir/hslibs/xlib" ],
437 library_dirs = if installing
439 else [ "$libdir/hslibs/xlib"
440 , "$libdir/hslibs/xlib/cbits" ],
441 hs_libraries = [ "HSxlib" ],
442 extra_libraries = [ "HSxlib_cbits", "X11" ],
443 include_dirs = if installing
445 else [ "$libdir/hslibs/xlib/cbits" ],
446 c_includes = [ "HsXlib.h" ],
447 package_deps = [ "greencard" ],
455 import_dirs = if installing
456 then [ "$libdir/imports/HGL" ]
457 else [ "$libdir/hslibs/graphics/lib/x11" ],
460 hs_libraries = [ "HSHGL" ],
464 package_deps = [ "xlib", "concurrent" ],
472 ghc_src_dir :: String -> String
473 ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path