Commit 839e2a11 authored by Daniel Gröber (dxld)'s avatar Daniel Gröber (dxld)
Browse files

Install exes with 'scope: private' into $libexec

parent 20237d43
......@@ -1473,15 +1473,14 @@ componentCcGhcOptions verbosity lbi =
-- |Install executables for GHC.
installExe :: Verbosity
-> LocalBuildInfo
-> InstallDirs FilePath -- ^Where to copy the files to
-> FilePath -- ^Where to copy the files to
-> FilePath -- ^Build location
-> (FilePath, FilePath) -- ^Executable (prefix,suffix)
-> PackageDescription
-> Executable
-> IO ()
installExe verbosity lbi installDirs buildPref
installExe verbosity lbi binDir buildPref
(progprefix, progsuffix) _pkg exe = do
let binDir = bindir installDirs
createDirectoryIfMissingVerbose verbosity True binDir
let exeName' = unUnqualComponentName $ exeName exe
exeFileName = exeTargetName exe
......
......@@ -747,15 +747,14 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir _pkg lib clbi = do
installExe :: Verbosity
-> LocalBuildInfo
-> InstallDirs FilePath -- ^Where to copy the files to
-> FilePath -- ^Where to copy the files to
-> FilePath -- ^Build location
-> (FilePath, FilePath) -- ^Executable (prefix,suffix)
-> PackageDescription
-> Executable
-> IO ()
installExe verbosity lbi installDirs buildPref
installExe verbosity lbi binDir buildPref
(progprefix, progsuffix) _pkg exe = do
let binDir = bindir installDirs
createDirectoryIfMissingVerbose verbosity True binDir
let exeName' = unUnqualComponentName $ exeName exe
exeFileName = exeName'
......
......@@ -27,6 +27,7 @@ import Distribution.Types.LocalBuildInfo
import Distribution.Types.ForeignLib
import Distribution.Types.PackageDescription
import Distribution.Types.UnqualComponentName
import Distribution.Types.ExecutableScope
import Distribution.Package
import Distribution.PackageDescription
......@@ -199,25 +200,28 @@ copyComponent verbosity pkg_descr lbi (CFLib flib) clbi copydest = do
++ " is not implemented"
copyComponent verbosity pkg_descr lbi (CExe exe) clbi copydest = do
let installDirs@InstallDirs {
bindir = binPref
} = absoluteComponentInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
let installDirs = absoluteComponentInstallDirs pkg_descr lbi (componentUnitId clbi) copydest
-- the installers know how to find the actual location of the
-- binaries
buildPref = buildDir lbi
uid = componentUnitId clbi
progPrefixPref = substPathTemplate (packageId pkg_descr) lbi uid (progPrefix lbi)
progSuffixPref = substPathTemplate (packageId pkg_descr) lbi uid (progSuffix lbi)
noticeNoWrap verbosity ("Installing executable " ++ display (exeName exe) ++ " in " ++ binPref)
pkgid = packageId pkg_descr
binPref | ExecutablePrivate <- exeScope exe = libexecdir installDirs
| otherwise = bindir installDirs
progPrefixPref = substPathTemplate pkgid lbi uid (progPrefix lbi)
progSuffixPref = substPathTemplate pkgid lbi uid (progSuffix lbi)
progFix = (progPrefixPref, progSuffixPref)
noticeNoWrap verbosity ("Installing executable " ++ display (exeName exe)
++ " in " ++ binPref)
inPath <- isInSearchPath binPref
when (not inPath) $
warn verbosity ("The directory " ++ binPref
++ " is not in the system search path.")
case compilerFlavor (compiler lbi) of
GHC -> GHC.installExe verbosity lbi installDirs buildPref (progPrefixPref, progSuffixPref) pkg_descr exe
GHCJS -> GHCJS.installExe verbosity lbi installDirs buildPref (progPrefixPref, progSuffixPref) pkg_descr exe
LHC -> LHC.installExe verbosity lbi installDirs buildPref (progPrefixPref, progSuffixPref) pkg_descr exe
JHC -> JHC.installExe verbosity binPref buildPref (progPrefixPref, progSuffixPref) pkg_descr exe
GHC -> GHC.installExe verbosity lbi binPref buildPref progFix pkg_descr exe
GHCJS -> GHCJS.installExe verbosity lbi binPref buildPref progFix pkg_descr exe
LHC -> LHC.installExe verbosity lbi binPref buildPref progFix pkg_descr exe
JHC -> JHC.installExe verbosity binPref buildPref progFix pkg_descr exe
UHC -> return ()
HaskellSuite {} -> return ()
_ -> die' verbosity $ "installing with "
......
......@@ -669,14 +669,13 @@ mkGHCiLibName lib = getHSLibraryName lib <.> "o"
-- |Install executables for GHC.
installExe :: Verbosity
-> LocalBuildInfo
-> InstallDirs FilePath -- ^Where to copy the files to
-> FilePath -- ^Where to copy the files to
-> FilePath -- ^Build location
-> (FilePath, FilePath) -- ^Executable (prefix,suffix)
-> PackageDescription
-> Executable
-> IO ()
installExe verbosity lbi installDirs buildPref (progprefix, progsuffix) _pkg exe = do
let binDir = bindir installDirs
installExe verbosity lbi binDir buildPref (progprefix, progsuffix) _pkg exe = do
createDirectoryIfMissingVerbose verbosity True binDir
let exeFileName = unUnqualComponentName (exeName exe) <.> exeExtension
fixedExeBaseName = progprefix ++ unUnqualComponentName (exeName exe) ++ progsuffix
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment