created external script for downloading java dependencies. added new install.conf...
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 7 Dec 2007 19:58:27 +0000 (19:58 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 7 Dec 2007 19:58:27 +0000 (19:58 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1158 9efc2488-bf62-4759-914b-345cdb29e865

install.conf
src/Makefile
src/java/Makefile
src/java/deps.inc [new file with mode: 0644]
src/java/deps.sh [new file with mode: 0755]

index 667f634..b0fd79b 100644 (file)
@@ -1,15 +1,23 @@
-export PREFIX=/openils/
-export BINDIR=/openils//bin/
-export LIBDIR=/openils//lib/
-export PERLDIR=/openils//lib//perl5/
-export INCLUDEDIR=/openils//include/
-export ETCDIR=/openils//conf
-export SOCK=/openils//var/sock
-export PID=/openils//var/pid
-export LOG=/openils//var/log
+export PREFIX=/openils
+export BINDIR=/openils/bin
+export LIBDIR=/openils/lib
+export PERLDIR=/openils/lib/perl5
+export INCLUDEDIR=/openils/include
+export ETCDIR=/openils/conf
+export SOCK=/openils/var/sock
+export PID=/openils/var/pid
+export LOG=/openils/var/log
 export TMP=/tmp/ilstemp
 export APXS2=/usr/bin/apxs2
 export APACHE2_HEADERS=/usr/include/apache2
-export APR_HEADERS=/usr/include/apr-1.0/
-export LIBXML2_HEADERS=/usr/include/libxml2/
+export APR_HEADERS=/usr/include/apr-1.0
+export LIBXML2_HEADERS=/usr/include/libxml2
+
+# uncoment to create the legacy JSON headers and .so file for backwards compatibility
 export OSRF_LEGACY_JSON=1
+
+# uncomment to build and install the java libs
+#export OSRF_INSTALL_JAVA=1
+
+# path to the directory containing the Java dependency jar files
+#export OSRF_JAVA_DEPSDIR=/opt/java
index 04b627a..c1862b1 100644 (file)
@@ -23,7 +23,8 @@ all:  prep \
        router \
        srfsh \
        jserver \
-       gateway
+       gateway \
+       java
 
 install:       install-prep \
                opensrf-install \
@@ -33,7 +34,8 @@ install:      install-prep \
                jserver-install \
                javascript-install \
                perl-install \
-               python25-install
+               python25-install \
+               java-install
 
 
 # --------------------------------------------------------------------------------
@@ -64,6 +66,10 @@ jserver:     opensrf
        make -C jserver
 
 
+java:  prep
+       if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make; fi;
+
+
 # --------------------------------------------------------------------------------
 # INSTALL
 # --------------------------------------------------------------------------------
@@ -123,6 +129,8 @@ python25-install:   install-prep
        @echo $@
        cp -r python/* $(PYTHON25DIR)/
 
+java-install:
+       if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make install; fi;
 
 # --------------------------------------------------------------------------------
 # CLEAN        
@@ -134,6 +142,7 @@ clean:
        make -C jserver clean
        make -C srfsh clean
        make -C c-apps clean
+       make -C java clean
        /bin/rm -rf $(TMPDIR) *.o
 
 
index a04845c..a420f98 100644 (file)
@@ -1,42 +1,32 @@
-# dependencies
-STAX=stax-api-1.0.1.jar
-WSTX=wstx-lgpl-3.2.1.jar
-MEMCACHE=java_memcached-release_1.5.1.jar
-JSON=json.zip
-
-STAX_URL=http://woodstox.codehaus.org/$(STAX)
-WSTX_URL=http://woodstox.codehaus.org/3.2.1/$(WSTX)
-MEMCACHE_URL=http://img.whalin.com/memcached/jdk5/standard/$(MEMCACHE)
-JSON_URL=http://www.json.org/java/$(JSON)
-
-
 JAVAC=javac -J-Xmx256m
 JAVA=java -Xmx256m 
 JAVA_LIBDIR = .lib
-JAVA_LIBS = .:$(JAVA_LIBDIR):ext/$(WSTX):ext/$(STAX):ext/$(MEMCACHE)
+JAVA_LIBS = .:$(OSRF_JAVA_DEPSDIR)/$(WSTX):$(OSRF_JAVA_DEPSDIR)/$(STAX):$(OSRF_JAVA_DEPSDIR)/$(MEMCACHE):$(OSRF_JAVA_DEPSDIR)/$(JSON)
 JAVA_SRC = \
        org/opensrf/net/xmpp/*.java \
        org/opensrf/util/*.java \
        org/opensrf/*.java \
        org/opensrf/test/*.java 
 
-
 #------------------------------------------------------------------
 
-all:   jar
+all:   verify_deps dirs jar
 
+verify_deps:
+       @if [ ! -e "$(OSRF_JAVA_DEPSDIR)/$(WSTX)" ]; then echo -e "\nmissing dependency $(WSTX)!\n" && exit 1; fi
+       @if [ ! -e "$(OSRF_JAVA_DEPSDIR)/$(STAX)" ]; then echo -e "\nmissing dependency $(STAX)!\n" && exit 1; fi
+       @if [ ! -e "$(OSRF_JAVA_DEPSDIR)/$(MEMCACHE)" ]; then echo -e "\nmissing dependency $(MEMCACHE)!\n" && exit 1; fi
+       @if [ ! -e "$(OSRF_JAVA_DEPSDIR)/$(JSON)" ]; then echo -e "\nmissing dependency $(JSON)!\n" && exit 1; fi
 
 dirs:
        mkdir -p $(JAVA_LIBDIR)
 
-opensrf:       deps
+opensrf:
        $(JAVAC) -d $(JAVA_LIBDIR) -cp $(JAVA_LIBS) $(JAVA_SRC) 2>&1 
 
 jar:   opensrf
        rm -f opensrf.jar
-       echo "creating opensrf.jar"
-       jar cf opensrf.jar -C .lib org
-       rm -r $(JAVA_LIBDIR)
+       jar cf opensrf.jar -C $(JAVA_LIBDIR) org
 
 # only prints the first 30 lines of errors
 slim:
@@ -52,24 +42,19 @@ check:
 run:
        $(JAVA) -cp $(JAVA_LIBS):opensrf.jar $(JAVA_EXE) $(JAVA_ARGS)
 
-deps:
-       mkdir -p ext
-       mkdir -p $(JAVA_LIBDIR)
-       if [ ! -f ext/$(STAX) ]; then wget '$(STAX_URL)' -O ext/$(STAX); fi 
-       if [ ! -f ext/wstx-lgpl-3.2.1.jar ]; then wget '$(WSTX_URL)' -O ext/$(WSTX); fi
-       if [ ! -f ext/java_memcached-release_1.5.1.jar ]; then wget '$(MEMCACHE_URL)' -O ext/$(MEMCACHE); fi
-       if [ ! -f .tmp/$(JSON) ]; then mkdir -p .tmp && cd .tmp && wget '$(JSON_URL)' && unzip $(JSON); fi
-       $(JAVAC) -d $(JAVA_LIBDIR) .tmp/org/json/*.java
-
 docs:
        find . -name *.java > files;
        javadoc -classpath $(JAVA_LIBS) -d doc @files;
        rm files;
 
+install:
+       mkdir -p $(LIBDIR)/java
+       cp opensrf.jar $(LIBDIR)/java
+
 clean: 
-       rm -rf $(JAVA_LIBDIR) opensrf.jar
+       rm -fr opensrf.jar $(JAVA_LIBDIR)
 
 dep_clean:
-       rm -rf ext .tmp
+       rm -rf deps
 
        
diff --git a/src/java/deps.inc b/src/java/deps.inc
new file mode 100644 (file)
index 0000000..dc21f6c
--- /dev/null
@@ -0,0 +1,5 @@
+export STAX="stax-api-1.0.1.jar"
+export WSTX="wstx-lgpl-3.2.1.jar"
+export MEMCACHE="java_memcached-release_1.5.1.jar"
+export JSON="json.jar"
+
diff --git a/src/java/deps.sh b/src/java/deps.sh
new file mode 100755 (executable)
index 0000000..0d7a7bf
--- /dev/null
@@ -0,0 +1,40 @@
+# ----------------------------------------------------------------
+# Utility script for fetching the OpenSRF Java dependencies
+# ----------------------------------------------------------------
+
+. deps.inc
+STAX=stax-api-1.0.1.jar
+WSTX=wstx-lgpl-3.2.1.jar
+MEMCACHE=java_memcached-release_1.5.1.jar
+JSON=json.zip
+JSON_ZIP=json.zip
+
+STAX_URL=http://woodstox.codehaus.org/$STAX
+WSTX_URL=http://woodstox.codehaus.org/3.2.1/$WSTX
+MEMCACHE_URL=http://img.whalin.com/memcached/jdk5/standard/$MEMCACHE
+JSON_URL=http://www.json.org/java/$JSON
+
+JAVAC="javac -J-Xmx256m"
+JAVA="java -Xmx256m"
+
+mkdir -p deps
+if [ ! -f deps/$STAX ]; then wget $STAX_URL -O deps/$STAX; fi 
+if [ ! -f deps/$WSTX ]; then wget $WSTX_URL -O deps/$WSTX; fi
+if [ ! -f deps/$MEMCACHE ]; then wget $MEMCACHE_URL -O deps/$MEMCACHE; fi
+if [ ! -f deps/$JSON ]; then 
+    mkdir -p deps 
+    cd deps 
+    wget "$JSON_URL"
+    unzip $JSON && $JAVAC org/json/*.java; 
+    jar cf json.jar org
+fi
+
+
+if [ -n "$INSTALLDIR" ]; then
+    cp deps/*.jar "$INSTALLDIR"/;
+else
+    echo ""
+    echo "if you provide an INSTALLDIR setting, the script will go ahead and copy the jars into place"
+    echo "example: INSTALLDIR=/path/to/java $0"
+    echo ""
+fi