Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 65 lines (53 sloc) 1.58 KB
#!/bin/bash
# usage: bin/compile <build-dir> <cache-dir>
set -eo pipefail
mkdir -p "$1" "$2"
build=$(cd "$1/" && pwd)
cache=$(cd "$2/" && pwd)
ver=1.0.3
file=go$ver.linux-amd64.tar.gz
url=http://go.googlecode.com/files/$file
buildpack=$(dirname $(dirname $0))
# Python
venv=$cache/venv
mkdir -p $cache/pip
python=python2.7
PATH=$venv/bin:$PATH
virtualenv() {
python "$buildpack/vendor/virtualenv-1.7/virtualenv.py" "$@"
}
if test -d $cache/go-$ver
then
echo "-----> Using Go $ver"
else
rm -rf $cache/go-$ver/* # be sure not to build up cruft
mkdir -p $cache/go-$ver
cd $cache/go-$ver
echo -n "-----> Installing Go $ver..."
curl -sO $url
tar zxf $file
rm -f $file
echo " done"
fi
cp -R $cache/go-$ver/go $build/.go
export GOROOT=$build/.go
if ! (which hg > /dev/null)
then
echo -n " Installing Virtualenv..."
virtualenv --python $python --distribute --never-download --prompt='(venv) ' $venv > /dev/null 2>&1
echo -n "running virtualenv"
. $venv/bin/activate > /dev/null 2>&1
echo " done"
echo -n " Installing Mercurial..."
pip install --use-mirrors mercurial > /dev/null 2>&1
echo " done"
fi
echo "-----> Copying src to .go/src/pkg/_app"
mkdir -p $build/.go/src/pkg/_app
mv $build/* $build/.go/src/pkg/_app
unset GIT_DIR # unset git dir or it will mess with goinstall
echo "-----> Getting and building Revel"
cd $build/.go
bin/go get github.com/robfig/revel | sed -u 's/^/ /'
bin/go get github.com/jamesward/revel | sed -u 's/^/ /'
bin/go build -o bin/revel github.com/jamesward/revel/cmd | sed -u 's/^/ /'
Something went wrong with that request. Please try again.