summaryrefslogtreecommitdiff
path: root/Build/OSXMkLibs.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-08 12:29:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-08 12:29:09 -0400
commit6c164967cbcce2423b669dff0175df9f802a6a34 (patch)
treead4532feff6a3726e83d630773474d94fae4c4a6 /Build/OSXMkLibs.hs
parent7d57f187c5d821c132f6d11c5c25500c5e886678 (diff)
move libs to try to fit within available path space
Diffstat (limited to 'Build/OSXMkLibs.hs')
-rw-r--r--Build/OSXMkLibs.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/Build/OSXMkLibs.hs b/Build/OSXMkLibs.hs
index fa5178988..45a86000b 100644
--- a/Build/OSXMkLibs.hs
+++ b/Build/OSXMkLibs.hs
@@ -36,15 +36,14 @@ installLibs :: FilePath -> IO [Maybe FilePath]
installLibs appbase = do
needlibs <- otool appbase
forM needlibs $ \lib -> do
- let libdir = parentDir lib
- let dest = appbase ++ lib
+ let dest = appbase </> takeFileName lib
ifM (doesFileExist dest)
( return Nothing
, do
- createDirectoryIfMissing True (appbase ++ libdir)
- _ <- boolSystem "cp" [File lib, File dest]
+ createDirectoryIfMissing True appbase
putStrLn $ "installing " ++ lib
- return $ Just libdir
+ _ <- boolSystem "cp" [File lib, File dest]
+ return $ Just appbase
)
{- Returns libraries to install. -}
@@ -52,10 +51,13 @@ otool :: FilePath -> IO [FilePath]
otool appbase = do
files <- filterM doesFileExist =<< dirContentsRecursive appbase
l <- forM files $ \file -> do
- libs <- parseOtool <$> readProcess "otool" ["-L", file]
+ libs <- filter unprocessed . parseOtool
+ <$> readProcess "otool" ["-L", file]
forM_ libs $ \lib -> install_name_tool file lib
return libs
return $ nub $ concat l
+ where
+ unprocessed s = not ("@executable_path" `isInfixOf` s)
parseOtool :: String -> [FilePath]
parseOtool = catMaybes . map parse . lines
@@ -74,7 +76,7 @@ install_name_tool binary lib = do
ok <- boolSystem "install_name_tool"
[ Param "-change"
, File lib
- , Param $ "@executable_path" ++ lib
+ , Param $ "@executable_path" ++ (dropFileName lib)
, File binary
]
unless ok $