multi-ghc: Managing Multiple GHC Distributions

I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others. http://github.com/spl/multi-ghc Feedback welcome. I'd also like to know if something similar exists. Regards, Sean

On Thu, Apr 8, 2010 at 11:00 AM, Sean Leather
I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others.
http://github.com/spl/multi-ghc
Feedback welcome. I'd also like to know if something similar exists.
Does this also work with a system installed ghc? These are usually installed in /usr (I'm using Gentoo Linux): $ ls -l /usr/bin/ghc* lrwxrwxrwx 1 root root 10 dec 22 00:22 /usr/bin/ghc -> ghc-6.12.1 -rwxr-xr-x 1 root root 279 dec 22 00:20 /usr/bin/ghc-6.12.1 lrwxrwxrwx 1 root root 11 dec 22 00:22 /usr/bin/ghci -> ghci-6.12.1 -rwxr-xr-x 1 root root 61 dec 22 00:20 /usr/bin/ghci-6.12.1 lrwxrwxrwx 1 root root 14 dec 22 00:22 /usr/bin/ghc-pkg -> ghc-pkg-6.12.1 -rwxr-xr-x 1 root root 262 dec 22 00:20 /usr/bin/ghc-pkg-6.12.1 If so, I think I'm going to use this tools since I occasionally like to try out ghc-HEAD. regards, Bas

On Thu, Apr 8, 2010 at 13:49, Bas van Dijk
On Thu, Apr 8, 2010 at 11:00 AM, Sean Leather
wrote: I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others.
http://github.com/spl/multi-ghc
Feedback welcome. I'd also like to know if something similar exists.
Does this also work with a system installed ghc? These are usually installed in /usr (I'm using Gentoo Linux):
$ ls -l /usr/bin/ghc* lrwxrwxrwx 1 root root 10 dec 22 00:22 /usr/bin/ghc -> ghc-6.12.1 -rwxr-xr-x 1 root root 279 dec 22 00:20 /usr/bin/ghc-6.12.1 lrwxrwxrwx 1 root root 11 dec 22 00:22 /usr/bin/ghci -> ghci-6.12.1 -rwxr-xr-x 1 root root 61 dec 22 00:20 /usr/bin/ghci-6.12.1 lrwxrwxrwx 1 root root 14 dec 22 00:22 /usr/bin/ghc-pkg -> ghc-pkg-6.12.1 -rwxr-xr-x 1 root root 262 dec 22 00:20 /usr/bin/ghc-pkg-6.12.1
The ghc-config Bash script in multi-ghc uses symlinks to determine which is the "current" version to use. The instructions on the GitHub page explain it in detail, but here's how my setup works. * I create /opt/ghc for storing GHC, clone the multi-ghc repository (or copy the files) here. * I create /opt/ghc/6.10.4/src, download http://www.haskell.org/ghc/dist/6.10.4/ghc-6.10.4-i386-unknown-linux-n.tar.b..., and untar it here. * cd ..; ln -s ../Makefile; make install ghc-config creates a $HOME/.ghc-config directory for tracking the current version and symlinks. Now, the key for your situation (I think) is your $PATH. If you append $HOME/.ghc-config/ghc/bin to your $PATH after /usr/bin, then you can use ghc-6.10.4 to call this specific version. Unfortunately, there is still a problem. ghc-config also manages $HOME/.cabal as a symlink for the current version. So, that would most likely conflict with your setup. There may be a way to fix that, though I haven't looked into it, or I could separate the cabal configuration from the ghc configuration.
If so, I think I'm going to use this tools since I occasionally like to try out ghc-HEAD.
multi-ghc should also work for doing this. As long as you install it as /opt/ghc/6.13.blah (or whichever directory you want to use instead of /opt/ghc). This was one of the goals of the design. There's more documentation in the README.md and scripts. I'm happy to improve upon it if something doesn't work. Sean

On 8 April 2010 19:00, Sean Leather
I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others.
http://github.com/spl/multi-ghc
Feedback welcome. I'd also like to know if something similar exists.
Hi Sean, I wonder if you could achieve the desired result with the "Modules Project": http://modules.sourceforge.net/ We use it at work for managing multiple versions of lots of different programs on a shared machine. Cheers, Bernie.

On Thu, Apr 8, 2010 at 14:00, Bernie Pope
On 8 April 2010 19:00, Sean Leather
wrote: I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others.
http://github.com/spl/multi-ghc
Feedback welcome. I'd also like to know if something similar exists.
I wonder if you could achieve the desired result with the "Modules Project":
http://modules.sourceforge.net/
We use it at work for managing multiple versions of lots of different programs on a shared machine.
It looks interesting! Thanks. It makes me sad to see it written in Tcl. I spent way too much time with the language at my last job and did not enjoy it. But I grant that that is not a reason to avoid using it. I actually started out doing as they do, changing the PATH, but I decided that was not a great solution for two reasons: (1) It's inflexible and precludes the ability to set my PATH as I like. (2) It requires sourcing a script instead of executing it. I didn't like having no separation between my environment and the script's environment. It was too easy to introduce spurious environment variables. It would be nice if such a tool can potentially be written to work on Windows as well. Regards, Sean
participants (3)
-
Bas van Dijk
-
Bernie Pope
-
Sean Leather