| ... |
... |
@@ -266,7 +266,11 @@ generateRules = do |
|
266
|
266
|
Stage1 -> get_pkg_db Stage1
|
|
267
|
267
|
Stage2 -> get_pkg_db Stage1
|
|
268
|
268
|
Stage3 -> get_pkg_db Stage2
|
|
269
|
|
- go (generateSettings out True pkgDb) out
|
|
|
269
|
+ -- addTrailingPathSeparator needed: makeRelativeNoSysLink uses
|
|
|
270
|
+ -- splitPath where "lib" and "lib/" are distinct components.
|
|
|
271
|
+ let lib_topDir = addTrailingPathSeparator prefix
|
|
|
272
|
+ relPkgDb = makeRelativeNoSysLink lib_topDir pkgDb
|
|
|
273
|
+ go (generateSettings out True relPkgDb) out
|
|
270
|
274
|
(prefix -/- "targets" -/- "default.target") %> \out -> go (show <$> expr getTargetTarget) out
|
|
271
|
275
|
|
|
272
|
276
|
where
|
| ... |
... |
@@ -470,11 +474,12 @@ ghcWrapper stage = do |
|
470
|
474
|
|
|
471
|
475
|
-- | Generate settings file, optionally including @LibDir@.
|
|
472
|
476
|
--
|
|
473
|
|
--- @pkgDb@: absolute path to the package DB for the @"Relative Global Package
|
|
474
|
|
--- DB"@ setting. Callers determine the correct path (in-tree or bindist). For
|
|
|
477
|
+-- @rel_pkg_db@: package DB path relative to the lib dir (e.g.
|
|
|
478
|
+-- "package.conf.d"). Callers supply the correct relative path. For bindists
|
|
|
479
|
+-- the layout is known statically; for in-tree builds callers compute it. For
|
|
475
|
480
|
-- bindists, we omit @LibDir@ so it defaults to @topDir@ at runtime.
|
|
476
|
481
|
generateSettings :: FilePath -> Bool -> FilePath -> Expr String
|
|
477
|
|
-generateSettings settingsFile includeLibDir package_db_path = do
|
|
|
482
|
+generateSettings settingsFile includeLibDir rel_pkg_db = do
|
|
478
|
483
|
ctx <- getContext
|
|
479
|
484
|
stage <- getStage
|
|
480
|
485
|
|
| ... |
... |
@@ -493,8 +498,7 @@ generateSettings settingsFile includeLibDir package_db_path = do |
|
493
|
498
|
-- addTrailingPathSeparator is needed because makeRelativeNoSysLink uses
|
|
494
|
499
|
-- splitPath internally, where "lib" and "lib/" are distinct components.
|
|
495
|
500
|
lib_topDir :: FilePath <- expr $ addTrailingPathSeparator <$> stageLibPath stage_dir_stage
|
|
496
|
|
- let rel_pkg_db = makeRelativeNoSysLink lib_topDir package_db_path
|
|
497
|
|
- rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir
|
|
|
501
|
+ let rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir
|
|
498
|
502
|
|
|
499
|
503
|
settings <- traverse sequence $
|
|
500
|
504
|
[ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit })))
|