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