summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-16 19:36:26 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-16 19:36:26 -0400
commit4b67ae596a133d285cc28593e26c47e5b14720c3 (patch)
treea9e9a81cf6f1b9a99db57a50cdcf8ff5a5df178c /Build
parenta7b290e6fa07fc17cdbd058cdaac98bb3f82294f (diff)
Linux standalone: Improved process names of linker shimmed programs.
Diffstat (limited to 'Build')
-rw-r--r--Build/LinuxMkLibs.hs29
1 files changed, 19 insertions, 10 deletions
diff --git a/Build/LinuxMkLibs.hs b/Build/LinuxMkLibs.hs
index 3fb757a22..9e829178c 100644
--- a/Build/LinuxMkLibs.hs
+++ b/Build/LinuxMkLibs.hs
@@ -44,31 +44,40 @@ mklibs top = do
-- Various files used by runshell to set up env vars used by the
-- linker shims.
writeFile (top </> "libdirs") (unlines libdirs)
- writeFile (top </> "linker")
- (Prelude.head $ filter ("ld-linux" `isInfixOf`) libs')
writeFile (top </> "gconvdir")
(parentDir $ Prelude.head $ filter ("/gconv/" `isInfixOf`) glibclibs)
- mapM_ (installLinkerShim top) exes
+ let linker = Prelude.head $ filter ("ld-linux" `isInfixOf`) libs'
+ mapM_ (installLinkerShim top linker) exes
{- Installs a linker shim script around a binary.
-
- Note that each binary is put into its own separate directory,
- to avoid eg git looking for binaries in its directory rather
- - than in PATH.-}
-installLinkerShim :: FilePath -> FilePath -> IO ()
-installLinkerShim top exe = do
- createDirectoryIfMissing True shimdir
+ - than in PATH.
+ -
+ - The linker is symlinked to a file with the same basename as the binary,
+ - since that looks better in ps than "ld-linux.so".
+ -}
+installLinkerShim :: FilePath -> FilePath -> FilePath -> IO ()
+installLinkerShim top linker exe = do
+ createDirectoryIfMissing True (top </> shimdir)
+ createDirectoryIfMissing True (top </> exedir)
renameFile exe exedest
+ link <- relPathDirToFile (top </> exedir) (top ++ linker)
+ unlessM (doesFileExist (top </> exelink)) $
+ createSymbolicLink link (top </> exelink)
writeFile exe $ unlines
[ "#!/bin/sh"
- , "exec \"$GIT_ANNEX_LINKER\" --library-path \"$GIT_ANNEX_LD_LIBRARY_PATH\" \"$GIT_ANNEX_SHIMMED/" ++ base ++ "/" ++ base ++ "\" \"$@\""
+ , "exec \"$GIT_ANNEX_DIR/" ++ exelink ++ "\" --library-path \"$GIT_ANNEX_LD_LIBRARY_PATH\" \"$GIT_ANNEX_DIR/shimmed/" ++ base ++ "/" ++ base ++ "\" \"$@\""
]
modifyFileMode exe $ addModes executeModes
where
base = takeFileName exe
- shimdir = top </> "shimmed" </> base
- exedest = shimdir </> base
+ shimdir = "shimmed" </> base
+ exedir = "exe"
+ exedest = top </> shimdir </> base
+ exelink = exedir </> base
{- Converting symlinks to hard links simplifies the binary shimming
- process. -}