On 16 September 2011 23:30, Dave Tapley <duked...@gmail.com> wrote:

> I presume everyone has a very long compile time when building wxcore?
> Specifically rebuilding everything under src/cpp/ every time..
>
> Has anyone ever looked into avoiding this complete rebuild?
>

I've just spent a few hours looking deeper in to this and come across two
issues:

1. There is a very informative blog post[1] written by Jeremy, which deals
with the subject of "Compiling C or C++ code from within Cabal".
Unfortunately I can't find any of the code mentioned in the post in the
project, specifically I tried to find a "myBuildHook" in "./wxcore/Setup.hs"
(I also looked in previous revisions using a trackdown grep[2]) but I didn't
find anything. Perhaps someone with better knowledge of the project can
comment on if/where/when the code in the post was used?

2. Inspecting the wxdirect code you can see that "System.IO.writeFile" is
used to write all the generated code[3], but no test is performed to see if
the output file has actually changed. Thus the file is always opened for
write, and so its modification time is changed, and so everything is
recompiled every time wxcore is built. I have have written a local patch
which replaces the "writeFile" function with one which first checks whether
the string to be written differs (aside from date/time stamp) to the current
one; it only performs the "writeFile" if there has been a change.
Using this patch none of the Haskell code is re-built, but unfortunately all
the C++ code is.

Dave,


[1]
http://wewantarock.wordpress.com/2010/11/03/building-a-shared-library-in-cabal/
[2] http://darcs.net/manual/Darcs_commands.html#SECTION006112100000000000000
[3] All files are under ./wxdirect/src/:
./CompileDefs.hs:
       writeFile outputFile (unlines (prologue ++ export ++ haskellDefs))
./CompileSTC.hs:
  writeFile h_target $ (glue "\n\n" $ map headerfunc f) ++ "\n"
./CompileSTC.hs:
  writeFile cpp_target $ (glue "\n" $ map cppfunc f) ++ "\n"
./CompileClasses.hs:
       writeFile (outputFile ++ ".hs") output
./CompileClasses.hs:
       writeFile (outputFile ++ ".hs") output
./CompileClassTypes.hs:
       writeFile outputFile output
./CompileHeader.hs:
       writeFile outputFile output
./ParseEiffel.hs:
       writeFile "../../wxh/Graphics/UI/WXH/WxcDefs.hs" (unlines
haskellDefs)
./CompileClassInfo.hs:
       writeFile outputFile (unlines (prologue ++ export ++ classDefs ++
downcDefs))
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
wxhaskell-devel mailing list
wxhaskell-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel

Reply via email to