Sven Tennie pushed to branch wip/supersven/libDir-setting at Glasgow Haskell Compiler / GHC Commits: 83f6a23f by Sven Tennie at 2026-05-09T21:56:05+02:00 WIP - fix package database path - - - - - 2 changed files: - hadrian/src/Rules/BinaryDist.hs - hadrian/src/Rules/Generate.hs Changes: ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -222,11 +222,12 @@ bindistRules = do -- Regenerate settings file without LibDir. For bindists, LibDir should -- be derived from topdir at runtime such that the GHC binary is - -- relocatable. + -- relocatable. The package DB is always at "package.conf.d" relative to + -- the lib dir, matching the known bindist layout. let bindistSettings = bindistFilesDir -/- "lib" -/- "settings" bindistContext = vanillaContext Stage1 compiler bindistSettingsContent <- interpretInContext bindistContext $ - generateSettings bindistSettings False (bindistFilesDir -/- "lib" -/- "package.conf.d") + generateSettings bindistSettings False "package.conf.d" writeFile' bindistSettings bindistSettingsContent copyDirectory (rtsIncludeDir) bindistFilesDir ===================================== hadrian/src/Rules/Generate.hs ===================================== @@ -266,7 +266,11 @@ generateRules = do Stage1 -> get_pkg_db Stage1 Stage2 -> get_pkg_db Stage1 Stage3 -> get_pkg_db Stage2 - go (generateSettings out True pkgDb) out + -- addTrailingPathSeparator needed: makeRelativeNoSysLink uses + -- splitPath where "lib" and "lib/" are distinct components. + let lib_topDir = addTrailingPathSeparator prefix + relPkgDb = makeRelativeNoSysLink lib_topDir pkgDb + go (generateSettings out True relPkgDb) out (prefix -/- "targets" -/- "default.target") %> \out -> go (show <$> expr getTargetTarget) out where @@ -470,11 +474,12 @@ ghcWrapper stage = do -- | Generate settings file, optionally including @LibDir@. -- --- @pkgDb@: absolute path to the package DB for the @"Relative Global Package --- DB"@ setting. Callers determine the correct path (in-tree or bindist). For +-- @rel_pkg_db@: package DB path relative to the lib dir (e.g. +-- "package.conf.d"). Callers supply the correct relative path. For bindists +-- the layout is known statically; for in-tree builds callers compute it. For -- bindists, we omit @LibDir@ so it defaults to @topDir@ at runtime. generateSettings :: FilePath -> Bool -> FilePath -> Expr String -generateSettings settingsFile includeLibDir package_db_path = do +generateSettings settingsFile includeLibDir rel_pkg_db = do ctx <- getContext stage <- getStage @@ -493,8 +498,7 @@ generateSettings settingsFile includeLibDir package_db_path = do -- addTrailingPathSeparator is needed because makeRelativeNoSysLink uses -- splitPath internally, where "lib" and "lib/" are distinct components. lib_topDir :: FilePath <- expr $ addTrailingPathSeparator <$> stageLibPath stage_dir_stage - let rel_pkg_db = makeRelativeNoSysLink lib_topDir package_db_path - rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir + let rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir settings <- traverse sequence $ [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit }))) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/83f6a23fa4621b59fb04dec317aa5c8e... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/83f6a23fa4621b59fb04dec317aa5c8e... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)