
2013/10/16 Heinrich Apfelmus
I usually declare an "Executable" for each example and add a flag "buildExamples" that controls whether the examples are built or not. Here an example .cabal file.
http://hackage.haskell.org/package/threepenny-gui-0.3.0.0/threepenny-gui.cab...
I tried something similar in the past, but that didn't really work out: * Things get *extremely* verbose and repetitive in the .cabal file. Currently there are roughly 90 GLUT examples, and I expect to have much more in the future. This would lead to more than 1000 lines of boilerplate .cabal stuff. OK, Emacs macros and copy-n-paste are your friends, but... :-P * Can Cabal build the executables in parallel? Doing a parallel build of all examples via my make hack takes about 5 seconds, a non-parallel build takes 75 seconds, and I expect that gap to widen even more when I add more examples. * How does one handle common parts in the examples? (e.g. https://github.com/haskell-opengl/GLUT/tree/master/examples/RedBook8/common, more to come there) Conditionally build helper libraries just for the examples? I can't believe that I'm the only package maintainer who has such a problem, so I really hope that there is some hidden solution out there I simply can't see...