[Opensrf-commits] r1158 - in trunk: . src src/java

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Dec 7 15:18:25 EST 2007


Author: erickson
Date: 2007-12-07 14:58:27 -0500 (Fri, 07 Dec 2007)
New Revision: 1158

Added:
   trunk/src/java/deps.inc
   trunk/src/java/deps.sh
Modified:
   trunk/install.conf
   trunk/src/Makefile
   trunk/src/java/Makefile
Log:
created external script for downloading java dependencies.  added new install.conf settings for where dependency jars are kept and whether or not to build the java libs

Modified: trunk/install.conf
===================================================================
--- trunk/install.conf	2007-12-07 05:00:55 UTC (rev 1157)
+++ trunk/install.conf	2007-12-07 19:58:27 UTC (rev 1158)
@@ -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

Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2007-12-07 05:00:55 UTC (rev 1157)
+++ trunk/src/Makefile	2007-12-07 19:58:27 UTC (rev 1158)
@@ -23,7 +23,8 @@
 	router \
 	srfsh \
 	jserver \
-	gateway
+	gateway \
+	java
 
 install: 	install-prep \
 		opensrf-install \
@@ -33,7 +34,8 @@
 		jserver-install \
 		javascript-install \
 		perl-install \
-		python25-install
+		python25-install \
+		java-install
 
 
 # --------------------------------------------------------------------------------
@@ -64,6 +66,10 @@
 	make -C jserver
 
 
+java:	prep
+	if [ -n "$(OSRF_INSTALL_JAVA)" ]; then echo $@; cd java && . deps.inc && make; fi;
+
+
 # --------------------------------------------------------------------------------
 # INSTALL
 # --------------------------------------------------------------------------------
@@ -123,6 +129,8 @@
 	@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 @@
 	make -C jserver clean
 	make -C srfsh clean
 	make -C c-apps clean
+	make -C java clean
 	/bin/rm -rf $(TMPDIR) *.o
 
 

Modified: trunk/src/java/Makefile
===================================================================
--- trunk/src/java/Makefile	2007-12-07 05:00:55 UTC (rev 1157)
+++ trunk/src/java/Makefile	2007-12-07 19:58:27 UTC (rev 1158)
@@ -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 @@
 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
 
  	

Added: trunk/src/java/deps.inc
===================================================================
--- trunk/src/java/deps.inc	                        (rev 0)
+++ trunk/src/java/deps.inc	2007-12-07 19:58:27 UTC (rev 1158)
@@ -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"
+

Added: trunk/src/java/deps.sh
===================================================================
--- trunk/src/java/deps.sh	                        (rev 0)
+++ trunk/src/java/deps.sh	2007-12-07 19:58:27 UTC (rev 1158)
@@ -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


Property changes on: trunk/src/java/deps.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the opensrf-commits mailing list