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