Re: [Haskell-cafe] Switching GHC Version
Hi Yusaku, On Tue, Feb 7, 2012 at 00:27, HASHIMOTO, Yusaku wrote: Hi, I wrote a simple shell function for switching GHC version on the system. It works only under Mac OSX, and only switch GHCs installed via .pkg installers. It's useful to experiment newer features without worrying breaking environment. GHC_BASE_DIR=/Library/Frameworks/GHC.framework/Versions/ ghcs () { VERSION=$1 sudo $GHC_BASE_DIR/$VERSION/Tools/create-links . /Library/Frameworks / } I have something quite similar, though mine depends on just one symbolic link, Current. See the end of this email. This approach also works with GHC installed from source. I use the following script to run 'configure' in the GHC source: $ cat configure.mine VERSION=7.4.1 ./configure \ --prefix=/Library/Frameworks/GHC.framework/Versions/$VERSION/usr \ --with-gmp-libraries=/Library/Frameworks/GMP.framework\ --with-gmp-includes=/Library/Frameworks/GMP.framework/Headers For me, the 'ghc-ver' script is useful since I'm often just want to quickly play with something in one version of GHC and not create a development environment. Other tools and approaches that have already been mentioned are also useful. Regards, Sean $ cat ~/bin/ghc-ver #!/bin/sh ECHO=/bin/echo PROGNAME=`basename $0` if [ -z $1 ]; then $ECHO Usage: $PROGNAME version $ECHO$PROGNAME list exit 1 fi VERSIONS_DIR=/Library/Frameworks/GHC.framework/Versions if [ $1 = list ]; then /usr/bin/find $VERSIONS_DIR -type d -depth 1 | xargs basename exit 0 fi CHOSEN_DIR=$VERSIONS_DIR/$1 $ECHO -n Checking for $CHOSEN_DIR ... if [ -d $CHOSEN_DIR ]; then rm $VERSIONS_DIR/Current ln -sf $CHOSEN_DIR $VERSIONS_DIR/Current $ECHO Success! else $ECHO Not found! fi ghc --version $ ls -l /usr/bin/ghc # as well as ghci, ghc-pkg, etc. lrwxr-xr-x [...] /usr/bin/ghc - /Library/Frameworks/GHC.framework/Versions/Current/usr/bin/ghc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Switching GHC Version
Hi, I wrote a simple shell function for switching GHC version on the system. It works only under Mac OSX, and only switch GHCs installed via .pkg installers. It's useful to experiment newer features without worrying breaking environment. GHC_BASE_DIR=/Library/Frameworks/GHC.framework/Versions/ ghcs () { VERSION=$1 sudo $GHC_BASE_DIR/$VERSION/Tools/create-links . /Library/Frameworks / } Usage: ~/work/today 08:21 ghcs 7.4.0.20111219-x86_64 Password: ~/work/today 08:21 ghc --version The Glorious Glasgow Haskell Compilation System, version 7.4.0.20111219 ~/work/today 08:21 ghcs 7.4.1-x86_64 ~/work/today 08:22 ghc --version The Glorious Glasgow Haskell Compilation System, version 7.4.1 Now I'm curious of better way to achieve this. This have limitations described above. Even it requires sudo because it modified symbolic links under `/usr`. Suggestions? -nwn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Switching GHC Version
Personally I prefer just using 'virthualenv' these days, which installs copies of GHC locally that you can then activate with your shell, similar to 'virtualenv' in python. It's how I test packages on multiple copies of GHC. http://hackage.haskell.org/package/virthualenv The nicest part is that it sandboxes cabal packages, but because it works via shell scripts, the workflow for any version of GHC remains the same: you can invoke ghci, cabal, etc all as you would expect, but it only takes place in the virtual environment if you have activated it. On Mon, Feb 6, 2012 at 5:27 PM, HASHIMOTO, Yusaku nonow...@gmail.com wrote: Hi, I wrote a simple shell function for switching GHC version on the system. It works only under Mac OSX, and only switch GHCs installed via .pkg installers. It's useful to experiment newer features without worrying breaking environment. GHC_BASE_DIR=/Library/Frameworks/GHC.framework/Versions/ ghcs () { VERSION=$1 sudo $GHC_BASE_DIR/$VERSION/Tools/create-links . /Library/Frameworks / } Usage: ~/work/today 08:21 ghcs 7.4.0.20111219-x86_64 Password: ~/work/today 08:21 ghc --version The Glorious Glasgow Haskell Compilation System, version 7.4.0.20111219 ~/work/today 08:21 ghcs 7.4.1-x86_64 ~/work/today 08:22 ghc --version The Glorious Glasgow Haskell Compilation System, version 7.4.1 Now I'm curious of better way to achieve this. This have limitations described above. Even it requires sudo because it modified symbolic links under `/usr`. Suggestions? -nwn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Regards, Austin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Switching GHC Version
On Mon, Feb 6, 2012 at 18:27, HASHIMOTO, Yusaku nonow...@gmail.com wrote: Hi, I wrote a simple shell function for switching GHC version on the system. It works only under Mac OSX, and only switch GHCs installed via .pkg installers. It's useful to experiment newer features without worrying breaking environment. FWIW I'd consider two alternatives: (1) forgo links entirely and use something like http://modules.sourceforge.net/ to manage $PATH; (2) instead of using the bundled create-links, have the /usr/bin scripts check a per-user symlink and fall back to a system one; running the select script as root sets the system symlink, running as user sets the per-user symlink. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Switching GHC Version
Thanks for suggestions. Having /usr/bin scripts seems to work for me, Although virthualenv looks promising for package dependency management. But when run virthualenv with --ghc=tarball, it creates copy of GHC suite inside a project whose size is about 700MB. On 2012/02/07, at 8:41, Brandon Allbery allber...@gmail.com wrote: On Mon, Feb 6, 2012 at 18:27, HASHIMOTO, Yusaku nonow...@gmail.com wrote: Hi, I wrote a simple shell function for switching GHC version on the system. It works only under Mac OSX, and only switch GHCs installed via .pkg installers. It's useful to experiment newer features without worrying breaking environment. FWIW I'd consider two alternatives: (1) forgo links entirely and use something like http://modules.sourceforge.net/ to manage $PATH; (2) instead of using the bundled create-links, have the /usr/bin scripts check a per-user symlink and fall back to a system one; running the select script as root sets the system symlink, running as user sets the per-user symlink. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe