install libs in subdirs again

This commit is contained in:
Joey Hess 2012-12-09 13:42:30 -04:00
parent a2a0a71e2b
commit ad488c23ac

View file

@ -15,7 +15,6 @@ import System.Directory
import System.IO import System.IO
import Control.Monad import Control.Monad
import Data.List import Data.List
import Data.String.Utils
import Utility.PartialPrelude import Utility.PartialPrelude
import Utility.Directory import Utility.Directory
@ -42,13 +41,13 @@ 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 shortlib = fromMaybe (error "internal") (M.lookup lib libmap') let shortlib = fromMaybe (error "internal") (M.lookup lib libmap')
let fulllib = replace "/" "_" lib let fulllib = dropWhile (== '/') lib
let dest = appbase </> fulllib let dest = appbase </> fulllib
let symdest = appbase </> shortlib let symdest = appbase </> shortlib
ifM (doesFileExist dest) ifM (doesFileExist dest)
( return Nothing ( return Nothing
, do , do
createDirectoryIfMissing True appbase createDirectoryIfMissing True (parentDir fulllib)
putStrLn $ "installing " ++ lib ++ " as " ++ shortlib putStrLn $ "installing " ++ lib ++ " as " ++ shortlib
_ <- boolSystem "cp" [File lib, File dest] _ <- boolSystem "cp" [File lib, File dest]
_ <- boolSystem "chmod" [Param "644", File dest] _ <- boolSystem "chmod" [Param "644", File dest]