X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2FinstallPackage%2FinstallPackage.hs;h=2c3d245fc89014299b054a67032af4d6d594f32b;hb=0e5f01904f7df065547e1558df8917c11f676f77;hp=3e86ff0e3d581c21cba887b7218b80af7e2b1040;hpb=4ddcff11bae7e4c66c3c895b277eb8b2230aea67;p=ghc-hetmet.git diff --git a/utils/installPackage/installPackage.hs b/utils/installPackage/installPackage.hs index 3e86ff0..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 @@ -38,11 +39,11 @@ parseArgs :: [String] Bool, -- enable shell wrappers? Bool) -- strip exe? parseArgs = f normal defaultDistPref False True - where f v dp esw strip (('-':'v':val):args) + 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 strip ("--disable-executable-stripping":args) = f v dp esw False 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) @@ -124,7 +125,11 @@ doInstall verbosity distPref enableShellWrappers strip 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