1 module Main (main) where
12 [ "install" ] -> do { putStr (dumpPackages (package_details True)) }
13 [ "in-place" ] -> do { putStr (dumpPackages (package_details False)) }
14 _ -> do hPutStr stderr "usage: pkgconf (install | in-place)\n"
15 exitWith (ExitFailure 1)
17 package_details :: Bool -> [(String,Package)]
18 package_details installing =
20 ( "gmp", -- GMP is at the bottom of the heap
23 library_dirs = if cHaveLibGmp == "YES"
27 else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ],
29 extra_libraries = [ "gmp" ],
39 ( "rts", -- The RTS is just another package!
42 library_dirs = if installing
44 else [ ghc_src_dir cGHC_RUNTIME_DIR ],
45 hs_libraries = [ "HSrts" ],
47 include_dirs = if installing
48 then [ clibdir ++ "/includes" ]
49 else [ ghc_src_dir cGHC_INCLUDE_DIR ],
50 c_includes = [ "Stg.h" ], -- ha!
51 package_deps = [ "gmp" ],
54 -- the RTS forward-references to a bunch of stuff in the prelude,
55 -- so we force it to be included with special options to ld.
57 "-u PrelMain_mainIO_closure"
58 , "-u PrelBase_Izh_static_info"
59 , "-u PrelBase_Czh_static_info"
60 , "-u PrelFloat_Fzh_static_info"
61 , "-u PrelFloat_Dzh_static_info"
62 , "-u PrelAddr_Azh_static_info"
63 , "-u PrelAddr_Wzh_static_info"
64 , "-u PrelAddr_I64zh_static_info"
65 , "-u PrelAddr_W64zh_static_info"
66 , "-u PrelStable_StablePtr_static_info"
67 , "-u PrelBase_Izh_con_info"
68 , "-u PrelBase_Czh_con_info"
69 , "-u PrelFloat_Fzh_con_info"
70 , "-u PrelFloat_Dzh_con_info"
71 , "-u PrelAddr_Azh_con_info"
72 , "-u PrelAddr_Wzh_con_info"
73 , "-u PrelAddr_I64zh_con_info"
74 , "-u PrelAddr_W64zh_con_info"
75 , "-u PrelStable_StablePtr_con_info"
76 , "-u PrelBase_False_closure"
77 , "-u PrelBase_True_closure"
78 , "-u PrelPack_unpackCString_closure"
79 , "-u PrelIOBase_stackOverflow_closure"
80 , "-u PrelIOBase_heapOverflow_closure"
81 , "-u PrelIOBase_NonTermination_closure"
82 , "-u PrelIOBase_PutFullMVar_closure"
83 , "-u PrelIOBase_BlockedOnDeadMVar_closure"
84 , "-u PrelWeak_runFinalizzerBatch_closure"
86 , "-u __init_PrelMain"
91 ( "std", -- The Prelude & Standard Hs_libraries
93 import_dirs = if installing
94 then [ clibdir ++ "/imports/std" ]
95 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ],
96 library_dirs = if installing
98 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std"
99 , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
100 hs_libraries = [ "HSstd" ],
101 extra_libraries = [ "HSstd_cbits" ],
102 include_dirs = if installing
104 else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ],
105 c_includes = [ "HsStd.h" ],
106 package_deps = [ "rts" ],
109 extra_ld_opts = [ "-lm" ]
115 import_dirs = if installing
116 then [ clibdir ++ "/imports/lang" ]
117 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
118 , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/monads" ],
119 library_dirs = if installing
121 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang"
122 , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
123 hs_libraries = [ "HSlang" ],
124 extra_libraries = [ "HSlang_cbits" ],
125 include_dirs = if installing
127 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ],
128 c_includes = [ "HsLang.h" ],
138 import_dirs = if installing
139 then [ clibdir ++ "/imports/concurrent" ]
140 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
141 library_dirs = if installing
143 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ],
144 hs_libraries = [ "HSconcurrent" ],
145 extra_libraries = [],
146 include_dirs = if installing
148 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ],
149 c_includes = [ "HsConcurrent.h" ],
150 package_deps = [ "lang" ],
159 import_dirs = if installing
160 then [ clibdir ++ "/imports/data" ]
161 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data"
162 , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison"
163 , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Assoc"
164 , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Coll"
165 , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Seq" ],
166 library_dirs = if installing
168 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ],
169 hs_libraries = [ "HSdata" ],
170 extra_libraries = [],
171 include_dirs = if installing
173 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ],
174 c_includes = [ "HsData.h" ],
175 package_deps = [ "lang" ],
184 import_dirs = if installing
185 then [ clibdir ++ "/imports/net" ]
186 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" ],
187 library_dirs = if installing
189 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net"
190 , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
191 hs_libraries = [ "HSnet" ],
192 extra_libraries = [ "HSnet_cbits" ],
193 include_dirs = if installing
195 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
196 c_includes = [ "HsNet.h" ],
197 package_deps = [ "lang", "text" ],
200 extra_ld_opts = if postfixMatch "solaris2" cTARGETPLATFORM
201 then [ "-lnsl", "-lsocket" ]
208 import_dirs = if installing
209 then [ clibdir ++ "/imports/posix" ]
210 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" ],
211 library_dirs = if installing
213 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix"
214 , cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
215 hs_libraries = [ "HSposix" ],
216 extra_libraries = [ "HSposix_cbits" ],
217 include_dirs = if installing
219 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ],
220 c_includes = [ "HsPosix.h" ],
221 package_deps = [ "lang" ],
230 import_dirs = if installing
231 then [ clibdir ++ "/imports/text" ]
232 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text"
233 , cFPTOOLS_TOP_ABS ++ "/hslibs/text/html"
234 , cFPTOOLS_TOP_ABS ++ "/hslibs/text/haxml/lib"
235 , cFPTOOLS_TOP_ABS ++ "/hslibs/text/parsec" ],
236 library_dirs = if installing
238 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text"
239 , cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
240 hs_libraries = [ "HStext" ],
241 extra_libraries = [ "HStext_cbits" ],
242 include_dirs = if installing
244 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ],
245 c_includes = [ "HsText.h" ],
246 package_deps = [ "lang", "data" ],
255 import_dirs = if installing
256 then [ clibdir ++ "/imports/util" ]
257 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
258 , cFPTOOLS_TOP_ABS ++ "/hslibs/util/check" ],
259 library_dirs = if installing
261 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
262 , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
263 hs_libraries = [ "HSutil" ],
264 extra_libraries = [ "HSutil_cbits" ],
265 include_dirs = if installing
267 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
268 c_includes = [ "HsUtil.h" ],
269 package_deps = [ "lang", "concurrent", "posix" ],
276 -- no cbits at the moment, we'll need to add one if this library
277 -- ever calls out to any C libs.
280 import_dirs = if installing
281 then [ clibdir ++ "/imports/hssource" ]
282 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
283 library_dirs = if installing
285 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ],
286 hs_libraries = [ "HShssource" ],
287 extra_libraries = [],
290 package_deps = [ "text" ],
299 import_dirs = if installing
300 then [ clibdir ++ "/imports/win32" ]
301 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ],
302 library_dirs = if installing
304 else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ],
305 hs_libraries = [ "HSwin32" ],
306 extra_libraries = [],
308 c_includes = [], -- ???
309 package_deps = [ "lang" ],
312 extra_ld_opts = [ "-luser32", "-lgdi32" ]
318 import_dirs = if installing
319 then [ clibdir ++ "/imports/com" ]
320 else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
321 library_dirs = if installing
323 else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ],
324 hs_libraries = [ "HScom" ],
325 extra_libraries = [],
327 c_includes = [], -- ???
328 package_deps = [ "lang" ],
331 extra_ld_opts = [ "-luser32", "-lole32", "-loleaut32", "-ladvapi32" ]
336 ghc_src_dir :: String -> String
337 ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path
339 prefixMatch :: Eq a => [a] -> [a] -> Bool
340 prefixMatch [] _str = True
341 prefixMatch _pat [] = False
342 prefixMatch (p:ps) (s:ss) | p == s = prefixMatch ps ss
345 postfixMatch :: String -> String -> Bool
346 postfixMatch pat str = prefixMatch (reverse pat) (reverse str)