Why does "cabal sdist" not include all the "files needed for assembly"?

According to the wiki entry ,

It packs the files needed to create a project

I have a simple executable .cabalthat basically contains

Executable myprog
  hs-source-dirs: src
  main-is: MyMain.hs

and consists of some additional .hsfiles below src/outside src/MyMain.hs. For example, src/Utils.hsand several others.

cabal buildIt does not have problems with building myprogand compiles the required additional files .hsbelow src/, but cabal sdistdoes not create, thereby creating a dysfunctional source-archive. What am I doing wrong? How to tell cabal to include all source files below hs-source-dirs?

As a side note with GNU Autotools, there was a goal make distcheckthat first created the source tarball, and then tried to build the project through the newly created source archive, thereby ensuring that everything was in order. Is there something similar for cabalto make sure my source archive is installed?

+3
source share
1 answer

You must list the other Haskell files in the file .cabal, inside the stanza Executable.

  other-modules: Utils AFewOthers

Only the source files listed in your file are included in the distribution .cabal. Cabal has no other way to determine which source files are in your package. You can still build it because it cabal buildcalls ghc --make, and ghc will find and compile all the source files it needs.

+4
source

Source: https://habr.com/ru/post/1784370/


All Articles