Sven Tennie pushed to branch wip/supersven/libDir-setting at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Settings/IO.hs
    ... ... @@ -152,9 +152,13 @@ initSettings top_dir = do
    152 152
       -- LibDir is optional. If not set, derive it from topDir. This allows
    
    153 153
       -- bindists to work without explicitly setting LibDir, but gives us the
    
    154 154
       -- option to override it for inplace test compilers (the "stage2
    
    155
    -  -- cross-compiler" scenario).
    
    156
    -  let lib_dir = fromRight top_dir $
    
    157
    -                  getRawFilePathSetting top_dir settingsFile mySettings "LibDir"
    
    155
    +  -- cross-compiler" scenario). If LibDir is a relative path, it is
    
    156
    +  -- interpreted relative to topDir.
    
    157
    +  let lib_dir_raw = fromRight top_dir $
    
    158
    +                      getRawFilePathSetting top_dir settingsFile mySettings "LibDir"
    
    159
    +      lib_dir = if isRelative lib_dir_raw
    
    160
    +                then top_dir </> lib_dir_raw
    
    161
    +                else lib_dir_raw
    
    158 162
     
    
    159 163
       return $ Settings
    
    160 164
         { sGhcNameVersion = GhcNameVersion
    

  • hadrian/src/Rules/Generate.hs
    ... ... @@ -491,7 +491,8 @@ generateSettings settingsFile includeLibDir package_db_path = do
    491 491
             -- So, we need to decrement the stage to get the correct directory
    
    492 492
             stage_dir_stage = predStage stage
    
    493 493
     
    
    494
    -    rel_lib_topDir :: FilePath <- expr $ stageLibPath stage_dir_stage
    
    494
    +    lib_topDir :: FilePath <- expr $ stageLibPath stage_dir_stage
    
    495
    +    let rel_lib_topDir = makeRelativeNoSysLink (dropFileName settingsFile) lib_topDir
    
    495 496
     
    
    496 497
         settings <- traverse sequence $
    
    497 498
               [ ("unlit command", ("$topdir/../bin/" <>) <$> expr (programName (ctx { Context.package = unlit })))