handle rpath in OSXMkLibs

Now oberon has some binaries and libraries that use rpath, so I had to put
in this ugly hack to replace the @rapth/lib with the lib in the app.

This was particularly tricky for libraries that use @rpath because I could
not find a way to extract the rpath from the library. (Only from the
executable, by running it.. ugh!) The hack I put in place may fail if
multiple different libraries use rpath to refer to other libraries,
and the "@rpath/lib" string is the same, but actually refers to different
files.
This commit is contained in:
Joey Hess 2013-04-22 13:33:29 -04:00
parent 78868866de
commit b9341fd4c0
2 changed files with 59 additions and 25 deletions

View file

@ -60,12 +60,15 @@ progDir topdir = topdir
progDir topdir = topdir </> "bin"
#endif
installProg :: FilePath -> FilePath -> IO ()
installProg :: FilePath -> FilePath -> IO (FilePath, FilePath)
installProg dir prog = searchPath prog >>= go
where
go Nothing = error $ "cannot find " ++ prog ++ " in PATH"
go (Just f) = unlessM (boolSystem "install" [File f, File dir]) $
error $ "install failed for " ++ prog
go (Just f) = do
let dest = dir </> takeFileName f
unlessM (boolSystem "install" [File f, File dest]) $
error $ "install failed for " ++ prog
return (dest, f)
main = getArgs >>= go
where
@ -73,5 +76,5 @@ main = getArgs >>= go
go (topdir:_) = do
let dir = progDir topdir
createDirectoryIfMissing True dir
forM_ thirdpartyProgs $ installProg dir
installed <- forM thirdpartyProgs $ installProg dir
writeFile "tmp/standalone-installed" (show installed)