David Eichmann pushed to branch wip/davide/windows-dlls at Glasgow Haskell Compiler / GHC

Commits:

6 changed files:

Changes:

  • compiler/GHC/Linker/Dynamic.hs
    ... ... @@ -121,7 +121,7 @@ linkDynLib logger tmpfs dflags0 unit_env o_files dep_packages
    121 121
                         , FileOption "" output_fn
    
    122 122
                         , Option "-shared"
    
    123 123
                         ] ++
    
    124
    -                    [ FileOption "-Wl,--out-implib=" (output_fn ++ ".a")
    
    124
    +                    [ FileOption "-Wl,--out-implib=" (output_fn -<.> ".lib")
    
    125 125
                         | gopt Opt_SharedImplib dflags
    
    126 126
                         ]
    
    127 127
                      ++ map (FileOption "") o_files
    

  • hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
    ... ... @@ -222,6 +222,21 @@ copyPackage context@Context {..} = do
    222 222
             C.defaultMainWithHooksNoReadArgs C.autoconfUserHooks gpd
    
    223 223
                 [ "copy", "--builddir", ctxPath, "--target-package-db", pkgDbPath, v ]
    
    224 224
     
    
    225
    +    -- TODO This is windows only
    
    226
    +    -- TODO Don't do this once cabal is copying .libn files by default
    
    227
    +    -- Copy missing .lib files
    
    228
    +    dir <- Context.buildPath context
    
    229
    +    files <- getDirectoryFiles "." [ dir -/- "*.lib" ]
    
    230
    +    ghcPkg <- builderPath (GhcPkg undefined stage)
    
    231
    +    Stdout (libDirRaw :: FilePath) <- cmd ghcPkg ["-f", pkgDbPath, "field", pkgName package, "dynamic-library-dirs", "--simple-output"]
    
    232
    +    let libDir = fromSingleton
    
    233
    +                    ("Expected excactly 1 dynamic library dir, but got: " ++ libDirRaw)
    
    234
    +                    (filter (/= "") . map trim $ lines libDirRaw)
    
    235
    +    forM_ files $ \file ->
    
    236
    +        copyFile' file (libDir </> takeFileName file)
    
    237
    +
    
    238
    +
    
    239
    +
    
    225 240
     shakeVerbosityToCabalFlag :: Verbosity -> String
    
    226 241
     shakeVerbosityToCabalFlag = \case
    
    227 242
         Diagnostic -> "-v3"
    

  • hadrian/src/Rules/Library.hs
    ... ... @@ -221,7 +221,7 @@ extraObjects context
    221 221
                     }
    
    222 222
     
    
    223 223
                 builddir <- buildPath context
    
    224
    -            return [ builddir -/- ghcInternalDllName <> ".a"]
    
    224
    +            return [ builddir -/- ghcInternalDllName <.> "lib"]
    
    225 225
     
    
    226 226
         | otherwise = return []
    
    227 227
     
    

  • hadrian/src/Rules/Rts.hs
    ... ... @@ -14,7 +14,7 @@ rtsRules = priority 3 $ do
    14 14
         forM_ [Stage1, Stage2, Stage3 ] $ \ stage -> do
    
    15 15
             let buildPath = root -/- buildDir (rtsContext stage)
    
    16 16
             buildPath -/- "libHSghc-internal-*.def" %> buildGhcInternalImportDef
    
    17
    -        buildPath -/- "libHSghc-internal-*.dll.a" %> buildGhcInternalImportLib
    
    17
    +        buildPath -/- "libHSghc-internal-*.lib" %> buildGhcInternalImportLib
    
    18 18
     
    
    19 19
     buildGhcInternalImportDef :: FilePath -> Action ()
    
    20 20
     buildGhcInternalImportDef target = do
    
    ... ... @@ -26,6 +26,6 @@ buildGhcInternalImportDef target = do
    26 26
     buildGhcInternalImportLib :: FilePath -> Action ()
    
    27 27
     buildGhcInternalImportLib target = do
    
    28 28
         let input = dropExtension (dropExtension target) <.> "def" -- the .def file
    
    29
    -        output = target -- the .dll.a import lib
    
    29
    +        output = target -- the .lib import lib
    
    30 30
         need [input]
    
    31 31
         runBuilder Dlltool ["-d", input, "-l", output] [input] [output]

  • libraries/Cabal
    1
    -Subproject commit 8d1f5a33662be0db0654061fb53fb00e3f4417e0
    1
    +Subproject commit 9c92f635c0f15c6e3f4f276770d35cf4fdac19d0

  • utils/ghc-pkg/Main.hs
    ... ... @@ -2058,8 +2058,8 @@ checkHSLib _verbosity dirs lib = do
    2058 2058
                        "lib" ++ lib ++ "_p" ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".so",
    
    2059 2059
                        "lib" ++ lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dylib",
    
    2060 2060
                        "lib" ++ lib ++ "_p" ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dylib",
    
    2061
    -                   lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dll",
    
    2062
    -                   lib ++ "_p" ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".dll",
    
    2061
    +                   lib ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".lib",
    
    2062
    +                   lib ++ "_p" ++ "-ghc" ++ GHC.Version.cProjectVersion ++ ".lib",
    
    2063 2063
                        lib ++ ".bytecodelib"
    
    2064 2064
                       ]
    
    2065 2065
       b <- liftIO $ doesFileExistOnPath filenames dirs