summaryrefslogtreecommitdiff
path: root/Build/LinuxMkLibs.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Build/LinuxMkLibs.hs')
-rw-r--r--Build/LinuxMkLibs.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Build/LinuxMkLibs.hs b/Build/LinuxMkLibs.hs
index 0d47c4cb3..152c6b28d 100644
--- a/Build/LinuxMkLibs.hs
+++ b/Build/LinuxMkLibs.hs
@@ -36,6 +36,7 @@ main = getArgs >>= go
mklibs :: FilePath -> IO ()
mklibs top = do
fs <- dirContentsRecursive top
+ mapM_ symToHardLink fs
exes <- filterM checkExe fs
libs <- parseLdd <$> readProcess "ldd" exes
glibclibs <- glibcLibs
@@ -91,6 +92,15 @@ installLinkerShim top exe = do
shimdir = top </> "shimmed" </> base
exedest = shimdir </> base
+{- Converting symlinks to hard links simplifies the binary shimming
+ - process. -}
+symToHardLink :: FilePath -> IO ()
+symToHardLink f = whenM (isSymbolicLink <$> getSymbolicLinkStatus f) $ do
+ l <- readSymbolicLink f
+ let absl = absPathFrom (parentDir f) l
+ nukeFile f
+ createLink absl f
+
installFile :: FilePath -> FilePath -> IO ()
installFile top f = do
createDirectoryIfMissing True destdir