summaryrefslogtreecommitdiff
path: root/rts/rts.cabal.in
blob: 99f1e7296df28223077a8ea2c459da7c7d972ade (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
cabal-version: 3.0
name: rts
version: 1.0
license: BSD-3-Clause
maintainer: glasgow-haskell-users@haskell.org
build-type: Simple
flag libm
  default: @CabalHaveLibm@
flag librt
  default: @CabalHaveLibrt@
flag libdl
  default: @CabalHaveLibdl@
flag ffi
  default: @CabalHaveLibffi@
flag need-pthread
  default: @CabalNeedLibpthread@
flag libbfd
  default: @CabalHaveLibbfd@
flag mingwex
  default: @CabalMingwex@
flag libdw
  default: @CabalHaveLibdw@
flag libnuma
  default: @CabalHaveLibNuma@
flag 64bit
  default: @Cabal64bit@
flag leading-underscore
  default: @CabalLeadingUnderscore@
flag smp
  default: True
flag find-ptr
  default: False
-- Some cabal flags used to control the flavours we want to produce
-- for libHSrts in hadrian. By default, we just produce vanilla and
-- threaded. The flags "compose": if you enable debug and profiling,
-- you will produce vanilla, _thr, _debug, _p but also _thr_p,
-- _thr_debug_p and so on.
flag profiling
  default: False
flag debug
  default: False
flag logging
  default: False
flag dynamic
  default: False

library
    -- rts is a wired in package and
    -- expects the unit-id to be
    -- set without version
    ghc-options: -this-unit-id rts
    if os(windows)
      extra-bundled-libraries: Cffi-6
    else
      extra-bundled-libraries: Cffi

    -- The make build system does something special in config.mk.in
    -- for generating profiled, debugged, etc builds of those
    -- libraries, but we need to be transparent for hadrian which
    -- gets information about the rts "package" through Cabal and
    -- this cabal file. We therefore declare several
    -- flavours to be available when passing the suitable (combination of)
    -- flag(s) when configuring the RTS from hadrian, using Cabal.
    extra-library-flavours: _thr

    if flag(profiling)
      extra-library-flavours: _p _thr_p
      if flag(debug)
        extra-library-flavours: _debug_p _thr_debug_p
    if flag(debug)
      extra-library-flavours: _debug _thr_debug
      if flag(dynamic)
        extra-dynamic-library-flavours: _debug _thr_debug
    if flag(logging)
      extra-library-flavours: _l _thr_l
      if flag(dynamic)
        extra-dynamic-library-flavours: _l _thr_l
    if flag(dynamic)
      extra-dynamic-library-flavours: _thr

    exposed: True
    exposed-modules:
    if flag(libm)
       -- for ldexp()
       extra-libraries: m
    if flag(librt)
       extra-libraries: rt
    if flag(libdl)
       extra-libraries: dl
    if flag(ffi)
       extra-libraries: ffi
    if os(windows)
       extra-libraries:
          -- for the linker
          wsock32 gdi32 winmm
          -- for crash dump
          dbghelp
          -- for process information
          psapi
    if flag(need-pthread)
       -- for pthread_getthreadid_np, pthread_create, ...
       extra-libraries: pthread
    if flag(libbfd)
       -- for debugging
       extra-libraries: bfd iberty
    if flag(mingwex)
       extra-libraries: mingwex
    if flag(libdw)
       -- for backtraces
       extra-libraries: elf dw
    if flag(libnuma)
       extra-libraries: numa
    if !flag(smp)
       cpp-options: -DNOSMP

    include-dirs: build ../includes includes
                  includes/dist-derivedconstants/header @FFIIncludeDir@
    includes: Stg.h
    install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
                      ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
                      -- ^ from ../includes
                      DerivedConstants.h ffi.h ffitarget.h
                      -- ^ generated
                      rts/Adjustor.h
                      rts/BlockSignals.h
                      rts/Bytecodes.h
                      rts/Config.h
                      rts/Constants.h
                      rts/EventLogFormat.h
                      rts/EventLogWriter.h
                      rts/FileLock.h
                      rts/Flags.h
                      rts/GetTime.h
                      rts/Globals.h
                      rts/Hpc.h
                      rts/IOManager.h
                      rts/Libdw.h
                      rts/LibdwPool.h
                      rts/Linker.h
                      rts/Main.h
                      rts/Messages.h
                      rts/OSThreads.h
                      rts/Parallel.h
                      rts/PrimFloat.h
                      rts/Profiling.h
                      rts/Signals.h
                      rts/SpinLock.h
                      rts/StableName.h
                      rts/StablePtr.h
                      rts/StaticPtrTable.h
                      rts/TTY.h
                      rts/Threads.h
                      rts/Ticky.h
                      rts/Time.h
                      rts/Timer.h
                      rts/Types.h
                      rts/Utils.h
                      rts/prof/CCS.h
                      rts/prof/LDV.h
                      rts/storage/Block.h
                      rts/storage/ClosureMacros.h
                      rts/storage/ClosureTypes.h
                      rts/storage/Closures.h
                      rts/storage/FunTypes.h
                      rts/storage/Heap.h
                      rts/storage/GC.h
                      rts/storage/InfoTables.h
                      rts/storage/MBlock.h
                      rts/storage/TSO.h
                      stg/DLL.h
                      stg/MachRegs.h
                      stg/MachRegsForHost.h
                      stg/MiscClosures.h
                      stg/Prim.h
                      stg/Regs.h
                      stg/SMP.h
                      stg/Ticky.h
                      stg/Types.h
    if flag(64bit)
      if flag(leading-underscore)
        ld-options:
          "-Wl,-u,_hs_atomic_add64"
          "-Wl,-u,_hs_atomic_sub64"
          "-Wl,-u,_hs_atomic_and64"
          "-Wl,-u,_hs_atomic_nand64"
          "-Wl,-u,_hs_atomic_or64"
          "-Wl,-u,_hs_atomic_xor64"
          "-Wl,-u,_hs_cmpxchg64"
          "-Wl,-u,_hs_atomicread64"
          "-Wl,-u,_hs_atomicwrite64"
      else
        ld-options:
          "-Wl,-u,hs_atomic_add64"
          "-Wl,-u,hs_atomic_sub64"
          "-Wl,-u,hs_atomic_and64"
          "-Wl,-u,hs_atomic_nand64"
          "-Wl,-u,hs_atomic_or64"
          "-Wl,-u,hs_atomic_xor64"
          "-Wl,-u,hs_cmpxchg64"
          "-Wl,-u,hs_atomicread64"
          "-Wl,-u,hs_atomicwrite64"
    if flag(leading-underscore)
      ld-options:
         "-Wl,-u,_base_GHCziTopHandler_runIO_closure"
         "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
         "-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure"
         "-Wl,-u,_ghczmprim_GHCziTypes_True_closure"
         "-Wl,-u,_ghczmprim_GHCziTypes_False_closure"
         "-Wl,-u,_base_GHCziPack_unpackCString_closure"
         "-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure"
         "-Wl,-u,_base_GHCziIOziException_stackOverflow_closure"
         "-Wl,-u,_base_GHCziIOziException_heapOverflow_closure"
         "-Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure"
         "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
         "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
         "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure"
         "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure"
         "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure"
         "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure"
         "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure"
         "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure"
         "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure"
         "-Wl,-u,_base_GHCziConcziSync_runSparks_closure"
         "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
         "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
         "-Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure"
         "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure"
         "-Wl,-u,_base_GHCziTopHandler_runMainIO_closure"
         "-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info"
         "-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info"
         "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info"
         "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info"
         "-Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info"
         "-Wl,-u,_base_GHCziPtr_Ptr_con_info"
         "-Wl,-u,_base_GHCziPtr_FunPtr_con_info"
         "-Wl,-u,_base_GHCziInt_I8zh_con_info"
         "-Wl,-u,_base_GHCziInt_I16zh_con_info"
         "-Wl,-u,_base_GHCziInt_I32zh_con_info"
         "-Wl,-u,_base_GHCziInt_I64zh_con_info"
         "-Wl,-u,_base_GHCziWord_W8zh_con_info"
         "-Wl,-u,_base_GHCziWord_W16zh_con_info"
         "-Wl,-u,_base_GHCziWord_W32zh_con_info"
         "-Wl,-u,_base_GHCziWord_W64zh_con_info"
         "-Wl,-u,_base_GHCziStable_StablePtr_con_info"
         "-Wl,-u,_hs_atomic_add8"
         "-Wl,-u,_hs_atomic_add16"
         "-Wl,-u,_hs_atomic_add32"
         "-Wl,-u,_hs_atomic_sub8"
         "-Wl,-u,_hs_atomic_sub16"
         "-Wl,-u,_hs_atomic_sub32"
         "-Wl,-u,_hs_atomic_and8"
         "-Wl,-u,_hs_atomic_and16"
         "-Wl,-u,_hs_atomic_and32"
         "-Wl,-u,_hs_atomic_nand8"
         "-Wl,-u,_hs_atomic_nand16"
         "-Wl,-u,_hs_atomic_nand32"
         "-Wl,-u,_hs_atomic_or8"
         "-Wl,-u,_hs_atomic_or16"
         "-Wl,-u,_hs_atomic_or32"
         "-Wl,-u,_hs_atomic_xor8"
         "-Wl,-u,_hs_atomic_xor16"
         "-Wl,-u,_hs_atomic_xor32"
         "-Wl,-u,_hs_cmpxchg8"
         "-Wl,-u,_hs_cmpxchg16"
         "-Wl,-u,_hs_cmpxchg32"
         "-Wl,-u,_hs_atomicread8"
         "-Wl,-u,_hs_atomicread16"
         "-Wl,-u,_hs_atomicread32"
         "-Wl,-u,_hs_atomicwrite8"
         "-Wl,-u,_hs_atomicwrite16"
         "-Wl,-u,_hs_atomicwrite32"

      if flag(find-ptr)
        -- This symbol is useful in gdb, but not referred to anywhere,
        -- so we need to force it to be included in the binary.
        ld-options: "-Wl,-u,_findPtr"

    else
      ld-options:
         "-Wl,-u,base_GHCziTopHandler_runIO_closure"
         "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
         "-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure"
         "-Wl,-u,ghczmprim_GHCziTypes_True_closure"
         "-Wl,-u,ghczmprim_GHCziTypes_False_closure"
         "-Wl,-u,base_GHCziPack_unpackCString_closure"
         "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure"
         "-Wl,-u,base_GHCziIOziException_stackOverflow_closure"
         "-Wl,-u,base_GHCziIOziException_heapOverflow_closure"
         "-Wl,-u,base_GHCziIOziException_allocationLimitExceeded_closure"
         "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
         "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
         "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure"
         "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure"
         "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure"
         "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure"
         "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure"
         "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure"
         "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure"
         "-Wl,-u,base_GHCziConcziSync_runSparks_closure"
         "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
         "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
         "-Wl,-u,base_GHCziConcziSignal_runHandlersPtr_closure"
         "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure"
         "-Wl,-u,base_GHCziTopHandler_runMainIO_closure"
         "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info"
         "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info"
         "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info"
         "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info"
         "-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info"
         "-Wl,-u,base_GHCziPtr_Ptr_con_info"
         "-Wl,-u,base_GHCziPtr_FunPtr_con_info"
         "-Wl,-u,base_GHCziInt_I8zh_con_info"
         "-Wl,-u,base_GHCziInt_I16zh_con_info"
         "-Wl,-u,base_GHCziInt_I32zh_con_info"
         "-Wl,-u,base_GHCziInt_I64zh_con_info"
         "-Wl,-u,base_GHCziWord_W8zh_con_info"
         "-Wl,-u,base_GHCziWord_W16zh_con_info"
         "-Wl,-u,base_GHCziWord_W32zh_con_info"
         "-Wl,-u,base_GHCziWord_W64zh_con_info"
         "-Wl,-u,base_GHCziStable_StablePtr_con_info"
         "-Wl,-u,hs_atomic_add8"
         "-Wl,-u,hs_atomic_add16"
         "-Wl,-u,hs_atomic_add32"
         "-Wl,-u,hs_atomic_sub8"
         "-Wl,-u,hs_atomic_sub16"
         "-Wl,-u,hs_atomic_sub32"
         "-Wl,-u,hs_atomic_and8"
         "-Wl,-u,hs_atomic_and16"
         "-Wl,-u,hs_atomic_and32"
         "-Wl,-u,hs_atomic_nand8"
         "-Wl,-u,hs_atomic_nand16"
         "-Wl,-u,hs_atomic_nand32"
         "-Wl,-u,hs_atomic_or8"
         "-Wl,-u,hs_atomic_or16"
         "-Wl,-u,hs_atomic_or32"
         "-Wl,-u,hs_atomic_xor8"
         "-Wl,-u,hs_atomic_xor16"
         "-Wl,-u,hs_atomic_xor32"
         "-Wl,-u,hs_cmpxchg8"
         "-Wl,-u,hs_cmpxchg16"
         "-Wl,-u,hs_cmpxchg32"
         "-Wl,-u,hs_atomicread8"
         "-Wl,-u,hs_atomicread16"
         "-Wl,-u,hs_atomicread32"
         "-Wl,-u,hs_atomicwrite8"
         "-Wl,-u,hs_atomicwrite16"
         "-Wl,-u,hs_atomicwrite32"

      if flag(find-ptr)
        -- This symbol is useful in gdb, but not referred to anywhere,
        -- so we need to force it to be included in the binary.
        ld-options: "-Wl,-u,findPtr"

    if os(osx)
      ld-options: "-Wl,-search_paths_first"
      if !arch(x86_64)
         ld-options: -read_only_relocs warning

    cmm-sources: Apply.cmm
                 Compact.cmm
                 Exception.cmm
                 HeapStackCheck.cmm
                 PrimOps.cmm
                 StgMiscClosures.cmm
                 StgStartup.cmm
                 StgStdThunks.cmm
                 Updates.cmm
                 -- AutoApply is generated
                 AutoApply.cmm

    if arch(i386) || arch(powerpc) || arch(powerpc64)
       asm-sources: AdjustorAsm.S
    if arch(powerpc) || arch(powerpc64) || arch(powerpc64le)
       asm-sources: StgCRunAsm.S

    c-sources: Adjustor.c
               Arena.c
               Capability.c
               CheckUnload.c
               ClosureFlags.c
               Disassembler.c
               FileLock.c
               Globals.c
               Hash.c
               Heap.c
               Hpc.c
               HsFFI.c
               Inlines.c
               Interpreter.c
               LdvProfile.c
               Libdw.c
               LibdwPool.c
               Linker.c
               Messages.c
               OldARMAtomic.c
               PathUtils.c
               Pool.c
               Printer.c
               ProfHeap.c
               ProfilerReport.c
               ProfilerReportJson.c
               Profiling.c
               Proftimer.c
               RaiseAsync.c
               RetainerProfile.c
               RetainerSet.c
               RtsAPI.c
               RtsDllMain.c
               RtsFlags.c
               RtsMain.c
               RtsMessages.c
               RtsStartup.c
               RtsSymbolInfo.c
               RtsSymbols.c
               RtsUtils.c
               STM.c
               Schedule.c
               Sparks.c
               StableName.c
               StablePtr.c
               StaticPtrTable.c
               Stats.c
               StgCRun.c
               StgPrimFloat.c
               Task.c
               ThreadLabels.c
               ThreadPaused.c
               Threads.c
               Ticky.c
               Timer.c
               TopHandler.c
               Trace.c
               TraverseHeap.c
               WSDeque.c
               Weak.c
               eventlog/EventLog.c
               eventlog/EventLogWriter.c
               hooks/FlagDefaults.c
               hooks/LongGCSync.c
               hooks/MallocFail.c
               hooks/OnExit.c
               hooks/OutOfHeap.c
               hooks/StackOverflow.c
               linker/CacheFlush.c
               linker/Elf.c
               linker/LoadArchive.c
               linker/M32Alloc.c
               linker/MachO.c
               linker/PEi386.c
               linker/SymbolExtras.c
               linker/elf_got.c
               linker/elf_plt.c
               linker/elf_plt_aarch64.c
               linker/elf_plt_arm.c
               linker/elf_reloc.c
               linker/elf_reloc_aarch64.c
               linker/elf_util.c
               sm/BlockAlloc.c
               sm/CNF.c
               sm/Compact.c
               sm/Evac.c
               sm/Evac_thr.c
               sm/GC.c
               sm/GCAux.c
               sm/GCUtils.c
               sm/MBlock.c
               sm/MarkWeak.c
               sm/Sanity.c
               sm/Scav.c
               sm/Scav_thr.c
               sm/Storage.c
               sm/Sweep.c
               xxhash.c
               fs.c
               -- I wish we had wildcards..., this would be:
               -- *.c hooks/**/*.c sm/**/*.c eventlog/**/*.c linker/**/*.c
    if os(windows)
       c-sources: win32/AsyncIO.c
                  win32/AwaitEvent.c
                  win32/ConsoleHandler.c
                  win32/GetEnv.c
                  win32/GetTime.c
                  win32/IOManager.c
                  win32/OSMem.c
                  win32/OSThreads.c
                  win32/ThrIOManager.c
                  win32/Ticker.c
                  win32/WorkQueue.c
                  win32/veh_excn.c
                  -- win32/**/*.c
    else
       c-sources: posix/GetEnv.c
                  posix/GetTime.c
                  posix/Itimer.c
                  posix/OSMem.c
                  posix/OSThreads.c
                  posix/Select.c
                  posix/Signals.c
                  posix/TTY.c
                  -- posix/*.c -- we do not want itimer