Hi all, I've been trying to resolve a compile time issue[1] with
wxHaskell, and I thought I'd throw it open to see if anyone on cafe
can help.
Here's the crux of the issue:

The Setup.hs for wxcore (the major component of wxHaskell) uses
"simpleUserHooks", overriding only "confHook".
However there is also "cleanHook", which is defined by simpleUserHooks to be:
 cleanHook = \p _ _ f -> clean p f,

If you consult the source for clean[2] you'll see that it tries to
"remove the whole dist/ directory rather than tracking exactly what
files we created in there". I presume that's why we have to do a full
re-build every time?

To try and circumvent this I modified the definition of "main" in
Setup.hs to this:
main = defaultMainWithHooks simpleUserHooks { confHook = myConfHook,
cleanHook = (\_ _ _ _ -> return ())}

Unfortunately it still seems to re-build all the C++ on each 'install'
from cabal.
Not sure why?

Dave,


[1] http://sourceforge.net/mailarchive/message.php?msg_id=28099997

[2] Taken from 
http://www.haskell.org/ghc/docs/6.10.4/html/libraries/Cabal/src/Distribution-Simple.html#simpleUserHooks
-- Cleaning

clean :: PackageDescription -> CleanFlags -> IO ()
clean pkg_descr flags = do
    let distPref = fromFlag $ cleanDistPref flags
    notice verbosity "cleaning..."

    maybeConfig <- if fromFlag (cleanSaveConf flags)
                     then maybeGetPersistBuildConfig distPref
                     else return Nothing

    -- remove the whole dist/ directory rather than tracking exactly what files
    -- we created in there.
    chattyTry "removing dist/" $ do
      exists <- doesDirectoryExist distPref
      when exists (removeDirectoryRecursive distPref)

    -- these live in the top level dir so must be removed separately
    removeRegScripts

    -- Any extra files the user wants to remove
    mapM_ removeFileOrDirectory (extraTmpFiles pkg_descr)

    -- If the user wanted to save the config, write it back
    maybe (return ()) (writePersistBuildConfig distPref) maybeConfig

  where
        removeFileOrDirectory :: FilePath -> IO ()
        removeFileOrDirectory fname = do
            isDir <- doesDirectoryExist fname
            isFile <- doesFileExist fname
            if isDir then removeDirectoryRecursive fname
              else if isFile then removeFile fname
              else return ()
        verbosity = fromFlag (cleanVerbosity flags)

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to