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" ], -- for the threadDelay timer
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" ],
131 hs_libraries = [ "HSstd" ],
132 extra_libraries = [ "HSstd_cbits" ] ++
133 # ifdef mingw32_TARGET_OS
134 ["wsock32", "msvcrt"]
136 ["m"] -- libm, that is
139 include_dirs = if installing
141 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
142 c_includes = [ "HsStd.h" ],
143 package_deps = [ "rts" ],
151 import_dirs = if installing
152 then [ "$libdir/imports/lang" ]
153 else [ "$libdir/hslibs/lang"
154 , "$libdir/hslibs/lang/monads" ],
156 library_dirs = if installing
158 else [ "$libdir/hslibs/lang"
159 , "$libdir/hslibs/lang/cbits" ],
160 hs_libraries = [ "HSlang" ],
161 extra_libraries = [ "HSlang_cbits" ],
162 include_dirs = if installing
164 else [ "$libdir/hslibs/lang/cbits" ],
165 c_includes = [ "HsLang.h" ],
170 #ifndef LEADING_UNDERSCORE
171 "-u Addr_Azh_static_info"
173 "-u _Addr_Azh_static_info"
180 import_dirs = if installing
181 then [ "$libdir/imports/concurrent" ]
182 else [ "$libdir/hslibs/concurrent" ],
184 library_dirs = if installing
186 else [ "$libdir/hslibs/concurrent" ],
187 hs_libraries = [ "HSconcurrent" ],
188 extra_libraries = [],
189 include_dirs = if installing
191 else [ "$libdir/hslibs/concurrent/cbits" ],
193 package_deps = [ "lang" ],
201 import_dirs = if installing
202 then [ "$libdir/imports/data" ]
203 else [ "$libdir/hslibs/data"
204 , "$libdir/hslibs/data/edison"
205 , "$libdir/hslibs/data/edison/Assoc"
206 , "$libdir/hslibs/data/edison/Coll"
207 , "$libdir/hslibs/data/edison/Seq" ],
209 library_dirs = if installing
211 else [ "$libdir/hslibs/data" ],
212 hs_libraries = [ "HSdata" ],
213 extra_libraries = [],
214 include_dirs = if installing
216 else [ "$libdir/hslibs/data/cbits" ],
218 package_deps = [ "lang", "util" ],
226 import_dirs = if installing
227 then [ "$libdir/imports/net" ]
228 else [ "$libdir/hslibs/net" ],
230 library_dirs = if installing
232 else [ "$libdir/hslibs/net"
233 , "$libdir/hslibs/net/cbits" ],
234 hs_libraries = [ "HSnet" ],
235 extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM
236 then [ "nsl", "socket" ]
239 include_dirs = if installing
241 else [ "$libdir/hslibs/net/cbits" ],
242 c_includes = [ "HsNet.h" ],
243 package_deps = [ "lang", "text", "concurrent" ],
251 import_dirs = if installing
252 then [ "$libdir/imports/posix" ]
253 else [ "$libdir/hslibs/posix" ],
255 library_dirs = if installing
257 else [ "$libdir/hslibs/posix"
258 , "$libdir/hslibs/posix/cbits" ],
259 hs_libraries = [ "HSposix" ],
260 extra_libraries = [ "HSposix_cbits" ],
261 include_dirs = if installing
263 else [ "$libdir/hslibs/posix/cbits" ],
264 c_includes = [ "HsPosix.h" ],
265 package_deps = [ "lang" ],
273 import_dirs = if installing
274 then [ "$libdir/imports/text" ]
275 else [ "$libdir/hslibs/text"
276 , "$libdir/hslibs/text/html"
277 , "$libdir/hslibs/text/HaXml/lib"
278 , "$libdir/hslibs/text/parsec" ],
280 library_dirs = if installing
282 else [ "$libdir/hslibs/text"
283 , "$libdir/hslibs/text/cbits" ],
284 hs_libraries = [ "HStext" ],
285 extra_libraries = [ "HStext_cbits" ],
286 include_dirs = if installing
288 else [ "$libdir/hslibs/text/cbits" ],
289 c_includes = [ "HsText.h" ],
290 package_deps = [ "lang" ],
298 import_dirs = if installing
299 then [ "$libdir/imports/util" ]
300 else [ "$libdir/hslibs/util"
301 , "$libdir/hslibs/util/check" ],
303 library_dirs = if installing
305 else [ "$libdir/hslibs/util"
306 , "$libdir/hslibs/util/cbits" ],
307 hs_libraries = [ "HSutil" ],
308 extra_libraries = [ "HSutil_cbits" ] ++ words cLibsReadline,
309 include_dirs = if installing
311 else [ "$libdir/hslibs/util/cbits" ],
312 c_includes = [ "HsUtil.h" ],
313 package_deps = [ "lang", "concurrent"
314 #ifndef mingw32_TARGET_OS
323 -- no cbits at the moment, we'll need to add one if this library
324 -- ever calls out to any C libs.
327 import_dirs = if installing
328 then [ "$libdir/imports/hssource" ]
329 else [ "$libdir/hslibs/hssource" ],
331 library_dirs = if installing
333 else [ "$libdir/hslibs/hssource" ],
334 hs_libraries = [ "HShssource" ],
335 extra_libraries = [],
338 package_deps = [ "text" ],
346 import_dirs = if installing
347 then [ "$libdir/imports/greencard" ]
348 else [ "$libdir/green-card/lib/ghc" ],
350 library_dirs = if installing
352 else [ "$libdir/green-card/lib/ghc" ],
353 hs_libraries = [ "HSgreencard" ],
354 extra_libraries = [],
357 package_deps = [ "lang" ],
363 #if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
366 import_dirs = if installing
367 then [ "$libdir/imports/win32" ]
368 else [ "$libdir/hslibs/win32" ],
370 library_dirs = if installing
372 else [ "$libdir/hslibs/win32" ],
373 hs_libraries = [ "HSwin32" ],
374 extra_libraries = [ "user32", "gdi32", "winmm" ],
376 c_includes = [], -- ???
377 package_deps = [ "lang", "greencard" ],
385 import_dirs = if installing
386 then [ "$libdir/imports/com" ]
387 else [ "$libdir/hdirect/lib" ],
389 library_dirs = if installing
391 else [ "$libdir/hdirect/lib" ],
392 hs_libraries = [ "HScom" ],
393 extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ],
395 c_includes = [], -- ???
396 package_deps = [ "lang" ],
404 ghc_src_dir :: String -> String
405 ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path