Skip to content

Instantly share code, notes, and snippets.

@erochest
Created November 2, 2013 02:12
Show Gist options
  • Save erochest/7274727 to your computer and use it in GitHub Desktop.
Save erochest/7274727 to your computer and use it in GitHub Desktop.
Using `cabal-install` to generate installable package for [brew](http://brew.sh/).
#!/bin/bash
USAGE=<<EOF
cabal-brew PACKAGE VERSION
EOF
CABAL=cabal
package="$1"
keg="cabal-$package"
version="$2"
sandbox="/usr/local/Cellar/$keg/$version"
if [ -d /usr/local/Cellar/$keg ] ; then
echo "Cleaning out old keg for $keg"
brew unlink $keg
rm -rf /usr/local/Cellar/$keg
fi
pushd /tmp
[ -f cabal.sandbox.config ] && rm cabal.sandbox.config
echo "$CABAL $package-$version => $sandbox"
${CABAL} sandbox init --sandbox=$sandbox
${CABAL} install $package-$version
brew link --overwrite $keg
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment