Subject: Bug#337909: ghc6: regression in Cabal
From: Matej Vela <[email-masked]>
To: [email-masked]
Date: Mon, 07 Nov 2005 09:19:41 +0100

Package: ghc6
Version: 6.4.1-1
Severity: serious
Justification: causes an FTBFS for haskelldb, washngo
Tags: upstream patch

The following upstream change in 6.4.1 breaks packages that build
executables with HS-Source-Dir:

--- ghc6-6.4/libraries/Cabal/Distribution/Simple/Install.hs
+++ ghc6-6.4.1/libraries/Cabal/Distribution/Simple/Install.hs
@@ -107,8 +107,9 @@
               -> PackageDescription -> IO ()
 installExeGhc verbose pref buildPref pkg_descr
     = do createDirectoryIfMissing True pref
-         withExe pkg_descr $ \ (Executable e _ b) ->
-             copyFileVerbose verbose (buildPref `joinFileName` (hsSourceDir b) `joinFileName` e) (pref `joinFileName` e)
+         withExe pkg_descr $ \ (Executable e _ b) -> do
+             let exeName = e `joinFileExt` exeExtension
+             copyFileVerbose verbose (buildPref `joinFileName` exeName) (pref `joinFileName` exeName)
 
 -- |Install for ghc, .hi and .a
 installLibGHC :: Int      -- ^verbose

The new code looks for executables in dist/build/<exeName> rather than
dist/build/<HS-Source-Dir>/<exeName> where they are built, and the
installation phase breaks.  Patch attached.

Thanks,

Matej
--- ghc6-6.4.1.dist/libraries/Cabal/Distribution/Simple/Install.hs
+++ ghc6-6.4.1/libraries/Cabal/Distribution/Simple/Install.hs
@@ -109,7 +109,7 @@
     = do createDirectoryIfMissing True pref
          withExe pkg_descr $ \ (Executable e _ b) -> do
              let exeName = e `joinFileExt` exeExtension
-             copyFileVerbose verbose (buildPref `joinFileName` exeName) (pref `joinFileName` exeName)
+             copyFileVerbose verbose (buildPref `joinFileName` (hsSourceDir b) `joinFileName` exeName) (pref `joinFileName` exeName)
 
 -- |Install for ghc, .hi and .a
 installLibGHC :: Int      -- ^verbose