|
1
|
1
|
module BindistConfig where
|
|
2
|
2
|
|
|
3
|
|
-import Stage
|
|
4
|
|
-import Oracles.Flag
|
|
5
|
3
|
import Expression
|
|
|
4
|
+import Oracles.Flag
|
|
6
|
5
|
|
|
7
|
|
-data BindistConfig = BindistConfig { library_stage :: Stage -- ^ The stage compiler which builds the libraries
|
|
8
|
|
- , executable_stage :: Stage -- ^ The stage compiler which builds the executables
|
|
9
|
|
- }
|
|
|
6
|
+data BindistConfig = BindistConfig
|
|
|
7
|
+ { -- | The stage compiler which builds the libraries
|
|
|
8
|
+ library_stage :: Stage,
|
|
|
9
|
+ -- | The stage compiler which builds the executables
|
|
|
10
|
+ executable_stage :: Stage,
|
|
|
11
|
+ -- | Which ghc-pkg to use (`targetBindist`'s
|
|
|
12
|
+ -- ghc-pkg cannot run on the build platform)
|
|
|
13
|
+ use_inplace_ghcPkg :: Bool
|
|
|
14
|
+ }
|
|
10
|
15
|
|
|
11
|
16
|
-- | A bindist for when the host = target, non cross-compilation setting.
|
|
12
|
17
|
-- Both the libraries and final executables are built with stage1 compiler.
|
|
13
|
18
|
normalBindist :: BindistConfig
|
|
14
|
|
-normalBindist = BindistConfig { library_stage = Stage1, executable_stage = Stage1 }
|
|
|
19
|
+normalBindist = BindistConfig {library_stage = Stage1, executable_stage = Stage1, use_inplace_ghcPkg = True}
|
|
15
|
20
|
|
|
16
|
21
|
-- | A bindist which contains a cross compiler (when host /= target)
|
|
17
|
22
|
-- The cross compiler is produced by the stage1 compiler, but then we must compile
|
|
18
|
23
|
-- all the boot libraries with the cross compiler (hence stage2 for libraries)
|
|
19
|
24
|
crossBindist :: BindistConfig
|
|
20
|
|
-crossBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage1 }
|
|
|
25
|
+crossBindist = BindistConfig {library_stage = Stage2, executable_stage = Stage1, use_inplace_ghcPkg = True}
|
|
21
|
26
|
|
|
22
|
27
|
-- | A bindist which contains executables for the target, which produce code for the
|
|
23
|
28
|
-- target. These are produced as "Stage3" build products, produced by a stage2 cross compiler.
|
|
24
|
|
-targetBindist :: BindistConfig
|
|
25
|
|
-targetBindist = BindistConfig { library_stage = Stage2, executable_stage = Stage2 }
|
|
26
|
|
-
|
|
|
29
|
+targetBindist :: BindistConfig
|
|
|
30
|
+targetBindist = BindistConfig {library_stage = Stage2, executable_stage = Stage2, use_inplace_ghcPkg = False}
|
|
27
|
31
|
|
|
28
|
32
|
-- | The implicit bindist config, if we don't know any better.
|
|
29
|
33
|
implicitBindistConfig :: Action BindistConfig
|
| ... |
... |
@@ -35,7 +39,7 @@ implicitBindistConfig = do |
|
35
|
39
|
return $ if cross then crossBindist else normalBindist
|
|
36
|
40
|
|
|
37
|
41
|
-- | Are we building things in this stage for the final target?
|
|
38
|
|
-buildingForTarget :: Stage -> Action Bool
|
|
|
42
|
+buildingForTarget :: Stage -> Action Bool
|
|
39
|
43
|
buildingForTarget st = do
|
|
40
|
44
|
cfg <- implicitBindistConfig
|
|
41
|
45
|
return $ st >= (library_stage cfg) |