How to create a suitable .tar.gz file for use with `cabal upload`?

The standard way to exchange the Haskell library with other programmers is to create the Cabal package and upload it to http://hackage.haskell.org . I wrote a library that I want to share, and I successfully created the Cabal package, using online recommendations for creating cabal files. I built the package and installed it locally - it works fine. Now I want to upload it to Hackage. But cabal upload wants the .tar.gz file. There are Cabal documentation error messages, and I cannot find what is supposed to be used in this .tar.gz or how I should create it.

Who knows or knows where I can find out how to create a .tar.gz that will work with cabal upload ?

+6
haskell haskell-platform cabal hackage
source share
2 answers

From the wiki :

Since the code is cabbalized, we can create a tarball using 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 little more validation and ensure that the tarball has the structure that HackageDB expects. Please note that this requires a LICENSE file. It packs the files needed to create a project; to include other files (e.g. Test.hs in the above example and our README), we need to add:

 extra-source-files: Tests.hs README 

into the .cabal file so that everything is included.

+12
source share

Or if you use darcs,

 darcs dist 

Note that cabal sdist will only collect the files listed in the .cabal file, so you may need to add README, etc. in extra-source-files:

You can check that you have a valid tarball with

 cabal check 

which runs the same tests as Hackage.

+4
source share

All Articles