+8  A: 

From the wiki:

Since the code is cabalised, we can create a tarball with cabal-install directly (you can also use runhaskell Setup.hs sdist, but you need tar on your system 1):

$ cabal sdist
Building source dist for haq-0.0...
Source tarball created: dist/haq-0.0.tar.gz

This has the advantage that Cabal will do a bit more checking, and ensure that the tarball has the structure that HackageDB expects. Note that it does require the LICENSE file to exist. It packages up the files needed to build the project; to include other files (such as Test.hs in the above example, and our README), we need to add:

extra-source-files: Tests.hs README

to the .cabal file to have everything included.

Dan
Perfect! Thanks kindly. Especially for the extra-source-files tag!
Norman Ramsey
+4  A: 

Or if you're using darcs,

darcs dist

Note that 'cabal sdist' will only pick up files listed in the .cabal file, so you might need to add READMEs etc under "extra-source-files: "

You can check you've a valid tarball with

cabal check

which runs the same tests that Hackage will run.

Don Stewart
Say, how come you haven't asked any questions?
SamB
He's dons. He knows everything.
Thomas
darcs. rrrrrrr. But thanks for 'cabal check'!
Norman Ramsey