project.cabal文件中的`stack install NAME`和`NAME`之间的区别是什么? [英] What's the difference between `stack install NAME` and `NAME` in the build-depends of project.cabal file?

查看:103
本文介绍了project.cabal文件中的`stack install NAME`和`NAME`之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在项目的<$ c $>部分中的 build-depends:部分下添加 package_name 之间有什么区别? c> .cabal文件,而不是执行堆栈安装package_name 在该项目的目录中?

解决方案

堆栈安装会将软件包安装到适当的位置(Stackage中库的当前快照数据库, ./。stack-work 用于其他库,〜/ .local / bin 或者您的系统对于可执行文件的等价物)。将库添加到 build-depends 中指定它作为项目的依赖项,并导致库在下次执行堆栈构建时被安装。如果你实际上在你的项目中使用了库,你必须将它添加到 build-depends 中,否则你将无法构建项目(甚至无法使用库使用 stack ghci )。



注意:从stack-0.1.3.1开始, stack安装NAME 只是堆栈构建的同义词--copy-bins NAME - copy-bins 选项告诉堆栈将任何可执行文件复制到〜/ .local / bin 。如果你的包只是一个没有可执行文件的库, stack install NAME stack build NAME 相同。 p>

What is the difference between adding package_name under the build-depends: section in a project's .cabal file, versus doing stack install package_name within that project's directory?

解决方案

stack install will just install the package to the appropriate place (the current snapshot database for libraries in Stackage, the sandbox in ./.stack-work for other libraries, ~/.local/bin or your system's equivalent thereof for executables). Adding a library to build-depends specifies it as a dependency of your project, and leads to the library being installed next time you do a stack build. If you are actually using the library in your project you must add it to build-depends, otherwise you won't be able to build the project (or even play with the library using stack ghci).

N.B.: As of stack-0.1.3.1, stack install NAME is just a synonym for stack build --copy-bins NAME. The --copy-bins option tells stack to copy any executables to ~/.local/bin. If your package is just a library with no executables, stack install NAME is the same as stack build NAME.

这篇关于project.cabal文件中的`stack install NAME`和`NAME`之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆