76fd3531345ad24bfd889daf1e43ca39f3b0553c
[ghc.git] / rts / rts.cabal.in
1 cabal-version: 2.1
2 name: rts
3 version: 1.0
4 license: BSD-3-Clause
5 maintainer: glasgow-haskell-users@haskell.org
6 build-type: Simple
7 flag libm
8   default: @CabalHaveLibm@
9 flag librt
10   default: @CabalHaveLibrt@
11 flag libdl
12   default: @CabalHaveLibdl@
13 flag ffi
14   default: @CabalHaveLibffi@
15 flag need-pthread
16   default: @CabalNeedLibpthread@
17 flag libbfd
18   default: @CabalHaveLibbfd@
19 flag mingwex
20   default: @CabalMingwex@
21 flag libdw
22   default: @CabalHaveLibdw@
23 flag libnuma
24   default: @CabalHaveLibNuma@
25 flag 64bit
26   default: @Cabal64bit@
27 flag leading-underscore
28   default: @CabalLeadingUnderscore@
29 flag smp
30   default: True
31 -- Some cabal flags used to control the flavours we want to produce
32 -- for libHSrts in hadrian. By default, we just produce vanilla and
33 -- threaded. The flags "compose": if you enable debug and profiling,
34 -- you will produce vanilla, _thr, _debug, _p but also _thr_p,
35 -- _thr_debug_p and so on.
36 flag profiling
37   default: False
38 flag debug
39   default: False
40 flag logging
41   default: False
42
43 library
44     -- rts is a wired in package and
45     -- expects the unit-id to be
46     -- set without version
47     ghc-options: -this-unit-id rts
48     if os(windows)
49       extra-bundled-libraries: Cffi-6
50     else
51       extra-bundled-libraries: Cffi
52
53     -- The make build system does something special in config.mk.in
54     -- for generating profiled, debugged, etc builds of those
55     -- libraries, but we need to be transparent for hadrian which
56     -- gets information about the rts "package" through Cabal and
57     -- this cabal file. We therefore declare several
58     -- flavours to be available when passing the suitable (combination of)
59     -- flag(s) when configuring the RTS from hadrian, using Cabal.
60     extra-library-flavours: _thr
61
62     if flag(profiling)
63       extra-library-flavours: _p _thr_p
64       if flag(debug)
65         extra-library-flavours: _debug_p _thr_debug_p
66     if flag(debug)
67       extra-library-flavours: _debug _thr_debug
68     if flag(logging)
69       extra-library-flavours: _l _thr_l
70
71     exposed: True
72     exposed-modules:
73     if flag(libm)
74        -- for ldexp()
75        extra-libraries: m
76     if flag(librt)
77        extra-libraries: rt
78     if flag(libdl)
79        extra-libraries: dl
80     if flag(ffi)
81        extra-libraries: ffi
82     if os(windows)
83        extra-libraries:
84           -- for the linker
85           wsock32 gdi32 winmm
86           -- for crash dump
87           dbghelp
88           -- for process information
89           psapi
90     if flag(need-pthread)
91        -- for pthread_getthreadid_np, pthread_create, ...
92        extra-libraries: pthread
93     if flag(libbfd)
94        -- for debugging
95        extra-libraries: bfd iberty
96     if flag(mingwex)
97        extra-libraries: mingwex
98     if flag(libdw)
99        -- for backtraces
100        extra-libraries: elf dw
101     if flag(libnuma)
102        extra-libraries: numa
103     if !flag(smp)
104        cpp-options: -DNOSMP
105
106     include-dirs: build ../includes includes
107                   includes/dist-derivedconstants/header @FFIIncludeDir@
108     includes: Stg.h
109     install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
110                       ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
111                       -- ^ from ../includes
112                       DerivedConstants.h ffi.h ffitarget.h
113                       -- ^ generated
114                       rts/Adjustor.h
115                       rts/BlockSignals.h
116                       rts/Bytecodes.h
117                       rts/Config.h
118                       rts/Constants.h
119                       rts/EventLogFormat.h
120                       rts/EventLogWriter.h
121                       rts/FileLock.h
122                       rts/Flags.h
123                       rts/GetTime.h
124                       rts/Globals.h
125                       rts/Hpc.h
126                       rts/IOManager.h
127                       rts/Libdw.h
128                       rts/LibdwPool.h
129                       rts/Linker.h
130                       rts/Main.h
131                       rts/Messages.h
132                       rts/OSThreads.h
133                       rts/Parallel.h
134                       rts/PrimFloat.h
135                       rts/Profiling.h
136                       rts/Signals.h
137                       rts/SpinLock.h
138                       rts/StableName.h
139                       rts/StablePtr.h
140                       rts/StaticPtrTable.h
141                       rts/TTY.h
142                       rts/Threads.h
143                       rts/Ticky.h
144                       rts/Time.h
145                       rts/Timer.h
146                       rts/Types.h
147                       rts/Utils.h
148                       rts/prof/CCS.h
149                       rts/prof/LDV.h
150                       rts/storage/Block.h
151                       rts/storage/ClosureMacros.h
152                       rts/storage/ClosureTypes.h
153                       rts/storage/Closures.h
154                       rts/storage/FunTypes.h
155                       rts/storage/Heap.h
156                       rts/storage/GC.h
157                       rts/storage/InfoTables.h
158                       rts/storage/MBlock.h
159                       rts/storage/TSO.h
160                       stg/DLL.h
161                       stg/HaskellMachRegs.h
162                       stg/MachRegs.h
163                       stg/MiscClosures.h
164                       stg/Prim.h
165                       stg/Regs.h
166                       stg/RtsMachRegs.h
167                       stg/SMP.h
168                       stg/Ticky.h
169                       stg/Types.h
170     if flag(64bit)
171       if flag(leading-underscore)
172         ld-options:
173           "-Wl,-u,_hs_atomic_add64"
174           "-Wl,-u,_hs_atomic_sub64"
175           "-Wl,-u,_hs_atomic_and64"
176           "-Wl,-u,_hs_atomic_nand64"
177           "-Wl,-u,_hs_atomic_or64"
178           "-Wl,-u,_hs_atomic_xor64"
179           "-Wl,-u,_hs_cmpxchg64"
180           "-Wl,-u,_hs_atomicread64"
181           "-Wl,-u,_hs_atomicwrite64"
182       else
183         ld-options:
184           "-Wl,-u,hs_atomic_add64"
185           "-Wl,-u,hs_atomic_sub64"
186           "-Wl,-u,hs_atomic_and64"
187           "-Wl,-u,hs_atomic_nand64"
188           "-Wl,-u,hs_atomic_or64"
189           "-Wl,-u,hs_atomic_xor64"
190           "-Wl,-u,hs_cmpxchg64"
191           "-Wl,-u,hs_atomicread64"
192           "-Wl,-u,hs_atomicwrite64"
193     if flag(leading-underscore)
194       ld-options:
195          "-Wl,-u,_base_GHCziTopHandler_runIO_closure"
196          "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
197          "-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure"
198          "-Wl,-u,_ghczmprim_GHCziTypes_True_closure"
199          "-Wl,-u,_ghczmprim_GHCziTypes_False_closure"
200          "-Wl,-u,_base_GHCziPack_unpackCString_closure"
201          "-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure"
202          "-Wl,-u,_base_GHCziIOziException_stackOverflow_closure"
203          "-Wl,-u,_base_GHCziIOziException_heapOverflow_closure"
204          "-Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure"
205          "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
206          "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
207          "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure"
208          "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure"
209          "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure"
210          "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure"
211          "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure"
212          "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure"
213          "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure"
214          "-Wl,-u,_base_GHCziConcziSync_runSparks_closure"
215          "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
216          "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
217          "-Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure"
218          "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure"
219          "-Wl,-u,_base_GHCziTopHandler_runMainIO_closure"
220          "-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info"
221          "-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info"
222          "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info"
223          "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info"
224          "-Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info"
225          "-Wl,-u,_base_GHCziPtr_Ptr_con_info"
226          "-Wl,-u,_base_GHCziPtr_FunPtr_con_info"
227          "-Wl,-u,_base_GHCziInt_I8zh_con_info"
228          "-Wl,-u,_base_GHCziInt_I16zh_con_info"
229          "-Wl,-u,_base_GHCziInt_I32zh_con_info"
230          "-Wl,-u,_base_GHCziInt_I64zh_con_info"
231          "-Wl,-u,_base_GHCziWord_W8zh_con_info"
232          "-Wl,-u,_base_GHCziWord_W16zh_con_info"
233          "-Wl,-u,_base_GHCziWord_W32zh_con_info"
234          "-Wl,-u,_base_GHCziWord_W64zh_con_info"
235          "-Wl,-u,_base_GHCziStable_StablePtr_con_info"
236          "-Wl,-u,_hs_atomic_add8"
237          "-Wl,-u,_hs_atomic_add16"
238          "-Wl,-u,_hs_atomic_add32"
239          "-Wl,-u,_hs_atomic_sub8"
240          "-Wl,-u,_hs_atomic_sub16"
241          "-Wl,-u,_hs_atomic_sub32"
242          "-Wl,-u,_hs_atomic_and8"
243          "-Wl,-u,_hs_atomic_and16"
244          "-Wl,-u,_hs_atomic_and32"
245          "-Wl,-u,_hs_atomic_nand8"
246          "-Wl,-u,_hs_atomic_nand16"
247          "-Wl,-u,_hs_atomic_nand32"
248          "-Wl,-u,_hs_atomic_or8"
249          "-Wl,-u,_hs_atomic_or16"
250          "-Wl,-u,_hs_atomic_or32"
251          "-Wl,-u,_hs_atomic_xor8"
252          "-Wl,-u,_hs_atomic_xor16"
253          "-Wl,-u,_hs_atomic_xor32"
254          "-Wl,-u,_hs_cmpxchg8"
255          "-Wl,-u,_hs_cmpxchg16"
256          "-Wl,-u,_hs_cmpxchg32"
257          "-Wl,-u,_hs_atomicread8"
258          "-Wl,-u,_hs_atomicread16"
259          "-Wl,-u,_hs_atomicread32"
260          "-Wl,-u,_hs_atomicwrite8"
261          "-Wl,-u,_hs_atomicwrite16"
262          "-Wl,-u,_hs_atomicwrite32"
263          -- This symbol is useful in gdb, but not referred to anywhere,
264          -- so we need to force it to be included in the binary.
265          "-Wl,-u,_findPtr"
266     else
267       ld-options:
268          "-Wl,-u,base_GHCziTopHandler_runIO_closure"
269          "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
270          "-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure"
271          "-Wl,-u,ghczmprim_GHCziTypes_True_closure"
272          "-Wl,-u,ghczmprim_GHCziTypes_False_closure"
273          "-Wl,-u,base_GHCziPack_unpackCString_closure"
274          "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure"
275          "-Wl,-u,base_GHCziIOziException_stackOverflow_closure"
276          "-Wl,-u,base_GHCziIOziException_heapOverflow_closure"
277          "-Wl,-u,base_GHCziIOziException_allocationLimitExceeded_closure"
278          "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
279          "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
280          "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure"
281          "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure"
282          "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure"
283          "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure"
284          "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure"
285          "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure"
286          "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure"
287          "-Wl,-u,base_GHCziConcziSync_runSparks_closure"
288          "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
289          "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
290          "-Wl,-u,base_GHCziConcziSignal_runHandlersPtr_closure"
291          "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure"
292          "-Wl,-u,base_GHCziTopHandler_runMainIO_closure"
293          "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info"
294          "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info"
295          "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info"
296          "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info"
297          "-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info"
298          "-Wl,-u,base_GHCziPtr_Ptr_con_info"
299          "-Wl,-u,base_GHCziPtr_FunPtr_con_info"
300          "-Wl,-u,base_GHCziInt_I8zh_con_info"
301          "-Wl,-u,base_GHCziInt_I16zh_con_info"
302          "-Wl,-u,base_GHCziInt_I32zh_con_info"
303          "-Wl,-u,base_GHCziInt_I64zh_con_info"
304          "-Wl,-u,base_GHCziWord_W8zh_con_info"
305          "-Wl,-u,base_GHCziWord_W16zh_con_info"
306          "-Wl,-u,base_GHCziWord_W32zh_con_info"
307          "-Wl,-u,base_GHCziWord_W64zh_con_info"
308          "-Wl,-u,base_GHCziStable_StablePtr_con_info"
309          "-Wl,-u,hs_atomic_add8"
310          "-Wl,-u,hs_atomic_add16"
311          "-Wl,-u,hs_atomic_add32"
312          "-Wl,-u,hs_atomic_sub8"
313          "-Wl,-u,hs_atomic_sub16"
314          "-Wl,-u,hs_atomic_sub32"
315          "-Wl,-u,hs_atomic_and8"
316          "-Wl,-u,hs_atomic_and16"
317          "-Wl,-u,hs_atomic_and32"
318          "-Wl,-u,hs_atomic_nand8"
319          "-Wl,-u,hs_atomic_nand16"
320          "-Wl,-u,hs_atomic_nand32"
321          "-Wl,-u,hs_atomic_or8"
322          "-Wl,-u,hs_atomic_or16"
323          "-Wl,-u,hs_atomic_or32"
324          "-Wl,-u,hs_atomic_xor8"
325          "-Wl,-u,hs_atomic_xor16"
326          "-Wl,-u,hs_atomic_xor32"
327          "-Wl,-u,hs_cmpxchg8"
328          "-Wl,-u,hs_cmpxchg16"
329          "-Wl,-u,hs_cmpxchg32"
330          "-Wl,-u,hs_atomicread8"
331          "-Wl,-u,hs_atomicread16"
332          "-Wl,-u,hs_atomicread32"
333          "-Wl,-u,hs_atomicwrite8"
334          "-Wl,-u,hs_atomicwrite16"
335          "-Wl,-u,hs_atomicwrite32"
336          -- This symbol is useful in gdb, but not referred to anywhere,
337          -- so we need to force it to be included in the binary.
338          "-Wl,-u,findPtr"
339
340     if os(osx)
341       ld-options: "-Wl,-search_paths_first"
342       if !arch(x86_64)
343          ld-options: -read_only_relocs warning
344
345     cmm-sources: Apply.cmm
346                  Compact.cmm
347                  Exception.cmm
348                  HeapStackCheck.cmm
349                  PrimOps.cmm
350                  StgMiscClosures.cmm
351                  StgStartup.cmm
352                  StgStdThunks.cmm
353                  Updates.cmm
354                  -- AutoApply is generated
355                  AutoApply.cmm
356
357     if arch(i386) || arch(powerpc) || arch(powerpc64)
358        asm-sources: AdjustorAsm.S
359     if arch(powerpc) || arch(powerpc64) || arch(powerpc64le)
360        asm-sources: StgCRunAsm.S
361
362     c-sources: Adjustor.c
363                Arena.c
364                Capability.c
365                CheckUnload.c
366                ClosureFlags.c
367                Disassembler.c
368                FileLock.c
369                Globals.c
370                Hash.c
371                Heap.c
372                Hpc.c
373                HsFFI.c
374                Inlines.c
375                Interpreter.c
376                LdvProfile.c
377                Libdw.c
378                LibdwPool.c
379                Linker.c
380                Messages.c
381                OldARMAtomic.c
382                PathUtils.c
383                Pool.c
384                Printer.c
385                ProfHeap.c
386                ProfilerReport.c
387                ProfilerReportJson.c
388                Profiling.c
389                Proftimer.c
390                RaiseAsync.c
391                RetainerProfile.c
392                RetainerSet.c
393                RtsAPI.c
394                RtsDllMain.c
395                RtsFlags.c
396                RtsMain.c
397                RtsMessages.c
398                RtsStartup.c
399                RtsSymbolInfo.c
400                RtsSymbols.c
401                RtsUtils.c
402                STM.c
403                Schedule.c
404                Sparks.c
405                StableName.c
406                StablePtr.c
407                StaticPtrTable.c
408                Stats.c
409                StgCRun.c
410                StgPrimFloat.c
411                Task.c
412                ThreadLabels.c
413                ThreadPaused.c
414                Threads.c
415                Ticky.c
416                Timer.c
417                TopHandler.c
418                Trace.c
419                WSDeque.c
420                Weak.c
421                eventlog/EventLog.c
422                eventlog/EventLogWriter.c
423                hooks/FlagDefaults.c
424                hooks/LongGCSync.c
425                hooks/MallocFail.c
426                hooks/OnExit.c
427                hooks/OutOfHeap.c
428                hooks/StackOverflow.c
429                linker/CacheFlush.c
430                linker/Elf.c
431                linker/LoadArchive.c
432                linker/M32Alloc.c
433                linker/MachO.c
434                linker/PEi386.c
435                linker/SymbolExtras.c
436                linker/elf_got.c
437                linker/elf_plt.c
438                linker/elf_plt_aarch64.c
439                linker/elf_plt_arm.c
440                linker/elf_reloc.c
441                linker/elf_reloc_aarch64.c
442                linker/elf_util.c
443                sm/BlockAlloc.c
444                sm/CNF.c
445                sm/Compact.c
446                sm/Evac.c
447                sm/Evac_thr.c
448                sm/GC.c
449                sm/GCAux.c
450                sm/GCUtils.c
451                sm/MBlock.c
452                sm/MarkWeak.c
453                sm/Sanity.c
454                sm/Scav.c
455                sm/Scav_thr.c
456                sm/Storage.c
457                sm/Sweep.c
458                xxhash.c
459                fs.c
460                -- I wish we had wildcards..., this would be:
461                -- *.c hooks/**/*.c sm/**/*.c eventlog/**/*.c linker/**/*.c
462     if os(windows)
463        c-sources: win32/AsyncIO.c
464                   win32/AwaitEvent.c
465                   win32/ConsoleHandler.c
466                   win32/GetEnv.c
467                   win32/GetTime.c
468                   win32/IOManager.c
469                   win32/OSMem.c
470                   win32/OSThreads.c
471                   win32/ThrIOManager.c
472                   win32/Ticker.c
473                   win32/WorkQueue.c
474                   win32/veh_excn.c
475                   -- win32/**/*.c
476     else
477        c-sources: posix/GetEnv.c
478                   posix/GetTime.c
479                   posix/Itimer.c
480                   posix/OSMem.c
481                   posix/OSThreads.c
482                   posix/Select.c
483                   posix/Signals.c
484                   posix/TTY.c
485                   -- posix/*.c -- we do not want itimer