X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2FinstallPackage%2FinstallPackage.hs;h=2c3d245fc89014299b054a67032af4d6d594f32b;hb=bef67119f9d329f4d41abef55a67db6b9baad83b;hp=6bd24897a9f44ce04dc7dd33f9ad288ccfde8c53;hpb=5f3b727c6ed52fb7bdaeb6e51cef7acd04b1a3f3;p=ghc-hetmet.git diff --git a/utils/installPackage/installPackage.hs b/utils/installPackage/installPackage.hs index 6bd2489..2c3d245 100644 --- a/utils/installPackage/installPackage.hs +++ b/utils/installPackage/installPackage.hs @@ -1,4 +1,5 @@ +import Control.Monad import Data.Maybe import Distribution.PackageDescription import Distribution.PackageDescription.Parse @@ -22,8 +23,8 @@ main idatadir : idocdir : ihtmldir : ihaddockdir : args' -> case parseArgs args' of - (verbosity, distPref, enableShellWrappers) -> - doInstall verbosity distPref enableShellWrappers + (verbosity, distPref, enableShellWrappers, strip) -> + doInstall verbosity distPref enableShellWrappers strip ghcpkg ghcpkgconf destdir topdir iprefix ibindir ilibdir ilibexecdir idynlibdir idatadir idocdir ihtmldir @@ -35,21 +36,23 @@ main parseArgs :: [String] -> (Verbosity, -- verbosity FilePath, -- dist prefix - Bool) -- enable shell wrappers? -parseArgs = f normal defaultDistPref False - where f v dp esw (('-':'v':val):args) - = f (readEOrFail flagToVerbosity val) dp esw args - f v _ esw ("--distpref":dp:args) = f v dp esw args - f v dp _ ("--enable-shell-wrappers":args) = f v dp True args - f v dp esw [] = (v, dp, esw) - f _ _ _ args = error ("Bad arguments: " ++ show args) + Bool, -- enable shell wrappers? + Bool) -- strip exe? +parseArgs = f normal defaultDistPref False True + where f _ dp esw strip (('-':'v':val):args) + = f (readEOrFail flagToVerbosity val) dp esw strip args + f v _ esw strip ("--distpref":dp:args) = f v dp esw strip args + f v dp _ strip ("--enable-shell-wrappers":args) = f v dp True strip args + f v dp esw _ ("--disable-executable-stripping":args) = f v dp esw False args + f v dp esw strip [] = (v, dp, esw, strip) + f _ _ _ _ args = error ("Bad arguments: " ++ show args) -doInstall :: Verbosity -> FilePath -> Bool +doInstall :: Verbosity -> FilePath -> Bool -> Bool -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> IO () -doInstall verbosity distPref enableShellWrappers +doInstall verbosity distPref enableShellWrappers strip ghcpkg ghcpkgconf destdir topdir iprefix ibindir ilibdir ilibexecdir idynlibdir idatadir idocdir ihtmldir ihaddockdir = @@ -95,7 +98,8 @@ doInstall verbosity distPref enableShellWrappers htmldir = toPathTemplate' ihtmldir, haddockdir = toPathTemplate' ihaddockdir } - lbi_copy = lbi { installDirTemplates = i_copy } + lbi_copy = lbi { installDirTemplates = i_copy, + stripExes = strip } -- When we run GHC we give it a $topdir that includes the -- $compiler/lib/ part of libsubdir, so we only want the -- $pkgid part in the package.conf file. This is a bit of @@ -121,7 +125,11 @@ doInstall verbosity distPref enableShellWrappers lbi_reg = lbi { installDirTemplates = i_reg, withPrograms = progs' } (copyHook simpleUserHooks) pd lbi_copy userHooks copyFlags - (regHook simpleUserHooks) pd_reg lbi_reg userHooks registerFlags + -- Cabal prints a scary "Package contains no library to register" + -- message if we call register but this is an executable package. + -- We therefore don't call it if we don't have a library for it. + when (isJust (library pd_reg)) $ + (regHook simpleUserHooks) pd_reg lbi_reg userHooks registerFlags return () replaceTopdir :: FilePath -> FilePath -> FilePath