Commit 92509493 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Use installOrdinaryFile and installExecutableFile in various places

instead of copyFileVerbose
parent b7e1664b
......@@ -941,8 +941,9 @@ installExe flags lbi installDirs pretendInstallDirs buildPref (progprefix, progs
let exeFileName = e <.> exeExtension
fixedExeBaseName = progprefix ++ e ++ progsuffix
installBinary dest = do
copyFileVerbose verbosity
(buildPref </> e </> exeFileName) (dest <.> exeExtension)
installExecutableFile verbosity
(buildPref </> e </> exeFileName)
(dest <.> exeExtension)
stripExe verbosity lbi exeFileName (dest <.> exeExtension)
if useWrapper
then do
......@@ -1001,7 +1002,7 @@ installLib flags lbi targetDir dynlibTargetDir builtDir
let verbosity = fromFlag (copyVerbosity flags)
copy src dst n = do
createDirectoryIfMissingVerbose verbosity True dst
copyFileVerbose verbosity (src </> n) (dst </> n)
installOrdinaryFile verbosity (src </> n) (dst </> n)
copyModuleFiles ext =
smartCopySources verbosity [builtDir] targetDir
(libModules pkg) [ext]
......
......@@ -55,7 +55,7 @@ import Distribution.Simple.LocalBuildInfo (
import Distribution.Simple.BuildPaths (haddockName, haddockPref)
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, copyDirectoryRecursiveVerbose
, copyFileVerbose, die, info, notice, matchDirFileGlob )
, installOrdinaryFile, die, info, notice, matchDirFileGlob )
import Distribution.Simple.Compiler
( CompilerFlavor(..), compilerFlavor )
import Distribution.Simple.Setup (CopyFlags(..), CopyDest(..), fromFlag)
......@@ -133,13 +133,13 @@ install pkg_descr lbi flags = do
exists <- doesFileExist haddockInterfaceFileSrc
when exists $ do
createDirectoryIfMissingVerbose verbosity True interfacePref
copyFileVerbose verbosity haddockInterfaceFileSrc
haddockInterfaceFileDest
installOrdinaryFile verbosity haddockInterfaceFileSrc
haddockInterfaceFileDest
let lfile = licenseFile pkg_descr
unless (null lfile) $ do
createDirectoryIfMissingVerbose verbosity True docPref
copyFileVerbose verbosity lfile (docPref </> takeFileName lfile)
installOrdinaryFile verbosity lfile (docPref </> takeFileName lfile)
let buildPref = buildDir lbi
when (hasLibs pkg_descr) $
......@@ -179,8 +179,8 @@ installDataFiles verbosity pkg_descr destDataDir =
files <- matchDirFileGlob srcDataDir file
let dir = takeDirectory file
createDirectoryIfMissingVerbose verbosity True (destDataDir </> dir)
sequence_ [ copyFileVerbose verbosity (srcDataDir </> file')
(destDataDir </> file')
sequence_ [ installOrdinaryFile verbosity (srcDataDir </> file')
(destDataDir </> file')
| file' <- files ]
-- | Install the files listed in install-includes
......@@ -192,7 +192,7 @@ installIncludeFiles verbosity
incs <- mapM (findInc relincdirs) (installIncludes lbi)
sequence_
[ do createDirectoryIfMissingVerbose verbosity True destDir
copyFileVerbose verbosity srcFile destFile
installOrdinaryFile verbosity srcFile destFile
| (relFile, srcFile) <- incs
, let destFile = destIncludeDir </> relFile
destDir = takeDirectory destFile ]
......
......@@ -71,7 +71,8 @@ import Distribution.Version ( anyVersion )
import Distribution.Package
( Package(..) )
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, copyFileVerbose, writeFileAtomic
( createDirectoryIfMissingVerbose, writeFileAtomic
, installOrdinaryFile, installExecutableFile
, die, info, intercalate )
import System.FilePath ( (</>) )
import Distribution.Verbosity
......@@ -181,7 +182,7 @@ installLib :: Verbosity -> FilePath -> FilePath -> PackageDescription -> Library
installLib verb dest build_dir pkg_descr _ = do
let p = display (packageId pkg_descr)++".hl"
createDirectoryIfMissingVerbose verb True dest
copyFileVerbose verb (build_dir </> p) (dest </> p)
installOrdinaryFile verb (build_dir </> p) (dest </> p)
installExe :: Verbosity -> FilePath -> FilePath -> (FilePath,FilePath) -> PackageDescription -> Executable -> IO ()
installExe verb dest build_dir (progprefix,progsuffix) _ exe = do
......@@ -189,5 +190,5 @@ installExe verb dest build_dir (progprefix,progsuffix) _ exe = do
src = exe_name </> exeExtension
out = (progprefix ++ exe_name ++ progsuffix) </> exeExtension
createDirectoryIfMissingVerbose verb True dest
copyFileVerbose verb (build_dir </> src) (dest </> out)
installExecutableFile verb (build_dir </> src) (dest </> out)
......@@ -71,7 +71,8 @@ import Distribution.Version
import Distribution.Package
( Package(..), packageName, packageVersion )
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, copyFileVerbose, writeFileAtomic
( createDirectoryIfMissingVerbose, writeFileAtomic
, installOrdinaryFile, installExecutableFile
, info, intercalate )
import Distribution.Verbosity
import Distribution.Text
......@@ -205,7 +206,7 @@ installLib :: Verbosity -> FilePath -> FilePath -> PackageDescription -> Library
installLib verb dest build_dir pkg_descr _ = do
let p = display (packageId pkg_descr)++".hl"
createDirectoryIfMissingVerbose verb True dest
copyFileVerbose verb (build_dir </> p) (dest </> p)
installOrdinaryFile verb (build_dir </> p) (dest </> p)
installExe :: Verbosity -> FilePath -> FilePath -> (FilePath,FilePath) -> PackageDescription -> Executable -> IO ()
installExe verb dest build_dir (progprefix,progsuffix) _ exe = do
......@@ -213,5 +214,4 @@ installExe verb dest build_dir (progprefix,progsuffix) _ exe = do
src = exe_name </> exeExtension
out = (progprefix ++ exe_name ++ progsuffix) </> exeExtension
createDirectoryIfMissingVerbose verb True dest
copyFileVerbose verb (build_dir </> src) (dest </> out)
installExecutableFile verb (build_dir </> src) (dest </> out)
......@@ -68,8 +68,9 @@ import Distribution.Simple.Program
nhcProgram, hmakeProgram, ldProgram, arProgram,
rawSystemProgramConf )
import Distribution.Simple.Utils
( die, info, findFileWithExtension,
createDirectoryIfMissingVerbose, copyFileVerbose, smartCopySources )
( die, info, findFileWithExtension
, installOrdinaryFile, installExecutableFile
, createDirectoryIfMissingVerbose, smartCopySources )
import Distribution.Version
( Version(..), anyVersion, orLaterVersion )
import Distribution.Verbosity
......@@ -247,8 +248,9 @@ installExe verbosity pref buildPref (progprefix,progsuffix) exe
let exeBaseName = exeName exe
exeFileName = exeBaseName <.> exeExtension
fixedExeFileName = (progprefix ++ exeBaseName ++ progsuffix) <.> exeExtension
copyFileVerbose verbosity (buildPref </> exeBaseName </> exeFileName)
(pref </> fixedExeFileName)
installExecutableFile verbosity
(buildPref </> exeBaseName </> exeFileName)
(pref </> fixedExeFileName)
-- |Install for nhc98: .hi and .a files
installLib :: Verbosity -- ^verbosity
......@@ -262,4 +264,4 @@ installLib verbosity pref buildPref pkgid lib
modules = exposedModules lib ++ otherModules bi
smartCopySources verbosity [buildPref] pref modules ["hi"]
let libName = mkLibName pkgid
copyFileVerbose verbosity (buildPref </> libName) (pref </> libName)
installOrdinaryFile verbosity (buildPref </> libName) (pref </> libName)
......@@ -83,7 +83,7 @@ import Distribution.InstalledPackageInfo
import qualified Distribution.Simple.LHC as LHC
import qualified Distribution.InstalledPackageInfo as IPI
import Distribution.Simple.Utils
( createDirectoryIfMissingVerbose, copyFileVerbose, writeFileAtomic
( createDirectoryIfMissingVerbose, installOrdinaryFile, writeFileAtomic
, die, info, notice, setupMessage )
import Distribution.System
( OS(..), buildOS )
......@@ -173,8 +173,8 @@ register pkg_descr lbi regFlags
when inplace $ die "--inplace is not supported with Hugs"
let installDirs = absoluteInstallDirs pkg_descr lbi NoCopyDest
createDirectoryIfMissingVerbose verbosity True (libdir installDirs)
copyFileVerbose verbosity (installedPkgConfigFile distPref)
(libdir installDirs </> "package.conf")
installOrdinaryFile verbosity (installedPkgConfigFile distPref)
(libdir installDirs </> "package.conf")
LHC -> do
(globalDir, userDir) <- LHC.getLhcLibDirsFromVersion (Just (compilerVersion (compiler lbi)))
let config_flags = [ "--force", "--global-conf="++globalDir </> "package.conf"
......
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