@@ -51,8 +51,6 @@ import Distribution.Version
5151import System.Directory
5252 ( createDirectoryIfMissing
5353 , doesDirectoryExist
54- , doesFileExist
55- , removeFile
5654 , renameFile
5755 )
5856import System.FilePath
@@ -260,18 +258,17 @@ linkLibrary
260258 -> [BuildWay ]
261259 -- ^ Wanted build ways and corresponding build options
262260 -> IO ()
263- linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do
261+ linkLibrary buildTargetDir cleanedExtraLibDirs _pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do
264262 let
265263 common = configCommonFlags $ configFlags lbi
266264 mbWorkDir = flagToMaybe $ setupWorkingDir common
267265
268266 compiler_id = compilerId comp
269267 comp = compiler lbi
270- ghcVersion = compilerVersion comp
271268 implInfo = getImplInfo comp
272269 uid = componentUnitId clbi
273270 libBi = libBuildInfo lib
274- Platform _hostArch hostOS = hostPlatform lbi
271+ Platform _hostArch _hostOS = hostPlatform lbi
275272 vanillaLibFilePath = buildTargetDir </> makeRelativePathEx (mkLibName uid)
276273 profileLibFilePath = buildTargetDir </> makeRelativePathEx (mkProfLibName uid)
277274 sharedLibFilePath =
@@ -288,19 +285,6 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
288285 </> makeRelativePathEx (mkBytecodeLibName compiler_id uid)
289286 ghciLibFilePath = buildTargetDir </> makeRelativePathEx (Internal. mkGHCiLibName uid)
290287 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
304288
305289 getObjWayFiles :: BuildWay -> IO [SymbolicPath Pkg File ]
306290 getObjWayFiles w = getObjFiles (buildWayObjectExtension objExtension w) (buildWayObjectExtension objExtension w)
@@ -322,16 +306,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
322306 , pure $ map (srcObjPath obj_ext) extraSources
323307 , catMaybes
324308 <$> 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- ]
309+ []
335310 ]
336311
337312 -- Get the @.o@ path from a source path (e.g. @.hs@),
@@ -399,14 +374,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
399374 , ghcOptDynLinkMode = toFlag GhcDynamicOnly
400375 , ghcOptInputFiles = toNubListR $ map coerceSymbolicPath dynObjectFiles
401376 , 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
377+ , ghcOptDylibName = mempty
410378 , ghcOptLinkLibs = extraLibs libBi
411379 , ghcOptLinkLibPath = toNubListR cleanedExtraLibDirs
412380 , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD. frameworks libBi
@@ -425,14 +393,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li
425393 , ghcOptDynLinkMode = toFlag GhcDynamicOnly
426394 , ghcOptInputFiles = toNubListR pdynObjectFiles
427395 , 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
396+ , ghcOptDylibName = mempty
436397 , ghcOptLinkLibs = extraLibs libBi
437398 , ghcOptLinkLibPath = toNubListR cleanedExtraLibDirs
438399 , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD. frameworks libBi
@@ -545,16 +506,11 @@ linkExecutable linkerOpts (way, buildOpts) targetDir targetName runGhcProg lbi =
545506 -- assume there is a main function in another non-haskell object
546507 ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty && ghcOptInputScripts baseOpts == mempty )
547508 }
548- comp = compiler lbi
549509
550510 -- Work around old GHCs not relinking in this
551511 -- situation, see #3294
552512 let target =
553513 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)
558514 runGhcProg linkOpts{ghcOptOutputFile = toFlag target}
559515
560516-- | Link a foreign library component
@@ -661,7 +617,7 @@ getRPaths pbci = do
661617 supportRPaths OSX = True
662618 supportRPaths FreeBSD =
663619 case compid of
664- CompilerId GHC ver | ver >= mkVersion [ 7 , 10 , 2 ] -> True
620+ CompilerId GHC _ver -> True
665621 _ -> False
666622 supportRPaths OpenBSD = False
667623 supportRPaths NetBSD = False
0 commit comments