Skip to content

Commit a6fc557

Browse files
committed
Comments
1 parent 23668e9 commit a6fc557

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

Build.hs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,7 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts = d
376376
-- platform constants in the package db and fails. The flag is already
377377
-- set in rts.cabal but for some reason it isn't always passed :shrug:
378378
, "--ghc-options=-this-unit-id=rts"
379-
, "--ghc-options=-DProjectVersion=913"
380-
, "--ghc-options=\"-optc=-DProjectVersion=\\\"913\\\"\""
379+
, "--ghc-options=\"-optc=-DProjectVersion=\\\"" ++ Text.unpack (gboVersionInt opts) ++ "\\\"\""
381380
, "--ghc-options=\"-optc=-DRtsWay=\\\"FIXME\\\"\""
382381
, "--ghc-options=\"-optc=-DHostPlatform=\\\"FIXME\\\"\""
383382
, "--ghc-options=\"-optc=-DHostArch=\\\"FIXME\\\"\""
@@ -431,7 +430,11 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts = d
431430
run_genapply [derived_constants, "-V32"] (src_rts </> "AutoApply_V32.cmm")
432431
run_genapply [derived_constants, "-V64"] (src_rts </> "AutoApply_V64.cmm")
433432

434-
-- Generate genprimopcode
433+
-- Generate primop code for ghc-prim
434+
--
435+
-- Note that this can't be done in a Setup.hs for ghc-prim because
436+
-- cabal-install can't build it because t depends on base, Cabal, etc.
437+
-- libraries that aren't built yet.
435438
let primops_txt = src </> "libraries/ghc/GHC/Builtin/primops.txt"
436439
let primops_txt_pp = primops_txt <.> ".pp"
437440
primops <- readCreateProcess (shell $ "gcc -E -undef -traditional -P -x c " ++ primops_txt_pp) ""
@@ -478,11 +481,20 @@ buildBootLibraries cabal ghc ghcpkg derive_constants genapply genprimop opts = d
478481
let build_boot_cmd = runCabal cabal
479482
[ "build"
480483
, "--project-file=cabal.project-stage1" -- TODO: replace with command-line args
481-
, "ghc-prim", "ghc-internal", "base"
482484
, "--with-compiler=" ++ ghcPath ghc -- FIXME: escape path
483485
, "--with-hc-pkg=" ++ ghcPkgPath ghcpkg -- FIXME: escape path
484486
, "--ghc-options=\"-ghcversion-file=" ++ ghcversionh ++ "\""
485487
, "--builddir=" ++ build_dir
488+
-- never reinstall the RTS during this step: we should use the one
489+
-- installed at the previous step. Otherwise we risk using invalid
490+
-- generated files.
491+
-- FIXME: but it doesn't work because the rts isn't really installed
492+
-- , "--constraint=rts installed"
493+
494+
-- targets
495+
, "ghc-prim"
496+
, "ghc-internal"
497+
, "base"
486498
]
487499

488500
msg " - Building boot libraries..."

cabal.project-stage0

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
packages:
22
./_build/stage0/src/ghc-bin/
3-
./_build/stage0/src/libraries/ghc
3+
./_build/stage0/src/libraries/ghc/
44
./_build/stage0/src/libraries/directory/
55
./_build/stage0/src/libraries/file-io/
66
./_build/stage0/src/libraries/filepath/
@@ -43,7 +43,9 @@ constraints:
4343
package ghc-boot-th
4444
flags: +bootstrap
4545

46+
4647
-- package genprimopcode
4748
-- flags: -build-tool-depends
4849

50+
-- allow template-haskell with newer ghc-boot-th
4951
allow-newer: ghc-boot-th

libraries/ghc-prim/ghc-prim.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ category: GHC
88
maintainer: [email protected]
99
bug-reports: https://gitlab.haskell.org/ghc/ghc/issues/new
1010
synopsis: GHC primitives
11+
-- We can't use Custom build-type with boot packages: building Setup.hs with
12+
-- cabal-install requires that base, Cabal, directory, process, filepath,
13+
-- containers, etc. libraries be available, but they aren't when we bootstrap.
1114
build-type: Simple
1215
description:
1316
This package contains the primitive types and operations supplied by GHC.

0 commit comments

Comments
 (0)