Commit 9a3896d2 authored by tulcod's avatar tulcod
Browse files

First create then rename symlinks to fix #4156

parent 49f2eac1
......@@ -1521,10 +1521,18 @@ installFLib verbosity lbi targetDir builtDir _pkg flib =
#ifndef mingw32_HOST_OS
-- createSymbolicLink file1 file2 creates a symbolic link
-- named file2 which points to the file file1.
-- Note that we do want a symlink to name rather than dst, because
-- the symlink will be relative to the directory it's created in.
createSymbolicLink name (dstDir </> flibBuildName lbi flib)
createSymbolicLink name (dstDir </> "lib" ++ nm <.> "so")
-- Note that we do want a symlink to 'name' rather than 'dst',
-- because the symlink will be relative to the directory it's created
-- in.
-- Finally, we first install in a temporary directory and then rename
-- to simulate a ln --force
withTempDirectory verbosity dstDir nm $ \tmpDir -> do
let link1 = flibBuildName lbi flib
link2 = "lib" ++ nm <.> "so"
createSymbolicLink name (tmpDir </> link1)
renameFile (tmpDir </> link1) (dstDir </> link1)
createSymbolicLink name (tmpDir </> link2)
renameFile (tmpDir </> link2) (dstDir </> link2)
where
nm :: String
nm = unUnqualComponentName $ foreignLibName flib
......
......@@ -26,6 +26,7 @@ main = setupAndCabalTest $ do
skipUnless =<< ghcVersionIs (>= mkVersion [7,8])
withPackageDb $ do
setup_install []
setup "copy" [] -- regression test #4156
dist_dir <- fmap testDistDir getTestEnv
lbi <- getLocalBuildInfoM
let installDirs = absoluteInstallDirs (localPkgDescr lbi) lbi NoCopyDest
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment