@@ -17,7 +17,6 @@ import Distribution.Compat.ResponseFile
1717import Distribution.InstalledPackageInfo (InstalledPackageInfo )
1818import qualified Distribution.InstalledPackageInfo as IPI
1919import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo
20- import qualified Distribution.ModuleName as ModuleName
2120import Distribution.Package
2221import Distribution.PackageDescription as PD
2322import Distribution.PackageDescription.Utils (cabalBug )
@@ -32,7 +31,6 @@ import Distribution.Simple.GHC.ImplInfo
3231import qualified Distribution.Simple.GHC.Internal as Internal
3332import Distribution.Simple.LocalBuildInfo
3433import qualified Distribution.Simple.PackageIndex as PackageIndex
35- import Distribution.Simple.PreProcess.Types
3634import Distribution.Simple.Program
3735import qualified Distribution.Simple.Program.Ar as Ar
3836import Distribution.Simple.Program.GHC
@@ -51,8 +49,6 @@ import Distribution.Version
5149import System.Directory
5250 ( createDirectoryIfMissing
5351 , doesDirectoryExist
54- , doesFileExist
55- , removeFile
5652 , renameFile
5753 )
5854import System.FilePath
@@ -260,18 +256,14 @@ linkLibrary
260256 -> [BuildWay ]
261257 -- ^ Wanted build ways and corresponding build options
262258 -> IO ()
263- linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do
259+ linkLibrary buildTargetDir cleanedExtraLibDirs _pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do
264260 let
265- common = configCommonFlags $ configFlags lbi
266- mbWorkDir = flagToMaybe $ setupWorkingDir common
267-
268261 compiler_id = compilerId comp
269262 comp = compiler lbi
270- ghcVersion = compilerVersion comp
271263 implInfo = getImplInfo comp
272264 uid = componentUnitId clbi
273265 libBi = libBuildInfo lib
274- Platform _hostArch hostOS = hostPlatform lbi
266+ Platform _hostArch _hostOS = hostPlatform lbi
275267 vanillaLibFilePath = buildTargetDir </> makeRelativePathEx (mkLibName uid)
276268 profileLibFilePath = buildTargetDir </> makeRelativePathEx (mkProfLibName uid)
277269 sharedLibFilePath =
@@ -288,19 +280,6 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
288280 </> makeRelativePathEx (mkBytecodeLibName compiler_id uid)
289281 ghciLibFilePath = buildTargetDir </> makeRelativePathEx (Internal. mkGHCiLibName uid)
290282 ghciProfLibFilePath = buildTargetDir </> makeRelativePathEx (Internal. mkGHCiProfLibName uid)
291- libInstallPath =
292- libdir $
293- absoluteComponentInstallDirs
294- pkg_descr
295- lbi
296- uid
297- NoCopyDest
298- sharedLibInstallPath =
299- libInstallPath
300- </> mkSharedLibName (hostPlatform lbi) compiler_id uid
301- profSharedLibInstallPath =
302- libInstallPath
303- </> mkProfSharedLibName (hostPlatform lbi) compiler_id uid
304283
305284 getObjWayFiles :: BuildWay -> IO [SymbolicPath Pkg File ]
306285 getObjWayFiles w = getObjFiles (buildWayObjectExtension objExtension w) (buildWayObjectExtension objExtension w)
@@ -322,16 +301,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
322301 , pure $ map (srcObjPath obj_ext) extraSources
323302 , catMaybes
324303 <$> sequenceA
325- [ findFileCwdWithExtension
326- mbWorkDir
327- [Suffix obj_ext]
328- [buildTargetDir]
329- xPath
330- | ghcVersion < mkVersion [7 , 2 ] -- ghc-7.2+ does not make _stub.o files
331- , x <- allLibModules lib clbi
332- , let xPath :: RelativePath Artifacts File
333- xPath = makeRelativePathEx $ ModuleName. toFilePath x ++ " _stub"
334- ]
304+ []
335305 ]
336306
337307 -- Get the @.o@ path from a source path (e.g. @.hs@),
@@ -399,14 +369,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
399369 , ghcOptDynLinkMode = toFlag GhcDynamicOnly
400370 , ghcOptInputFiles = toNubListR $ map coerceSymbolicPath dynObjectFiles
401371 , ghcOptOutputFile = toFlag sharedLibFilePath
402- , -- For dynamic libs, Mac OS/X needs to know the install location
403- -- at build time. This only applies to GHC < 7.8 - see the
404- -- discussion in #1660.
405- ghcOptDylibName =
406- if hostOS == OSX
407- && ghcVersion < mkVersion [7 , 8 ]
408- then toFlag sharedLibInstallPath
409- else mempty
372+ , ghcOptDylibName = mempty
410373 , ghcOptLinkLibs = extraLibs libBi
411374 , ghcOptLinkLibPath = toNubListR cleanedExtraLibDirs
412375 , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD. frameworks libBi
@@ -425,14 +388,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
425388 , ghcOptDynLinkMode = toFlag GhcDynamicOnly
426389 , ghcOptInputFiles = toNubListR pdynObjectFiles
427390 , ghcOptOutputFile = toFlag profSharedLibFilePath
428- , -- For dynamic libs, Mac OS/X needs to know the install location
429- -- at build time. This only applies to GHC < 7.8 - see the
430- -- discussion in #1660.
431- ghcOptDylibName =
432- if hostOS == OSX
433- && ghcVersion < mkVersion [7 , 8 ]
434- then toFlag profSharedLibInstallPath
435- else mempty
391+ , ghcOptDylibName = mempty
436392 , ghcOptLinkLibs = extraLibs libBi
437393 , ghcOptLinkLibPath = toNubListR cleanedExtraLibDirs
438394 , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD. frameworks libBi
@@ -545,16 +501,11 @@ linkExecutable linkerOpts (way, buildOpts) targetDir targetName runGhcProg lbi =
545501 -- assume there is a main function in another non-haskell object
546502 ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty && ghcOptInputScripts baseOpts == mempty )
547503 }
548- comp = compiler lbi
549504
550505 -- Work around old GHCs not relinking in this
551506 -- situation, see #3294
552507 let target =
553508 targetDir </> makeRelativePathEx (exeTargetName (hostPlatform lbi) targetName)
554- when (compilerVersion comp < mkVersion [7 , 7 ]) $ do
555- let targetPath = interpretSymbolicPathLBI lbi target
556- e <- doesFileExist targetPath
557- when e (removeFile targetPath)
558509 runGhcProg linkOpts{ghcOptOutputFile = toFlag target}
559510
560511-- | Link a foreign library component
@@ -661,7 +612,7 @@ getRPaths pbci = do
661612 supportRPaths OSX = True
662613 supportRPaths FreeBSD =
663614 case compid of
664- CompilerId GHC ver | ver >= mkVersion [ 7 , 10 , 2 ] -> True
615+ CompilerId GHC _ver -> True
665616 _ -> False
666617 supportRPaths OpenBSD = False
667618 supportRPaths NetBSD = False
0 commit comments