简体   繁体   English

如何将cabal配置为对32位和64位软件包使用不同的文件夹?

[英]How can I configure cabal to use different folders for 32-bit and 64-bit packages?

I'm doing some testing of 64-bit GHC on Windows, in tandem with migrating code forward to GHC 7.6.1. 我正在对Windows上的64位GHC进行一些测试,同时将代码迁移到GHC 7.6.1。 This means that I have both the 32-bit and 64-bit versions of GHC 7.6.1 installed, so I can distinguish 64-bit specific problems from general problems with 7.6.1. 这意味着我同时安装了32位和64位版本的GHC 7.6.1,因此我可以将7.6.1的64位特定问题与一般问题区分开。

My cabal config file ( $APPDATA/cabal/config ) contains 我的阴谋配置文件( $APPDATA/cabal/config )包含

libsubdir: $pkgid\$compiler

which means that both 32-bit and 64-bit versions of packages I install are ending up in eg zip-archive-0.1.1.8/ghc-7.6.1, and overwriting each other. 这意味着我安装的32位和64位版本的软件包都以zip-archive-0.1.1.8 / ghc-7.6.1结尾,并且彼此覆盖。

Is there any variable like $compiler but distinguishing 32 and 64 bit, or other technique I can use to get it to keep the packages apart? 是否有像$compiler这样的变量,但是可以区分32位和64位,或者我可以使用它来使包分开的其他技术?

您可以将$arch (和/或$os )与足够近的Cabal版本一起使用 ,这些版本将由x86_64的字符串替换(有关更多详细信息,请参见Cabal文档部分“简单构建系统中的路径变量”

This is probably not the Right Way to do it, but on my laptop where I boot into 32-bit and 64-bit operating systems I have a hack set up to deal with this. 这可能不是正确的方法,但是在我启动32位和64位操作系统的笔记本电脑上,我已经设置了用于处理此问题的技巧。 Basically, I have two directories, .cabal-i386 and .cabal-x86_64, and I switch back and forth via symlinks. 基本上,我有两个目录,.cabal-i386和.cabal-x86_64,并且我通过符号链接来回切换。 In my .zshrc: 在我的.zshrc中:

CabalDir=$HOME/.cabal-`uname -m`
if [ ! -d $CabalDir]; then
    echo WARNING: no cabal directory yet for `uname -m`, creating one.
    mkdir -p $CabalDir/{bin,lib,logs,share}
fi
ln -sft $HOME/.cabal $CabalDir/{bin,lib,logs,share}

Perhaps you can adopt some similar strategy, giving yourself a short command to switch out some symlinks (or whatever Windows' analog of symlinks is). 也许您可以采用一些类似的策略,给自己一个简短的命令以切换出一些符号链接(或Windows的任何符号链接类似物)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM