Zubin pushed to branch wip/9.10.3-backports at Glasgow Haskell Compiler / GHC

Commits:

13 changed files:

Changes:

  • hadrian/hadrian.cabal
    ... ... @@ -152,7 +152,7 @@ executable hadrian
    152 152
                            , TypeOperators
    
    153 153
         other-extensions:    MultiParamTypeClasses
    
    154 154
                            , TypeFamilies
    
    155
    -    build-depends:       Cabal                >= 3.10    && < 3.11
    
    155
    +    build-depends:       Cabal    (>= 3.10 && < 3.11) || (>= 3.12.1 && < 3.13)
    
    156 156
                            , base                 >= 4.11    && < 5
    
    157 157
                            , bytestring           >= 0.10    && < 0.13
    
    158 158
                            , containers           >= 0.5     && < 0.8
    

  • hadrian/src/Context.hs
    ... ... @@ -9,7 +9,7 @@ module Context (
    9 9
         contextDir, buildPath, buildDir, pkgInplaceConfig, pkgSetupConfigFile, pkgSetupConfigDir,
    
    10 10
         pkgHaddockFile, pkgRegisteredLibraryFile, pkgRegisteredLibraryFileName,
    
    11 11
         pkgLibraryFile, pkgGhciLibraryFile,
    
    12
    -    pkgConfFile, pkgStampFile, resourcePath, objectPath, contextPath, getContextPath, libPath, distDir,
    
    12
    +    pkgConfFile, pkgStampFile, resourcePath, objectPath, contextPath, getContextPath, libPath, distDir, distDynDir,
    
    13 13
         haddockStatsFilesDir
    
    14 14
         ) where
    
    15 15
     
    
    ... ... @@ -21,6 +21,8 @@ import Hadrian.Haskell.Cabal
    21 21
     import Oracles.Setting
    
    22 22
     import GHC.Toolchain.Target (Target(..))
    
    23 23
     import GHC.Platform.ArchOS
    
    24
    +import Hadrian.Oracles.Cabal
    
    25
    +import Hadrian.Haskell.Cabal.Type
    
    24 26
     
    
    25 27
     -- | Most targets are built only one way, hence the notion of 'vanillaContext'.
    
    26 28
     vanillaContext :: Stage -> Package -> Context
    
    ... ... @@ -62,12 +64,15 @@ libPath Context {..} = buildRoot <&> (-/- (stageString stage -/- "lib"))
    62 64
     --
    
    63 65
     -- We preform some renaming to accommodate Cabal's slightly different naming
    
    64 66
     -- conventions (see 'cabalOsString' and 'cabalArchString').
    
    65
    -distDir :: Stage -> Action FilePath
    
    66
    -distDir st = do
    
    67
    -    version        <- ghcVersionStage st
    
    68
    -    targetOs       <- cabalOsString   . stringEncodeOS   . archOS_OS   . tgtArchOs <$> targetStage st
    
    69
    -    targetArch     <- cabalArchString . stringEncodeArch . archOS_arch . tgtArchOs <$> targetStage st
    
    70
    -    return $ targetArch ++ "-" ++ targetOs ++ "-ghc-" ++ version
    
    67
    +distDir :: Context -> Action FilePath
    
    68
    +distDir c = do
    
    69
    +    cd <- readContextData c
    
    70
    +    return (contextLibdir cd)
    
    71
    +
    
    72
    +distDynDir :: Context -> Action FilePath
    
    73
    +distDynDir c = do
    
    74
    +    cd <- readContextData c
    
    75
    +    return (contextDynLibdir cd)
    
    71 76
     
    
    72 77
     pkgFileName :: Context -> Package -> String -> String -> Action FilePath
    
    73 78
     pkgFileName context package prefix suffix = do
    
    ... ... @@ -107,10 +112,11 @@ pkgRegisteredLibraryFile context@Context {..} = do
    107 112
         libDir    <- libPath context
    
    108 113
         pkgId     <- pkgUnitId stage package
    
    109 114
         fileName  <- pkgRegisteredLibraryFileName context
    
    110
    -    distDir   <- distDir stage
    
    115
    +    distDir   <- distDir context
    
    116
    +    distDynDir  <- distDynDir context
    
    111 117
         return $ if Dynamic `wayUnit` way
    
    112
    -        then libDir -/- distDir -/- fileName
    
    113
    -        else libDir -/- distDir -/- pkgId -/- fileName
    
    118
    +        then distDynDir -/- fileName
    
    119
    +        else distDir -/- fileName
    
    114 120
     
    
    115 121
     -- | Just the final filename portion of pkgRegisteredLibraryFile
    
    116 122
     pkgRegisteredLibraryFileName :: Context -> Action FilePath
    

  • hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
    ... ... @@ -254,6 +254,7 @@ resolveContextData context@Context {..} = do
    254 254
         pdi <- liftIO $ getHookedBuildInfo [pkgPath package, cPath -/- "build"]
    
    255 255
         let pd'  = C.updatePackageDescription pdi (C.localPkgDescr lbi)
    
    256 256
             lbi' = lbi { C.localPkgDescr = pd' }
    
    257
    +    pkgDbPath <- packageDbPath (PackageDbLoc stage iplace)
    
    257 258
     
    
    258 259
         -- TODO: Get rid of deprecated 'externalPackageDeps' and drop -Wno-deprecations
    
    259 260
         -- See: https://github.com/snowleopard/hadrian/issues/548
    
    ... ... @@ -302,6 +303,8 @@ resolveContextData context@Context {..} = do
    302 303
               | takeExtension fp `elem` [".cpp", ".cxx", ".c++"]= CppMain
    
    303 304
               | otherwise = CMain
    
    304 305
     
    
    306
    +        install_dirs = absoluteInstallDirs pd' lbi' (CopyToDb pkgDbPath)
    
    307
    +
    
    305 308
             main_src = fmap (first C.display) mainIs
    
    306 309
             cdata = ContextData
    
    307 310
               { dependencies    = deps
    
    ... ... @@ -343,7 +346,10 @@ resolveContextData context@Context {..} = do
    343 346
               , depLdOpts          = forDeps Installed.ldOptions
    
    344 347
               , buildGhciLib       = C.withGHCiLib lbi'
    
    345 348
               , frameworks         = C.frameworks buildInfo
    
    346
    -          , packageDescription = pd' }
    
    349
    +          , packageDescription = pd'
    
    350
    +          , contextLibdir      = libdir install_dirs
    
    351
    +          , contextDynLibdir   = dynlibdir install_dirs
    
    352
    +          }
    
    347 353
     
    
    348 354
           in return cdata
    
    349 355
     
    

  • hadrian/src/Hadrian/Haskell/Cabal/Type.hs
    ... ... @@ -70,6 +70,10 @@ data ContextData = ContextData
    70 70
         , buildGhciLib       :: Bool
    
    71 71
         , frameworks         :: [String]
    
    72 72
         , packageDescription :: PackageDescription
    
    73
    +    -- The location where normal library files go
    
    74
    +    , contextLibdir    :: FilePath
    
    75
    +    -- The location where dynamic libraries go
    
    76
    +    , contextDynLibdir :: FilePath
    
    73 77
         } deriving (Eq, Generic, Show, Typeable)
    
    74 78
     
    
    75 79
     instance Binary   PackageData
    

  • hadrian/src/Rules/BinaryDist.hs
    ... ... @@ -146,7 +146,7 @@ bindistRules = do
    146 146
         phony "binary-dist-dir" $ do
    
    147 147
             version        <- setting ProjectVersion
    
    148 148
             targetPlatform <- setting TargetPlatformFull
    
    149
    -        distDir        <- Context.distDir Stage1
    
    149
    +        distDir        <- Context.distDir (vanillaContext Stage1 rts)
    
    150 150
             rtsDir         <- pkgUnitId Stage1 rts
    
    151 151
             -- let rtsDir  = "rts"
    
    152 152
     
    

  • hadrian/src/Rules/CabalReinstall.hs
    ... ... @@ -53,13 +53,11 @@ cabalBuildRules = do
    53 53
             iserv_targets <- if cross then pure [] else iservBins
    
    54 54
             need (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets)))
    
    55 55
     
    
    56
    -        distDir        <- Context.distDir Stage1
    
    56
    +        distDir        <- Context.distDir (vanillaContext Stage1 rts)
    
    57 57
             rtsDir         <- pkgUnitId Stage1 rts
    
    58 58
             -- let rtsDir = "rts"
    
    59 59
     
    
    60
    -        let ghcBuildDir      = root -/- stageString Stage1
    
    61
    -            rtsIncludeDir    = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir
    
    62
    -                               -/- "include"
    
    60
    +        let rtsIncludeDir    = distDir -/- "include"
    
    63 61
     
    
    64 62
             libdir  <- liftIO . IO.makeAbsolute =<< stageLibPath Stage1
    
    65 63
             work_dir <- liftIO $ IO.makeAbsolute $ root -/- "stage-cabal"
    

  • hadrian/src/Rules/Register.hs
    ... ... @@ -182,11 +182,12 @@ buildConfFinal rs context@Context {..} _conf = do
    182 182
         --
    
    183 183
         -- so that if any change ends up modifying a library (but not its .conf
    
    184 184
         -- file), we still rebuild things that depend on it.
    
    185
    -    dir <- (-/-) <$> libPath context <*> distDir stage
    
    185
    +    dir <- distDir context
    
    186
    +    dyndir <- distDynDir context
    
    186 187
         pkgid <- pkgUnitId stage package
    
    187 188
         files <- liftIO $
    
    188
    -      (++) <$> getDirectoryFilesIO "." [dir -/- "*libHS"++pkgid++"*"]
    
    189
    -           <*> getDirectoryFilesIO "." [dir -/- pkgid -/- "**"]
    
    189
    +      (++) <$> getDirectoryFilesIO "." [dyndir -/- "*libHS"++pkgid++"*"]
    
    190
    +           <*> getDirectoryFilesIO "." [dir -/- "**"]
    
    190 191
         produces files
    
    191 192
     
    
    192 193
     buildConfInplace :: [(Resource, Int)] -> Context -> FilePath -> Action ()
    

  • hadrian/src/Rules/Rts.hs
    ... ... @@ -154,10 +154,9 @@ needRtsSymLinks :: Stage -> Set.Set Way -> Action ()
    154 154
     needRtsSymLinks stage rtsWays
    
    155 155
         = forM_ (Set.filter (wayUnit Dynamic) rtsWays) $ \ way -> do
    
    156 156
             let ctx = Context stage rts way Final
    
    157
    -        libPath     <- libPath ctx
    
    158
    -        distDir     <- distDir stage
    
    157
    +        distDir     <- distDynDir ctx
    
    159 158
             rtsLibFile  <- takeFileName <$> pkgLibraryFile ctx
    
    160
    -        need [removeRtsDummyVersion (libPath </> distDir </> rtsLibFile)]
    
    159
    +        need [removeRtsDummyVersion (distDir </> rtsLibFile)]
    
    161 160
     
    
    162 161
     prefix, versionlessPrefix :: String
    
    163 162
     versionlessPrefix = "libHSrts"
    

  • hadrian/src/Settings/Builders/Ghc.hs
    ... ... @@ -99,8 +99,7 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
    99 99
         originPath <- dropFileName <$> getOutput
    
    100 100
         context <- getContext
    
    101 101
         libPath' <- expr (libPath context)
    
    102
    -    st <- getStage
    
    103
    -    distDir <- expr (Context.distDir st)
    
    102
    +    distPath <- expr (Context.distDynDir context)
    
    104 103
     
    
    105 104
         useSystemFfi <- expr (flag UseSystemFfi)
    
    106 105
         buildPath <- getBuildPath
    
    ... ... @@ -112,7 +111,6 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
    112 111
     
    
    113 112
         let
    
    114 113
             dynamic = Dynamic `wayUnit` way
    
    115
    -        distPath = libPath' -/- distDir
    
    116 114
             originToLibsDir = makeRelativeNoSysLink originPath distPath
    
    117 115
             rpath
    
    118 116
                 -- Programs will end up in the bin dir ($ORIGIN) and will link to
    

  • libraries/deepseq
    1
    -Subproject commit 09aed1bf774f2f05c8b390539ce35adf5cd68c30
    1
    +Subproject commit 882f52f51854544a467babd8cb075e3271f5913e

  • libraries/os-string
    1
    -Subproject commit 6d31aafde2f7b8c3050ffee7dd9f658225cfd1a4
    1
    +Subproject commit 4b5efedcd2da9314edda80d973a44e67020370db

  • libraries/process
    1
    -Subproject commit b8c88fb5bbdebbcbb3e7c734f0c7515dd3cef84e
    1
    +Subproject commit f7d51387ba7f7f6079f3a9d5ce011ad9359b7dbb

  • libraries/unix
    1
    -Subproject commit 6be36ed54cc035c0f095d24bf3a451638d45513c
    1
    +Subproject commit 90e7d70de337ad759102b2445ebef6980684a9d3