skip OSX libraries that do not exist in disk due to new cache

Addresses the build problem discussed here:
https://github.com/datalad/git-annex/issues/95

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-01-03 13:19:33 -04:00
parent 07191d7ba0
commit abeb7dcdde
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -1,6 +1,6 @@
{- OSX library copier
-
- Copyright 2012 Joey Hess <id@joeyh.name>
- Copyright 2012-2022 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -14,6 +14,7 @@ import Control.Monad
import Control.Monad.IfElse
import Data.List
import Control.Applicative
import System.Posix.Files
import Prelude
import Utility.PartialPrelude
@ -105,10 +106,17 @@ otool appbase installedbins replacement_libs libmap = do
-- _inflateValidate symbol. So, avoid bundling libz unless
-- this incompatability is resolved.
&& not ("libz." `isInfixOf` s)
lib_present s = ifM (isJust <$> catchMaybeIO (getSymbolicLinkStatus s))
( return True
, do
hPutStrLn stderr $ "note: skipping library that is not present on disk: " ++ s
return False
)
process c [] rls m = return (nub $ concat c, rls, m)
process c (file:rest) rls m = do
_ <- boolSystem "chmod" [Param "755", File file]
libs <- filter want . parseOtool
libs <- filterM lib_present
=<< filter want . parseOtool
<$> readProcess "otool" ["-L", file]
expanded_libs <- expand_rpath installedbins libs replacement_libs file
let rls' = nub $ rls ++ (zip libs expanded_libs)