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

自闭症网瘾萝莉.ら 提交于 2019-12-23 13:19:04

问题


I'm doing some testing of 64-bit GHC on Windows, in tandem with migrating code forward to 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.

My cabal config file ($APPDATA/cabal/config) contains

libsubdir: $pkgid\$compiler

which means that both 32-bit and 64-bit versions of packages I install are ending up in e.g. zip-archive-0.1.1.8/ghc-7.6.1, and overwriting each other.

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?


回答1:


You can use $arch (and/or $os) with recent enough Cabal versions, which will be replaced by a string such as x86_64 (see Cabal documentation section "Path variables in the simple build system" for more details)




回答2:


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. Basically, I have two directories, .cabal-i386 and .cabal-x86_64, and I switch back and forth via symlinks. In my .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).



来源:https://stackoverflow.com/questions/12393750/how-can-i-configure-cabal-to-use-different-folders-for-32-bit-and-64-bit-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!