summaryrefslogtreecommitdiff
path: root/Build/OSXMkLibs.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-15 13:05:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-15 13:05:07 -0400
commit1d465e18bd4e1d5691b94dc61b96c1e02984b163 (patch)
treeeee90e8198ab8edb7c504c961a8cea3795d1571d /Build/OSXMkLibs.hs
parent1cf5e443c17af8c969857702ef06062ec21617b2 (diff)
fix install_name_tool library name replacement
Diffstat (limited to 'Build/OSXMkLibs.hs')
-rw-r--r--Build/OSXMkLibs.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/Build/OSXMkLibs.hs b/Build/OSXMkLibs.hs
index f6485aa01..5640e4d36 100644
--- a/Build/OSXMkLibs.hs
+++ b/Build/OSXMkLibs.hs
@@ -42,6 +42,7 @@ installLibs :: FilePath -> [(FilePath, FilePath)] -> LibMap -> IO ([FilePath], [
installLibs appbase replacement_libs libmap = do
(needlibs, replacement_libs', libmap') <- otool appbase replacement_libs libmap
libs <- forM needlibs $ \lib -> do
+ pathlib <- findLibPath lib
let shortlib = fromMaybe (error "internal") (M.lookup lib libmap')
let fulllib = dropWhile (== '/') lib
let dest = appbase </> fulllib
@@ -50,8 +51,8 @@ installLibs appbase replacement_libs libmap = do
( return Nothing
, do
createDirectoryIfMissing True (parentDir dest)
- putStrLn $ "installing " ++ lib ++ " as " ++ shortlib
- _ <- boolSystem "cp" [File lib, File dest]
+ putStrLn $ "installing " ++ pathlib ++ " as " ++ shortlib
+ _ <- boolSystem "cp" [File pathlib, File dest]
_ <- boolSystem "chmod" [Param "644", File dest]
_ <- boolSystem "ln" [Param "-s", File fulllib, File symdest]
return $ Just appbase
@@ -60,9 +61,9 @@ installLibs appbase replacement_libs libmap = do
{- Returns libraries to install.
-
- - Note that otool -L ignores DYLD_LIBRARY_PATH. But we do want to honor
- - that if set, so the library files found by otool are searched for on
- - that path.
+ - Note that otool -L ignores DYLD_LIBRARY_PATH, so the
+ - library files returned may need to be run through findLibPath
+ - to find the actual libraries to install.
-}
otool :: FilePath -> [(FilePath, FilePath)] -> LibMap -> IO ([FilePath], [(FilePath, FilePath)], LibMap)
otool appbase replacement_libs libmap = do
@@ -75,8 +76,7 @@ otool appbase replacement_libs libmap = do
process c [] rls m = return (nub $ concat c, rls, m)
process c (file:rest) rls m = do
_ <- boolSystem "chmod" [Param "755", File file]
- libs <- mapM findLibPath
- =<< filter want . parseOtool
+ libs <- filter want . parseOtool
<$> readProcess "otool" ["-L", file]
expanded_libs <- expand_rpath libs replacement_libs file
let rls' = nub $ rls ++ (zip libs expanded_libs)