Last active
December 21, 2015 00:49
-
-
Save seancribbs/6223390 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH="$HOME/erlang/current/bin:$PATH" | |
erlcur() { | |
DIR=`ls -lr $HOME/erlang | awk '/current/ { print $NF }'` | |
echo -n ${DIR##*/} | |
} | |
erlsw() { | |
TARGET=`find $HOME/erlang -depth 1 -type d -name "*$1*" | head -1` | |
if [ -z "$TARGET" ]; then | |
echo "No release matching $1\!" | |
if [ -e $HOME/erlang/current ]; then | |
echo Using `erlcur` | |
fi | |
return | |
fi | |
ln -nfs $TARGET $HOME/erlang/current | |
echo Using `erlcur` | |
} | |
_erlbuild() { | |
set -e | |
RELNAME=$1 | |
shift | |
EXTRACONFIGS=$@ | |
ORIGDIR=`pwd` | |
TARBALL="otp_src_$RELNAME.tar.gz" | |
BUILDDIR="otp_src_$RELNAME" | |
PREFIX="$HOME/erlang/$RELNAME" | |
if [[ ! -d "$PREFIX" ]]; then | |
mkdir -p $HOME/erlang/_builds | |
cd $HOME/erlang/_builds | |
if [[ ! -f "$TARBALL" ]]; then | |
echo -n "Downloading $RELNAME: " | |
wget --progress=dot:mega https://packages.erlang-solutions.com/erlang/esl-erlang-src/$TARBALL | |
fi | |
if [[ ! -d $BUILDDIR ]]; then | |
echo "Unpacking $RELNAME..." | |
tar xzf $TARBALL | |
fi | |
cd $BUILDDIR | |
echo "Configuring $RELNAME..." | |
./configure --prefix=$PREFIX --enable-darwin-64-bit --with-dynamic-trace=dtrace --disable-hipe $EXTRACONFIGS > /dev/null 2>&1 | |
touch lib/wx/SKIP | |
echo "Building and installing $RELNAME into $PREFIX..." | |
make all docs install install-docs > /dev/null 2>&1 | |
cd $ORIGDIR | |
else | |
echo "$RELNAME is already installed in $PREFIX" | |
exit 1 | |
fi | |
} | |
erlbuild() { | |
echo "_erlbuild $@" | $SHELL -l | |
} | |
erlclean() { | |
RELNAME=$1 | |
echo "Removing build artifacts for $RELNAME:" | |
rm -rvf $HOME/erlang/_builds/*$RELNAME* | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this pre-suppose a directory set up of ~/elrang/$VERSION? where there is a directory for each version you want to switch to?