如何在./configure中检查haskell软件包版本?
我如何告诉configure检查给定Haskell包的version >= xy
?
谢谢,
how can I tell configure to check for version >= x.y
of a given Haskell package?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用 cabalvchk: http://hackage.haskell.org/package/cabalvchk-0.2
例如,验证parsec 的版本 >= 0.4,您可以发出:
如果满足版本约束,则返回码将为零,否则返回非零。版本约束可以是阴谋集团理解的任何内容。可选的第三个参数可以不为空,以请求详细输出。
Use cabalvchk: http://hackage.haskell.org/package/cabalvchk-0.2
For example, to verify that the version of parsec is >= 0.4, you could issue:
The return code will be zero if the version constraint is satisfied and non-zero otherwise. The version constraint can be anything cabal understands. An optional third parameter can be non-blank to request verbose output.
我不太了解
configure
;你能要求它运行特定的命令吗?如果是这样,那么ghc-pkglatest
应该可以帮助您。例如,这是在我的机器上运行zlib
包:--global
应该用于系统范围的安装,对于特定于用户的安装根本没有标志装置。仅当您想要检查用户是否本地安装了软件包(可能会覆盖全局安装)时,才应使用--user
标志。除非您有理由不这样做,否则我建议放弃
configure
而转而使用cabal
。对于cabal
,这里的解决方案是首先在项目目录中执行cabal init
,然后检查.cabal
中是否有这样的行创建的文件:cabal
工具链是 Haskell 项目的标准(因为它自动化并简化了许多事情,包括依赖项追踪)。如果还有其他依赖项,您还可以要求cabal
调用configure
。如果您想了解更多相关信息,请提出一个单独的问题。I don't know much about
configure
; can you ask it to run a particular command? If so, thenghc-pkg latest
should help you out. For example, here's a run on my machine for thezlib
package:The
--global
should be used for system-wide installations, and no flag at all for user-specific installations. The--user
flag should only be used when you want to check whether a user has a local installation of a package (that may override the global one).Unless you have a reason not to, I recommend ditching
configure
in favor ofcabal
. Forcabal
, the solution here is to firstcabal init
in your project's directory, then check that you have a line like this in the.cabal
file that's created:The
cabal
toolchain is the standard for Haskell projects (because it automates and simplifies many things, including dependency-chasing). You can also askcabal
to invokeconfigure
if there are other dependencies. Open a separate question if you'd like more information about this.也许更好的问题是:你应该吗?检查特定版本号是 autoconf 世界中最重要的争论之一,而这场争论的最终胜利者是认为永远不应该这样做的一方。您需要 Haskell 的哪些具体功能?测试一下。作为一个简单的示例(与 haskell 无关),假设您的程序使用 inotify,因此您希望配置测试它是否可用。您可以测试内核版本是否 > 2.6.13,但是当 Joe 尝试在他的 2.4.xx 版本上构建您的程序(在该版本中他已经修补了 inotify 功能)时,他会因为您的程序无法运行而感到非常恼火。
你不关心 Haskell 是否 > xy 可用。相反,您希望在 xy 中引入 Haskell 的一些特定功能;测试该功能。
Perhaps the better question is: should you? Checking for a specific version number is one of the great arguments in the autoconf world, and the general winner of the debate is the side which says you should never do it. What specific feature of Haskell do you need? Test for that. As a simple example (unrelated to haskell), suppose your program uses inotify so you want the configury to test if it is available. You could just test if the kernel version is > 2.6.13, but then when Joe tries to build your program on his 2.4.xx version in which he has patched in inotify capability, he's going to be really irritated that your program won't work.
You do not care if Haskell > x.y is available. Instead, there is some specific feature of Haskell that you want that was introduced in x.y; test for that feature.
使用 ghc-pkg list,您可以按升序获取软件包的已安装版本列表。您应该希望能够过滤此列表以查找匹配项。 (我不知道如何使用
configure
来做到这一点,抱歉)。Using
ghc-pkg list
, you can get a list of installed versions of a package in ascending order. You should hopefully be able to filter through this list looking for a match. (I don't know how to do this withconfigure
, sorry).尝试这样的事情:
Try something like this: