diff options
| author | Joey Hess <joey@kitenet.net> | 2014-05-14 19:41:05 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-05-14 19:41:05 -0400 |
| commit | 7115d1ec162b4059b3e8e8f84bd8d5898c1db025 (patch) | |
| tree | 42c1cce54e890e1d56484794ab33129132d8fee2 /Utility/LinuxMkLibs.hs | |
| parent | ffe371a9d42cded461236e972a24a142419d7fc4 (diff) | |
moved source code to src
This is to work around OSX's brain-damange regarding filename case
insensitivity.
Avoided moving config.hs, because it's a config file. Put in a symlink to
make build work.
Diffstat (limited to 'Utility/LinuxMkLibs.hs')
| -rw-r--r-- | Utility/LinuxMkLibs.hs | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/Utility/LinuxMkLibs.hs b/Utility/LinuxMkLibs.hs deleted file mode 100644 index 1dc4e1ea..00000000 --- a/Utility/LinuxMkLibs.hs +++ /dev/null @@ -1,61 +0,0 @@ -{- Linux library copier and binary shimmer - - - - Copyright 2013 Joey Hess <joey@kitenet.net> - - - - License: BSD-2-clause - -} - -module Utility.LinuxMkLibs where - -import Control.Applicative -import Data.Maybe -import System.Directory -import Data.List.Utils -import System.Posix.Files -import Data.Char -import Control.Monad.IfElse - -import Utility.PartialPrelude -import Utility.Directory -import Utility.Process -import Utility.Monad -import Utility.Path - -{- Installs a library. If the library is a symlink to another file, - - install the file it links to, and update the symlink to be relative. -} -installLib :: (FilePath -> FilePath -> IO ()) -> FilePath -> FilePath -> IO (Maybe FilePath) -installLib installfile top lib = ifM (doesFileExist lib) - ( do - installfile top lib - checksymlink lib - return $ Just $ parentDir lib - , return Nothing - ) - where - checksymlink f = whenM (isSymbolicLink <$> getSymbolicLinkStatus (inTop top f)) $ do - l <- readSymbolicLink (inTop top f) - let absl = absPathFrom (parentDir f) l - let target = relPathDirToFile (parentDir f) absl - installfile top absl - nukeFile (top ++ f) - createSymbolicLink target (inTop top f) - checksymlink absl - --- Note that f is not relative, so cannot use </> -inTop :: FilePath -> FilePath -> FilePath -inTop top f = top ++ f - -{- Parse ldd output, getting all the libraries that the input files - - link to. Note that some of the libraries may not exist - - (eg, linux-vdso.so) -} -parseLdd :: String -> [FilePath] -parseLdd = mapMaybe (getlib . dropWhile isSpace) . lines - where - getlib l = headMaybe . words =<< lastMaybe (split " => " l) - -{- Get all glibc libs and other support files, including gconv files - - - - XXX Debian specific. -} -glibcLibs :: IO [FilePath] -glibcLibs = lines <$> readProcess "sh" - ["-c", "dpkg -L libc6:$(dpkg --print-architecture) libgcc1:$(dpkg --print-architecture) | egrep '\\.so|gconv'"] |
