summaryrefslogtreecommitdiff
path: root/lang/clojure/files/clj.sh
diff options
context:
space:
mode:
authorryoon <ryoon>2012-05-04 11:51:30 +0000
committerryoon <ryoon>2012-05-04 11:51:30 +0000
commita6188cede3780eafc8510f4d3ce4bf80a87d8c60 (patch)
tree1f3f46a0bed1ccf3b93eb278d91b0bd9b83e2e2a /lang/clojure/files/clj.sh
parentdc4c40c84bc3932ad71aff05b77518b7cf399a79 (diff)
downloadpkgsrc-a6188cede3780eafc8510f4d3ce4bf80a87d8c60.tar.gz
Import clojure-1.4.0 as lang/clojure.
Clojure is a dynamic programming language that targets the Java Virtual Machine (and the CLR, and JavaScript). It is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure is a compiled language - it compiles directly to JVM bytecode, yet remains completely dynamic. Every feature supported by Clojure is supported at runtime. Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection. Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, Clojure offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs. I hope you find Clojure's combination of facilities elegant, powerful, practical and fun to use.
Diffstat (limited to 'lang/clojure/files/clj.sh')
-rw-r--r--lang/clojure/files/clj.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/lang/clojure/files/clj.sh b/lang/clojure/files/clj.sh
new file mode 100644
index 00000000000..b6591c42f07
--- /dev/null
+++ b/lang/clojure/files/clj.sh
@@ -0,0 +1,36 @@
+#!@SH@
+
+# clj - Clojure launcher script
+# Borrowed from https://trac.macports.org/changeset/69628
+
+cljjar='lib/java/clojure/clojure.jar'
+cljclass='clojure.main'
+
+dir=$0
+while [ -h "$dir" ]; do
+ ls=`ls -ld "$dir"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+
+ if expr "$link" : '/.*' > /dev/null; then
+ dir="$link"
+ else
+ dir=`dirname "$dir"`"/$link"
+ fi
+done
+
+dir=`dirname $dir`
+dir=`cd "$dir" > /dev/null && pwd`
+cljjar="$dir/../$cljjar"
+cp="${PWD}:${cljjar}"
+
+# Add extra jars as specified by `.clojure` file
+# Borrowed from <http://github.com/mreid/clojure-framework>
+if [ -f .clojure ]; then
+ cp=$cp:`cat .clojure`
+fi
+
+if [ -z "$1" ]; then
+ exec @JAVA_HOME@/bin/java -classpath $cp $cljclass
+else
+ exec @JAVA_HOME@/bin/java -classpath $cp $cljclass $*
+fi