install libs using short names, with symlinks to we can tell what libraries

they are supposed to be
This commit is contained in:
Joey Hess 2012-12-09 12:20:00 -04:00
parent 1c2da18b0b
commit c6d570a1cc

View file

@ -41,14 +41,17 @@ installLibs :: FilePath -> LibMap -> IO ([FilePath], LibMap)
installLibs appbase libmap = do installLibs appbase libmap = do
(needlibs, libmap') <- otool appbase libmap (needlibs, libmap') <- otool appbase libmap
libs <- forM needlibs $ \lib -> do libs <- forM needlibs $ \lib -> do
let dest = appbase </> takeFileName lib let shortlib = fromMaybe (error "internal") (M.lookup lib libmap')
let dest = appbase </> shortlib
let symdest = appbase </> takeFileName lib
ifM (doesFileExist dest) ifM (doesFileExist dest)
( return Nothing ( return Nothing
, do , do
createDirectoryIfMissing True appbase createDirectoryIfMissing True appbase
putStrLn $ "installing " ++ lib putStrLn $ "installing " ++ lib ++ " as " ++ dest
_ <- boolSystem "cp" [File lib, File dest] _ <- boolSystem "cp" [File lib, File dest]
_ <- boolSystem "chmod" [Param "644", File dest] _ <- boolSystem "chmod" [Param "644", File dest]
_ <- boolSystem "ln" [Param "-s", File shortlib, File symdest]
return $ Just appbase return $ Just appbase
) )
return (catMaybes libs, libmap') return (catMaybes libs, libmap')