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