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

I am testing 64-bit GHC on Windows, in parallel with porting code to GHC 7.6.1. This means that I have both 32-bit and 64-bit versions of GHC 7.6.1 installed, so I can distinguish 64-bit specific problems from common problems with 7.6.1.

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

 libsubdir: $pkgid\$compiler 

which means that both the 32-bit and 64-bit versions of the packages that I install end up, for example, zip-archive-0.1.1.8 / ghc-7.6.1 and overwrite each other.

Is there some kind of variable like $compiler , but differentiating between 32 and 64 bits, or some other technique that I can use to make it store packages separately?

+4
source share
2 answers

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

+3
source

This is probably not the right way to do this, but on my laptop, where I boot into 32-bit and 64-bit operating systems, I have a hack configured to solve this problem. Basically, I have two directories: .cabal-i386 and .cabal-x86_64, and I switch back and forth via symbolic links. 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 by giving yourself a short command to disable some symbolic links (or some Windows symbolic link analogue).

+2
source

Source: https://habr.com/ru/post/1433866/


All Articles