I've written a preliminary cljc script -- a shell script for compiling Clojure libs -- against Stephen's patched Clojure (specifically using the clojure.lang.Compile class).
Configure the script with the locations of the clojure.jar & clojure- contrib.jar & running cljc w/o options calls clojure.lang.Compile on command-line args representing libs or namespaces. With options, it can (1) wrap the contents of the build directory (hard-coded to be "classes") into a jar file (with the first lib set to Main-Class) or (2) wrap the contents of the build directory, the contents of clojure.jar, & the contents of the clojure-contrib.jar into a jar file (with the first lib set to Main-Class). For example, if I have a Clojure lib in hello.clj ----- hello.clj -------- (ns hello) (defn reverse-string [s] (apply str (reverse s))) (defn -main [& args] (println (apply str (mapcat reverse-string (interpose " " (reverse args)))))) ------------- & I call cljc in the same directory like this: cljc -a hello I'll get a jar file I can call like java -jar hello.jar dlroW olleH with these results Hello World That is, it's standalone (albeit at 1.4 Megs!). Anyone who's built Stephen's patch can try it out; others please feel free to offer suggestions. Thanks, Perry -------------- #!/usr/bin/env bash # cljc: Clojure lib compiler cjar=PATH/TO/clojure.jar ccjar=PATH/TO/clojure-contrib.jar build=classes usage() { echo "Usage: $0 [options*] lib+" echo "Options:" echo " (-cp|--classpath) list: colon-separated list of directories or jar files to add to classpath" echo " (-j|--jar): turn on creation of jar file" echo " (-n|--name) name: specify the name of created jar file" echo " (-a|--all): turn on inclusion of all jars in jar file (clojure.jar and clojure-contrib.jar) -- will turn on --jar option as well" # echo " (-e|--extra-jars) list: colon-separated list of jars to include in created jar file" echo " (-h|--help): display this usage information" echo echo "If creating a jar file, the first lib listed will be the Main- Class in the jar's MANIFEST." } while [ $# -gt 0 ]; do case $1 in -cp | --classpath ) shift; cp=$cp:$1; shift;; -a | --all ) shift; all=true; jar=true;; -j | --jar ) shift; jar=true;; # -e | --extra-jars) shift; extra=$1; shift;; -h | --help ) usage; exit 1;; -n | --name ) shift; name=$1; shift;; * ) break;; esac done if [ -z "$1" ]; then usage exit 1 fi mkdir -p $build java -cp $cp:$cjar:$ccjar:$build clojure.lang.Compile "$@" if test $jar; then name=`! test -z $name && echo $name || echo $1` jar cfe $name.jar $1 -C $build . if test $all; then tmp=scratch-temp-dir mkdir $tmp && cd $tmp for jar in $cjar $ccjar; do jar xf $jar done cd - jar uf $name.jar -C $tmp clojure rm -r $tmp fi fi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---