components/tomcat/patches/env.patch
author Petr Sumbera <petr.sumbera@oracle.com>
Tue, 07 May 2013 12:53:03 -0700
branchs11-update
changeset 2602 5caab247ea3d
parent 788 ab1a623335b6
child 1386 4e8ea821eb75
permissions -rw-r--r--
16024185 tomcat doesn't build with jdk 1.7

--- apache-tomcat-6.0.35-src/bin/catalina.sh	Mon Nov 28 02:22:44 2011
+++ apache-tomcat-6.0.35-src/bin/catalina.sh	Mon Apr 16 08:42:47 2012
@@ -92,6 +92,7 @@
 CYGWIN*) cygwin=true;;
 OS400*) os400=true;;
 Darwin*) darwin=true;;
+SunOS*) solaris=true;;
 esac
 
 # resolve links - $0 may be a softlink
@@ -120,8 +121,19 @@
 # but allow them to be specified in setenv.sh, in rare case when it is needed.
 CLASSPATH=
 
-if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
-  . "$CATALINA_BASE/bin/setenv.sh"
+# On Solaris we want to allow running system Tomcat instance (where
+# setenv.sh file is located in /var/tomcat6/conf) in parallel to Tomcat
+# instances started by individual users. As it's expected that all will
+# use the same copy of catalina.sh some extra logic needs to be added
+# here:
+if [ "$CATALINA_BASE" = "/var/tomcat6" ]; then
+  SETENVDIR="conf"
+else
+  SETENVDIR="bin"
+fi
+
+if [ -r "$CATALINA_BASE/$SETENVDIR/setenv.sh" ]; then
+  . "$CATALINA_BASE/$SETENVDIR/setenv.sh"
 elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
   . "$CATALINA_HOME/bin/setenv.sh"
 fi
@@ -147,6 +159,11 @@
   export QIBM_MULTI_THREADED=Y
 fi
 
+# For Solaris
+if $solaris; then
+  [ -z "$JAVA_HOME" ] && JAVA_HOME=/usr/jdk/instances/jdk1.7.0
+fi
+
 # Get standard Java environment variables
 if $os400; then
   # -r will Only work on the os400 if the files are:
--- apache-tomcat-6.0.35-src/bin/tool-wrapper.sh	Mon Nov 28 02:22:44 2011
+++ apache-tomcat-6.0.35-src/bin/tool-wrapper.sh	Mon Apr 16 08:42:57 2012
@@ -35,8 +35,10 @@
 
 # OS specific support.  $var _must_ be set to either true or false.
 cygwin=false
+solaris=false
 case "`uname`" in
 CYGWIN*) cygwin=true;;
+SunOS*) solaris=true;;
 esac
 
 # resolve links - $0 may be a softlink
@@ -60,10 +62,23 @@
 # but allow them to be specified in setenv.sh, in rare case when it is needed.
 CLASSPATH=
 
-if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
-  . "$CATALINA_HOME"/bin/setenv.sh
+# On Solaris we want to allow running system Tomcat instance (where
+# setenv.sh file is located in /var/tomcat6/conf) in parallel to Tomcat
+# instances started by individual users. As it's expected that all will
+# use the same copy of catalina.sh some extra logic needs to be added
+# here:
+if [ "$CATALINA_BASE" = "/var/tomcat6" ]; then
+  SETENVDIR="conf"
+else
+  SETENVDIR="bin"
 fi
 
+if [ -r "$CATALINA_BASE/$SETENVDIR/setenv.sh" ]; then
+  . "$CATALINA_BASE/$SETENVDIR/setenv.sh"
+elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
+  . "$CATALINA_HOME/bin/setenv.sh"
+fi
+
 # For Cygwin, ensure paths are in UNIX format before anything is touched
 if $cygwin; then
   [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
@@ -71,6 +86,11 @@
   [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
 fi
 
+# For Solaris
+if $solaris; then
+  [ -z "$JAVA_HOME" ] && JAVA_HOME=/usr/jdk/instances/jdk1.7.0
+fi
+
 # Get standard Java environment variables
 if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
   BASEDIR="$CATALINA_HOME"