Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bash script which setups a simple clojure environment in $HOME/opt/clojure
#!/usr/bin/env bash
CLOJURE_DIR=$HOME/opt/clojure
JAR_DIR=$HOME/opt/clojure/jars
mkdir -p $CLOJURE_DIR
cd $CLOJURE_DIR
# Get latest version of clojure and compile it
git clone git://github.com/richhickey/clojure.git
cd clojure
ant
cd $CLOJURE_DIR
# Get latest clojure-contrib and build
git clone git://github.com/richhickey/clojure-contrib.git
cd clojure-contrib
ant -Dclojure.jar=$CLOJURE_DIR/clojure/clojure.jar
cd $CLOJURE_DIR
#get jline-0.9.94 and setup
wget http://downloads.sourceforge.net/project/jline/jline/0.9.94/jline-0.9.94.zip
unzip jline-0.9.94.zip
# Setup directory with links to important jars
mkdir -p $JAR_DIR
ln -s $HOME/opt/clojure/jline-0.9.94/jline-0.9.94.jar $JAR_DIR/jline.jar
ln -s $HOME/opt/clojure/clojure/clojure.jar $JAR_DIR/clojure.jar
ln -s $HOME/opt/clojure/clojure-contrib/clojure-contrib.jar $JAR_DIR/clojure-contrib.jar
# Setup clj script
cat > $CLOJURE_DIR/clj << End-Of-Message
#!/usr/bin/env bash
java -cp $JAR_DIR/jline.jar:$JAR_DIR/clojure-contrib.jar:$JAR_DIR/clojure.jar jline.ConsoleRunner clojure.main \$*
End-Of-Message
chmod +x $CLOJURE_DIR/clj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment