Why does "cabal sdist" not include all "files needed to build"?
According to the wiki entry,
It packages up the files needed to build the project
I have a simple executables-only .cabal
project, which basically contains
Executable myprog
hs-source-dirs: src
main-is: MyMain.hs
and is made up of some additional .hs
files below src/
beyond src/MyMain.hs
. E.g., src/Utils.hs
and a few others.
cabal build
has no problems building myprog
, and compiles the required additional .hs
files below src/
, but cabal sdist
doe开发者_JS百科s not, thus creating a dysfunctional source-tarball. What am I doing wrong? How do I tell cabal to include all source files below hs-source-dirs?
As a side-note, with GNU Autotools, there was a make distcheck
target, which would first build a source-tarball, and then try to build the project via the newly generated source-tarball, thus ensuring everything's ok. Is there something similar for cabal
, in order to make sure my source-tarball is sound?
You should list the other Haskell files in the .cabal
file, inside the Executable
stanza.
other-modules: Utils AFewOthers
The distribution only includes source files that are listed in your .cabal
file. Cabal has no other way to detect which source files are in your package. You could still build because cabal build
calls ghc --make
, and ghc will find and compile all the source files it needs.
精彩评论