Skip to content

Commit 1bf97e3

Browse files
committed
refactor: reorganize cabal.project files
- Improve the consistency across the stage cabal.project files by using the same ordering and delimiter comments - "package-dbs: clear, global" is the default so it's removed
1 parent 7dc55f9 commit 1bf97e3

File tree

4 files changed

+194
-244
lines changed

4 files changed

+194
-244
lines changed

cabal.project.rts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
-- NOTE: Yes. The strings have to be escaped like this.
2+
3+
package rts
4+
ghc-options: "-optc-DProjectVersion=\"914\""
5+
ghc-options: "-optc-DBuildPlatform=\"FIXME\""
6+
ghc-options: "-optc-DBuildArch=\"FIXME\""
7+
ghc-options: "-optc-DBuildOS=\"FIXME\""
8+
ghc-options: "-optc-DBuildVendor=\"FIXME\""
9+
ghc-options: "-optc-DGhcUnregisterised=\"FIXME\""
10+
ghc-options: "-optc-DTablesNextToCode=\"FIXME\""
11+
ghc-options: "-optc-DFS_NAMESPACE=rts"
12+
ghc-options: -no-rts
13+
flags: +tables-next-to-code
14+
15+
if os(linux)
16+
package rts
17+
ghc-options: "-optc-DHostArch=\"x86_64\""
18+
ghc-options: "-optc-DHostOS=\"linux\""
19+
ghc-options: "-optc-DHostPlatform=\"x86_64-unknown-linux\""
20+
ghc-options: "-optc-DHostVendor=\"unknown\""
21+
22+
if os(darwin)
23+
package rts
24+
ghc-options: "-optc-DHostArch=\"aarch64\""
25+
ghc-options: "-optc-DHostOS=\"darwin\""
26+
ghc-options: "-optc-DHostPlatform=\"aarch64-apple-darwin\""
27+
ghc-options: "-optc-DHostVendor=\"unknown\""
28+
flags: +leading-underscore
29+
30+
if os(freebsd)
31+
package rts
32+
ghc-options: "-optc-DHostArch=\"x86_64\""
33+
ghc-options: "-optc-DHostOS=\"freebsd\""
34+
ghc-options: "-optc-DHostPlatform=\"x86_64-portbld-freebsd\""
35+
ghc-options: "-optc-DHostVendor=\"unknown\""
36+
37+
if os(wasi)
38+
package rts
39+
ghc-options: "-optc-DHostArch=\"wasm32\""
40+
ghc-options: "-optc-DHostOS=\"unknown\""
41+
ghc-options: "-optc-DHostPlatform=\"wasm32-wasi\""
42+
ghc-options: "-optc-DHostVendor=\"unknown\""
43+
ghc-options: -optl-Wl,--export-dynamic
44+
ghc-options: -optc-fvisibility=default
45+
ghc-options: -optc-fvisibility-inlines-hidden
46+
47+
package rts-headers
48+
ghc-options: -no-rts
49+
50+
package rts-fs
51+
ghc-options: -no-rts

cabal.project.stage1

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
index-state: 2025-10-26T19:17:08Z
2+
allow-boot-library-installs: True
3+
benchmarks: False
4+
tests: False
25

36
packages:
47
-- NOTE: we need rts-headers, because the _newly_ built compiler depends
@@ -10,39 +13,51 @@ packages:
1013
rts-headers
1114
rts-fs
1215

13-
-- other packages.
16+
-- Compiler
1417
ghc
1518
compiler
16-
libraries/directory
17-
libraries/file-io
18-
libraries/filepath
19-
libraries/ghc-platform
19+
20+
-- Internal libraries
2021
libraries/ghc-boot
2122
libraries/ghc-boot-th-next
2223
libraries/ghc-heap
24+
libraries/ghc-platform
2325
libraries/ghci
2426
libraries/libffi-clib
27+
28+
-- Internal tools
29+
utils/deriveConstants
30+
utils/genapply
31+
utils/genprimopcode
32+
utils/ghc-pkg
33+
utils/ghc-toolchain
34+
utils/ghc-toolchain/exe
35+
utils/unlit
36+
37+
-- The following are packages available on Hackage but included as submodules
38+
libraries/Cabal/Cabal
39+
libraries/Cabal/Cabal-syntax
40+
libraries/directory
41+
libraries/file-io
42+
libraries/filepath
2543
libraries/os-string
2644
libraries/process
2745
libraries/semaphore-compat
28-
-- libraries/time
2946
libraries/unix
3047
libraries/Win32
31-
libraries/Cabal/Cabal-syntax
32-
libraries/Cabal/Cabal
33-
utils/ghc-pkg
3448
utils/hsc2hs
35-
utils/unlit
36-
utils/genprimopcode
37-
utils/genapply
38-
utils/deriveConstants
39-
utils/ghc-toolchain
40-
utils/ghc-toolchain/exe
4149

4250

43-
benchmarks: False
44-
tests: False
45-
allow-boot-library-installs: True
51+
--
52+
-- Constraints
53+
--
54+
55+
constraints:
56+
template-haskell <= 2.22
57+
58+
--
59+
-- Package level configuration
60+
--
4661

4762
package *
4863
library-vanilla: True
@@ -67,8 +82,9 @@ package ghc-boot-th-next
6782
package hsc2hs
6883
flags: +in-ghc-tree
6984

70-
constraints:
71-
template-haskell <= 2.22
85+
--
86+
-- Program options
87+
--
7288

7389
program-options
7490
ghc-options: -fhide-source-paths -j

cabal.project.stage2

Lines changed: 59 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,92 @@
1-
package-dbs: clear, global
1+
allow-boot-library-installs: True
2+
benchmarks: False
3+
tests: False
4+
5+
-- Disable Hackage, we explicitly include the packages we need.
6+
active-repositories: :none
27

38
-- Import configure/generated feature toggles (dynamic, etc.) if present.
49
-- A default file is kept in-tree; configure will overwrite with substituted values.
510
import: cabal.project.stage2.settings
611

712
packages:
13+
-- RTS
814
rts-headers
915
rts-fs
1016
rts
1117

12-
libraries/ghc-prim
13-
libraries/ghc-internal
14-
libraries/ghc-experimental
15-
libraries/base
18+
-- Compiler
1619
compiler
1720
ghc
18-
libraries/ghc-platform
19-
libraries/ghc-compact
21+
22+
-- Internal libraries
23+
libraries/base
2024
libraries/ghc-bignum
21-
libraries/integer-gmp
2225
libraries/ghc-boot
2326
libraries/ghc-boot-th
27+
libraries/ghc-compact
28+
libraries/ghc-experimental
2429
libraries/ghc-heap
30+
libraries/ghc-internal
31+
libraries/ghc-platform
32+
libraries/ghc-prim
2533
libraries/ghci
26-
libraries/stm
27-
libraries/template-haskell
28-
libraries/hpc
34+
libraries/integer-gmp
2935
libraries/system-cxx-std-lib
36+
libraries/template-haskell
37+
38+
-- Internal tools
39+
utils/deriveConstants
40+
utils/genapply
41+
utils/genprimopcode
42+
utils/ghc-iserv
43+
utils/ghc-pkg
44+
utils/ghc-toolchain
45+
utils/hp2ps
46+
utils/runghc
47+
utils/unlit
48+
49+
-- The following are packages available on Hackage but included as submodules
3050
libraries/array
3151
libraries/binary
3252
libraries/bytestring
53+
libraries/Cabal/Cabal
54+
libraries/Cabal/Cabal-syntax
3355
libraries/containers/containers
3456
libraries/deepseq
3557
libraries/directory
3658
libraries/exceptions
3759
libraries/file-io
3860
libraries/filepath
61+
libraries/haskeline
62+
libraries/hpc
3963
libraries/libffi-clib
4064
libraries/mtl
4165
libraries/os-string
4266
libraries/parsec
4367
libraries/pretty
4468
libraries/process
4569
libraries/semaphore-compat
70+
libraries/stm
71+
libraries/terminfo
4672
libraries/text
4773
libraries/time
4874
libraries/transformers
4975
libraries/unix
50-
libraries/xhtml
5176
libraries/Win32
77+
libraries/xhtml
78+
utils/hpc
79+
utils/hsc2hs
5280

53-
libraries/Cabal/Cabal-syntax
54-
libraries/Cabal/Cabal
81+
-- These would be on Hackage but we include them as direct URLs
82+
-- (Hackage is disabled by `active-repositories: :none`)
5583
https://hackage.haskell.org/package/alex-3.5.2.0/alex-3.5.2.0.tar.gz
5684
https://hackage.haskell.org/package/happy-2.1.5/happy-2.1.5.tar.gz
5785
https://hackage.haskell.org/package/happy-lib-2.1.5/happy-lib-2.1.5.tar.gz
5886

59-
utils/genprimopcode
60-
utils/deriveConstants
61-
utils/ghc-pkg
62-
utils/hsc2hs
63-
utils/unlit
64-
utils/ghc-toolchain
65-
66-
libraries/haskeline
67-
libraries/terminfo
68-
utils/hp2ps
69-
utils/hpc
70-
utils/ghc-iserv
71-
utils/genapply
72-
utils/runghc
73-
74-
-- project-rts
75-
-- project-ghc
76-
benchmarks: False
77-
tests: False
78-
allow-boot-library-installs: True
79-
active-repositories: :none
87+
--
88+
-- Constraints
89+
--
8090

8191
constraints:
8292
-- we do not want to use the rts-headers from stage1
@@ -85,6 +95,10 @@ constraints:
8595
-- I cannot write build:* but ghc-internal is enough to do the job.
8696
, build:any.ghc-internal installed
8797

98+
--
99+
-- Package level configuration
100+
--
101+
88102
package *
89103
library-vanilla: True
90104
library-for-ghci: True
@@ -93,74 +107,7 @@ package *
93107
executable-profiling: False
94108
executable-static: False
95109

96-
-- Maybe we should fix this with some import
97-
if os(linux)
98-
package rts
99-
ghc-options: "-optc-DProjectVersion=\"914\""
100-
ghc-options: "-optc-DHostPlatform=\"x86_64-unknown-linux\""
101-
ghc-options: "-optc-DHostArch=\"x86_64\""
102-
ghc-options: "-optc-DHostOS=\"linux\""
103-
ghc-options: "-optc-DHostVendor=\"unknown\""
104-
ghc-options: "-optc-DBuildPlatform=\"FIXME\""
105-
ghc-options: "-optc-DBuildArch=\"FIXME\""
106-
ghc-options: "-optc-DBuildOS=\"FIXME\""
107-
ghc-options: "-optc-DBuildVendor=\"FIXME\""
108-
ghc-options: "-optc-DGhcUnregisterised=\"FIXME\""
109-
ghc-options: "-optc-DTablesNextToCode=\"FIXME\""
110-
ghc-options: "-optc-DFS_NAMESPACE=rts"
111-
flags: +tables-next-to-code
112-
113-
if os(darwin)
114-
package rts
115-
ghc-options: "-optc-DProjectVersion=\"914\""
116-
ghc-options: "-optc-DHostPlatform=\"aarch64-apple-darwin\""
117-
ghc-options: "-optc-DHostArch=\"aarch64\""
118-
ghc-options: "-optc-DHostOS=\"darwin\""
119-
ghc-options: "-optc-DHostVendor=\"unknown\""
120-
ghc-options: "-optc-DBuildPlatform=\"FIXME\""
121-
ghc-options: "-optc-DBuildArch=\"FIXME\""
122-
ghc-options: "-optc-DBuildOS=\"FIXME\""
123-
ghc-options: "-optc-DBuildVendor=\"FIXME\""
124-
ghc-options: "-optc-DGhcUnregisterised=\"FIXME\""
125-
ghc-options: "-optc-DTablesNextToCode=\"FIXME\""
126-
ghc-options: "-optc-DFS_NAMESPACE=rts"
127-
flags: +tables-next-to-code +leading-underscore
128-
129-
if os(freebsd)
130-
package rts
131-
ghc-options: "-optc-DProjectVersion=\"914\""
132-
ghc-options: "-optc-DHostPlatform=\"x86_64-portbld-freebsd\""
133-
ghc-options: "-optc-DHostArch=\"x86_64\""
134-
ghc-options: "-optc-DHostOS=\"freebsd\""
135-
ghc-options: "-optc-DHostVendor=\"unknown\""
136-
ghc-options: "-optc-DBuildPlatform=\"FIXME\""
137-
ghc-options: "-optc-DBuildArch=\"FIXME\""
138-
ghc-options: "-optc-DBuildOS=\"FIXME\""
139-
ghc-options: "-optc-DBuildVendor=\"FIXME\""
140-
ghc-options: "-optc-DGhcUnregisterised=\"FIXME\""
141-
ghc-options: "-optc-DTablesNextToCode=\"FIXME\""
142-
ghc-options: "-optc-DFS_NAMESPACE=rts"
143-
flags: +tables-next-to-code
144-
145-
program-options
146-
ghc-options: -fhide-source-paths -j
147-
148-
-- project-boot-libs
149-
benchmarks: False
150-
tests: False
151-
allow-boot-library-installs: True
152-
active-repositories: :none
153-
154-
-- (removed duplicate global package * stanza; first one applies already)
155-
156-
package rts-headers
157-
ghc-options: -no-rts
158-
159-
package rts-fs
160-
ghc-options: -no-rts
161-
162-
package rts
163-
ghc-options: -no-rts
110+
import: cabal.project.rts
164111

165112
package libffi-clib
166113
ghc-options: -no-rts
@@ -196,32 +143,33 @@ package libffi-clib
196143
-- throughout the session. See
197144
-- GHC.Unit.State:mkUnitState
198145
--
199-
package ghc-internal
200-
ghc-options: -no-rts
201146

202147
package ghc
203148
flags: +build-tool-depends +internal-interpreter
204149

150+
package ghc-bin
151+
flags: +internal-interpreter -threaded
152+
205153
package ghci
206154
flags: +internal-interpreter
207155

208156
package ghc-internal
209157
flags: +bignum-native
158+
ghc-options: -no-rts
210159

211160
package text
212161
flags: -simdutf
213162

214-
program-options
215-
ghc-options: -fhide-source-paths -j
216-
217-
package ghc-bin
218-
flags: +internal-interpreter -threaded
219-
163+
-- TODO: What is this? Why do we need _in-ghc-tree_ here?
220164
package hsc2hs
221165
flags: +in-ghc-tree
222166

223167
package haskeline
224168
flags: -terminfo
225169

170+
--
171+
-- Program options
172+
--
173+
226174
program-options
227175
ghc-options: -fhide-source-paths -j

0 commit comments

Comments
 (0)