summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-08-09 09:55:11 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-13 21:47:26 -0400
commit0bf8e73ad6d8614a53dd6fad7851135d56b59c10 (patch)
tree3497e7da920471f2a10e9895f4ba029e3948ebd2
parent9d4ba36f1de7ced62e2c0c6a911411144e9a3b27 (diff)
downloadhaskell-0bf8e73ad6d8614a53dd6fad7851135d56b59c10.tar.gz
Revert "hadrian: Make copyFileLinked a bit more robust"
This reverts commit d45e3cda669c5822aa213d42bf7f7c551b9d1bbf.
-rw-r--r--hadrian/src/Hadrian/Utilities.hs12
-rw-r--r--hadrian/src/Rules/Rts.hs13
2 files changed, 11 insertions, 14 deletions
diff --git a/hadrian/src/Hadrian/Utilities.hs b/hadrian/src/Hadrian/Utilities.hs
index 50639db68a..8bcfa6f974 100644
--- a/hadrian/src/Hadrian/Utilities.hs
+++ b/hadrian/src/Hadrian/Utilities.hs
@@ -295,23 +295,23 @@ isGeneratedSource file = buildRoot <&> (`isPrefixOf` file)
-- missing.
createFileLink :: FilePath -> FilePath -> Action ()
createFileLink linkTarget link
- | windowsHost = copyFile' linkTarget link
+ | windowsHost = copyFile' source link
| otherwise = do
-- TODO `disableHistory` is a temporary fix (see issue #16866). Remove
-- `disableHistory` when shake issue is fixed: https://github.com/ndmitchell/shake/issues/683.
historyDisable
- need [linkTarget]
+
+ need [source]
liftIO $ IO.createDirectoryIfMissing True dir
putProgressInfo =<< renderCreateFileLink linkTarget link
quietly . liftIO $ do
IO.removeFile link <|> return ()
- -- This should perhaps use top instead but that is tricky due to
- -- module cycles
- abs_target <- IO.canonicalizePath linkTarget
- IO.createFileLink abs_target link
+ IO.createFileLink linkTarget link
where dir = takeDirectory link
+ source | isAbsolute linkTarget = linkTarget
+ | otherwise = takeDirectory link -/- linkTarget
-- | Copy a file tracking the source. Create the target directory if missing.
copyFile :: FilePath -> FilePath -> Action ()
diff --git a/hadrian/src/Rules/Rts.hs b/hadrian/src/Rules/Rts.hs
index 3e0c94f24d..efcd5f614a 100644
--- a/hadrian/src/Rules/Rts.hs
+++ b/hadrian/src/Rules/Rts.hs
@@ -17,11 +17,9 @@ rtsRules = priority 3 $ do
root -/- "**/libHSrts_*-ghc*.dylib",
root -/- "**/libHSrts-ghc*.so",
root -/- "**/libHSrts-ghc*.dylib"]
- |%> \ rtsLibFilePath' -> do
- let (dir, name) = splitFileName rtsLibFilePath'
- createFileLink
- (dir -/- (addRtsDummyVersion name))
- rtsLibFilePath'
+ |%> \ rtsLibFilePath' -> createFileLink
+ (addRtsDummyVersion $ takeFileName rtsLibFilePath')
+ rtsLibFilePath'
-- Libffi
forM_ [Stage1 ..] $ \ stage -> do
@@ -65,8 +63,7 @@ copyLibffiStatic stage target = withLibffi stage $ \ libffiPath _ -> do
vanillaLibFile <- rtsLibffiLibrary stage vanilla
if target == vanillaLibFile
then copyFile' (libffiPath -/- libffiLibrary) target
- else do
- createFileLink (takeDirectory target -/- takeFileName vanillaLibFile) target
+ else createFileLink (takeFileName vanillaLibFile) target
-- | Copy a dynamic library file from the libffi build dir to the rts build dir.
@@ -91,7 +88,7 @@ copyLibffiDynamicUnix stage libSuf target = do
, "-id", "@rpath/" ++ takeFileName target
, target
]
- else createFileLink (takeDirectory target -/- versionlessSourceFileName) target
+ else createFileLink versionlessSourceFileName target
-- | Copy a dynamic library file from the libffi build dir to the rts build dir.
copyLibffiDynamicWin :: Stage -> FilePath -> Action ()