为什么“阴谋集团”是这样的?不包括所有“构建所需的文件”?
根据 wiki 条目,
它将构建项目所需的文件打包
我有一个简单的仅可执行文件.cabal
项目,它基本上包含
Executable myprog
hs-source-dirs: src
main-is: MyMain.hs
并由下面的一些附加.hs
文件组成<代码>src/超出src/MyMain.hs
。例如,src/Utils.hs
和其他一些。
cabal build
构建 myprog
没有问题,并编译 src/
下面所需的附加 .hs
文件,但是 < code>cabal sdist 没有,因此创建了一个功能失调的源代码压缩包。我做错了什么?我如何告诉 cabal 包含 hs-source-dirs 下面的所有源文件?
顺便说一句,GNU Autotools 有一个 make distcheck 目标,它首先构建一个源代码 tarball,然后尝试通过新生成的源代码 tarball 构建项目,从而确保一切都好。 cabal
是否有类似的东西,以确保我的源代码 tarball 是健全的?
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
does 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该在
Executable
节内的.cabal
文件中列出其他 Haskell 文件。该发行版仅包含
.cabal
文件中列出的源文件。 Cabal 没有其他方法来检测包中包含哪些源文件。您仍然可以构建,因为cabal build
调用ghc --make
,并且 ghc 会找到并编译它需要的所有源文件。You should list the other Haskell files in the
.cabal
file, inside theExecutable
stanza.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 becausecabal build
callsghc --make
, and ghc will find and compile all the source files it needs.