summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Sennhauser <sera@gentoo.org>2012-07-20 17:36:54 +0000
committerRalph Sennhauser <sera@gentoo.org>2012-07-20 17:36:54 +0000
commit9e288775a9c0365f786778fc819cdaee85e9ed18 (patch)
tree70b18a0188741502219c0b23b614bd4bcf1948f7 /www-servers/tomcat
parentRequire elfutils[static-libs] #427222 by toogle. (diff)
downloadgentoo-2-9e288775a9c0365f786778fc819cdaee85e9ed18.tar.gz
gentoo-2-9e288775a9c0365f786778fc819cdaee85e9ed18.tar.bz2
gentoo-2-9e288775a9c0365f786778fc819cdaee85e9ed18.zip
Full rewrite.
Add tomcat-instance-manager.bash to convienintly create and remove multiple instances. Don't symlink jars but use java-config as appropriate. Migrate init script to baselayout2 including major cleanup. Add use extra-webapps to build and install the docs and examples web apps. Use USE=doc for javadocs. Major cleanup of the ebuild, like dropping elog massages obsolete for ages. Don't copy manager and host-manager to catalina base but use a shared instance in catalina home which gets updated with a package update. Actually install sources if requested. Initial Gentoo Prefix support. #180519 : don kill ROOT application #191611 : init script improvements #254526 : emerge --config, implemented with tomcat-instance-manager.bash #283273, #363931 : build docs and examples #309211 : handling of manager / host-manager #333153 : arbitrary classpath per instance #381693 : init fails with non existent CATALINA_TMPDIR #406285, #411597 : support multiple instances #407979 : fails if /run is tmpfs #420383 : forces invalid java compiler (Portage version: 2.1.11.9/cvs/Linux x86_64)
Diffstat (limited to 'www-servers/tomcat')
-rw-r--r--www-servers/tomcat/ChangeLog33
-rw-r--r--www-servers/tomcat/files/tomcat-6.0.35-build.xml.patch31
-rw-r--r--www-servers/tomcat/files/tomcat-7.0.29-build.xml.patch105
-rw-r--r--www-servers/tomcat/files/tomcat-instance-manager.bash240
-rw-r--r--www-servers/tomcat/files/tomcat.conf49
-rw-r--r--www-servers/tomcat/files/tomcat.init104
-rw-r--r--www-servers/tomcat/metadata.xml17
-rw-r--r--www-servers/tomcat/tomcat-6.0.35-r1.ebuild134
-rw-r--r--www-servers/tomcat/tomcat-7.0.29-r1.ebuild133
9 files changed, 838 insertions, 8 deletions
diff --git a/www-servers/tomcat/ChangeLog b/www-servers/tomcat/ChangeLog
index 3be25105e9dc..59eb7e72c318 100644
--- a/www-servers/tomcat/ChangeLog
+++ b/www-servers/tomcat/ChangeLog
@@ -1,6 +1,37 @@
# ChangeLog for www-servers/tomcat
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/www-servers/tomcat/ChangeLog,v 1.294 2012/07/08 21:35:54 fordfrog Exp $
+# $Header: /var/cvsroot/gentoo-x86/www-servers/tomcat/ChangeLog,v 1.295 2012/07/20 17:36:54 sera Exp $
+
+*tomcat-7.0.29-r1 (20 Jul 2012)
+*tomcat-6.0.35-r1 (20 Jul 2012)
+
+ 20 Jul 2012; Ralph Sennhauser <sera@gentoo.org> +tomcat-6.0.35-r1.ebuild,
+ +files/tomcat-6.0.35-build.xml.patch, +tomcat-7.0.29-r1.ebuild,
+ +files/tomcat-7.0.29-build.xml.patch, +files/tomcat.conf, +files/tomcat.init,
+ +files/tomcat-instance-manager.bash, metadata.xml:
+ Full rewrite.
+ Add tomcat-instance-manager.bash to convienintly create and remove multiple
+ instances.
+ Don't symlink jars but use java-config as appropriate.
+ Migrate init script to baselayout2 including major cleanup.
+ Add use extra-webapps to build and install the docs and examples web apps.
+ Use USE=doc for javadocs.
+ Major cleanup of the ebuild, like dropping elog massages obsolete for ages.
+ Don't copy manager and host-manager to catalina base but use a shared
+ instance in catalina home which gets updated with a package
+ update.
+ Actually install sources if requested.
+ Initial Gentoo Prefix support.
+ #180519 : don kill ROOT application
+ #191611 : init script improvements
+ #254526 : emerge --config, implemented with tomcat-instance-manager.bash
+ #283273, #363931 : build docs and examples
+ #309211 : handling of manager / host-manager
+ #333153 : arbitrary classpath per instance
+ #381693 : init fails with non existent CATALINA_TMPDIR
+ #406285, #411597 : support multiple instances
+ #407979 : fails if /run is tmpfs
+ #420383 : forces invalid java compiler
*tomcat-7.0.29 (08 Jul 2012)
diff --git a/www-servers/tomcat/files/tomcat-6.0.35-build.xml.patch b/www-servers/tomcat/files/tomcat-6.0.35-build.xml.patch
new file mode 100644
index 000000000000..6517dee4d196
--- /dev/null
+++ b/www-servers/tomcat/files/tomcat-6.0.35-build.xml.patch
@@ -0,0 +1,31 @@
+--- build.xml.orig 2012-07-06 20:26:21.361299240 +0200
++++ build.xml 2012-07-06 20:26:56.085899911 +0200
+@@ -487,12 +487,14 @@
+
+ <target name="deploy" depends="build-only,build-docs,warn.dbcp">
+
++<!--
+ <copy tofile="${tomcat.build}/bin/tomcat-native.tar.gz"
+ file="${tomcat-native.tar.gz}" />
+ <copy tofile="${tomcat.build}/bin/commons-daemon-native.tar.gz"
+ file="${commons-daemon.native.src.tgz}" />
+
+ <copy tofile="${tomcat.build}/bin/commons-daemon.jar" file="${commons-daemon.jar}" />
++-->
+
+ <!-- Copy scripts -->
+ <copy todir="${tomcat.build}/bin">
+--- build.xml.orig 2012-07-06 20:31:31.387806167 +0200
++++ build.xml 2012-07-06 20:32:33.185315885 +0200
+@@ -646,9 +646,11 @@
+ </fileset>
+ </txt2html>
+
++<!--
+ <copy file="${tomcat-dbcp.jar}" todir="${tomcat.build}/lib"
+ failonerror="false"/>
+ <copy file="${jdt.jar}" todir="${tomcat.build}/lib" />
++-->
+
+ </target>
+
diff --git a/www-servers/tomcat/files/tomcat-7.0.29-build.xml.patch b/www-servers/tomcat/files/tomcat-7.0.29-build.xml.patch
new file mode 100644
index 000000000000..9b07137451aa
--- /dev/null
+++ b/www-servers/tomcat/files/tomcat-7.0.29-build.xml.patch
@@ -0,0 +1,105 @@
+diff --git a/build.xml b/build.xml
+index 3ff8f81..83357a4 100644
+--- a/build.xml
++++ b/build.xml
+@@ -613,7 +614,8 @@
+ filesId="files.annotations-api"
+ manifest="${tomcat.manifests}/annotations-api.jar.manifest" />
+
+- <!-- Servlet 3.0 Implementation JAR File -->
++<!--
++ Servlet 3.0 Implementation JAR File
+ <jarIt jarfile="${servlet-api.jar}"
+ filesDir="${tomcat.classes}"
+ filesId="files.servlet-api"
+@@ -621,7 +623,7 @@
+ notice="${tomcat.manifests}/servlet-api.jar.notice"
+ license="${tomcat.manifests}/servlet-api.jar.license" />
+
+- <!-- JSP 2.2 Implementation JAR File -->
++ JSP 2.2 Implementation JAR File
+ <jarIt jarfile="${jsp-api.jar}"
+ filesDir="${tomcat.classes}"
+ filesId="files.jsp-api"
+@@ -629,11 +631,12 @@
+ notice="${tomcat.manifests}/jsp-api.jar.notice"
+ license="${tomcat.manifests}/jsp-api.jar.license" />
+
+- <!-- JSP 2.2 EL Implementation JAR File -->
++ JSP 2.2 EL Implementation JAR File
+ <jarIt jarfile="${el-api.jar}"
+ filesDir="${tomcat.classes}"
+ filesId="files.el-api"
+ manifest="${tomcat.manifests}/el-api.jar.manifest" />
++-->
+
+ <!-- Bootstrap JAR File -->
+ <jarIt jarfile="${bootstrap.jar}"
+@@ -834,13 +837,14 @@
+ <target name="deploy" depends="package,build-docs"
+ description="Default. Builds a working Tomcat instance">
+
++<!--
+ <copy tofile="${tomcat.build}/bin/tomcat-native.tar.gz"
+ file="${tomcat-native.tar.gz}" />
+ <copy tofile="${tomcat.build}/bin/commons-daemon-native.tar.gz"
+ file="${commons-daemon.native.src.tgz}" />
+
+ <copy tofile="${tomcat.build}/bin/commons-daemon.jar" file="${commons-daemon.jar}" />
+-
++-->
+ <!-- Copy scripts -->
+ <copy todir="${tomcat.build}/bin">
+ <fileset dir="bin">
+@@ -918,9 +922,11 @@
+ <!-- Add sources for examples -->
+ <antcall target="examples-sources" />
+
++<!--
+ <copy file="${tomcat-dbcp.jar}" todir="${tomcat.build}/lib"
+ failonerror="false"/>
+ <copy file="${jdt.jar}" todir="${tomcat.build}/lib" />
++-->
+
+ <!-- build the jdbc-pool jar and source jar-->
+ <echo message="Building Tomcat JDBC pool libraries"/>
+@@ -1355,7 +1361,8 @@
+
+ <target name="extras-webservices-prepare"
+ depends="extras-prepare"
+- description="Prepare to build web services extras package">
++ description="Prepare to build web services extras package"
++ unless="noget">
+
+ <antcall target="downloadfile">
+ <param name="sourcefile" value="${jaxrpc-lib.loc}"/>
+@@ -2278,7 +2285,8 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
+ </target>
+
+ <target name="download-compile"
+- description="Download (and build) components necessary to compile" >
++ description="Download (and build) components necessary to compile"
++ unless="noget">
+
+ <antcall target="downloadfile-2">
+ <param name="sourcefile.1" value="${tomcat-native.loc.1}"/>
+@@ -2335,7 +2343,8 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
+ </target>
+
+ <target name="download-test-compile"
+- description="Download additional components for the tests" >
++ description="Download additional components for the tests"
++ unless="noget">
+
+ <antcall target="downloadzip">
+ <param name="sourcefile" value="${junit.loc}"/>
+@@ -2346,7 +2355,8 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform.
+ </target>
+
+ <target name="download-dist"
+- description="Download additional components for a distribution" >
++ description="Download additional components for a distribution"
++ unless="noget">
+
+ <antcall target="downloadzip-2">
+ <param name="sourcefile.1" value="${tomcat-native.win.1}"/>
diff --git a/www-servers/tomcat/files/tomcat-instance-manager.bash b/www-servers/tomcat/files/tomcat-instance-manager.bash
new file mode 100644
index 000000000000..fcdfebf21495
--- /dev/null
+++ b/www-servers/tomcat/files/tomcat-instance-manager.bash
@@ -0,0 +1,240 @@
+#!/bin/bash
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Author: Ralph Sennhauser <sera@gentoo.org>
+
+die() {
+ echo "${@}"
+ exit 1
+}
+
+usage() {
+ cat <<EOL
+Usage: ${BASH_SOURCE} <--create|--remove|--help> [--suffix s][--user u][--group g]
+
+ Options:
+ --help:
+ show this text.
+ --create:
+ create a new instance
+ --remove:
+ remove an existing instance.
+ --suffix SUFFIX:
+ a suffix for this instance. the suffix may not collide with an already
+ existing instance, defaults to empty.
+ --user USER:
+ the user for which to configure this instance for. The user needs to
+ exist already. defaults to tomcat.
+ --group GROUP:
+ the group for which to configure this instance for. The group needs to
+ exist already. defaults to tomcat.
+
+ Examples:
+ ${BASH_SOURCE} --create --suffix testing --user tacmot --group tacmot
+ ${BASH_SOURCE} --remove --suffix testing
+EOL
+}
+
+parse_argv() {
+ action="not specified"
+ instance_name="tomcat-@SLOT@"
+ instance_user="tomcat"
+ instance_group="tomcat"
+
+ while [[ -n $1 ]]; do
+ case $1 in
+ --help)
+ usage
+ exit 0;;
+ --suffix)
+ instance_name+="-$2"
+ shift; shift;;
+ --user)
+ instance_user="$2"
+ shift; shift;;
+ --group)
+ instance_group="$2"
+ shift; shift;;
+ --create)
+ action=create
+ shift;;
+ --remove)
+ action=remove
+ shift;;
+ --backup)
+ action=backup
+ shift;;
+ --restore)
+ action=restore
+ shift;;
+ --update)
+ action=update
+ shift;;
+ *)
+ echo "Invalid option '$1'"
+ usage
+ exit 2;;
+ esac
+ done
+
+ tomcat_home="/@GENTOO_PORTAGE_EPREFIX@usr/share/tomcat-@SLOT@"
+ instance_base="/@GENTOO_PORTAGE_EPREFIX@var/lib/${instance_name}"
+ instance_conf="/@GENTOO_PORTAGE_EPREFIX@etc/${instance_name}"
+ instance_logs="/@GENTOO_PORTAGE_EPREFIX@var/log/${instance_name}"
+ instance_temp="/@GENTOO_PORTAGE_EPREFIX@var/tmp/${instance_name}"
+
+ all_targets=(
+ "${instance_base}"
+ "${instance_logs}"
+ "${instance_temp}"
+ "/@GENTOO_PORTAGE_EPREFIX@etc/${instance_name}"
+ "/@GENTOO_PORTAGE_EPREFIX@etc/init.d/${instance_name}"
+ "/@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${instance_name}"
+ )
+}
+
+test_can_deploy() {
+ local no_deploy target
+ for target in "${all_targets[@]}"; do
+ if [[ -e "${target}" ]]; then
+ echo "Error: '${target}' already exists."
+ no_deploy=yes
+ fi
+ done
+ if [[ -n "${no_deploy}" ]]; then
+ cat <<-EOL
+
+ To protect an existing installation no new instance was deployed. You can use
+ '${BASH_SOURCE} --remove'
+ to remove an existing instance first or run
+ '${BASH_SOURCE} --create --sufix <instance_suffix>'
+ to deploy an instance under a different name
+
+ EOL
+ usage
+ exit 1
+ fi
+
+ if ! id --user "${instance_user}" >/dev/null 2>&1; then
+ echo "Error: user '${instance_user}' doesn't exist."
+ exit 1
+ fi
+
+ if ! id --group "${instance_group}" >/dev/null 2>&1; then
+ echo "Error: group '${instance_group}' doesn't exist."
+ exit 1
+ fi
+}
+
+deploy_instance() {
+ test_can_deploy
+
+ mkdir -p "${instance_base}"/{work,webapps} || die
+ mkdir -p "${instance_logs}" || die
+ mkdir -p "${instance_temp}" || die
+
+ cp -r "${tomcat_home}"/webapps/ROOT "${instance_base}"/webapps || die
+
+ chown -R "${instance_user}":"${instance_group}" \
+ "${instance_base}" "${instance_logs}" "${instance_temp}" || die
+
+ find "${instance_base}"/webapps -type d -exec chmod 750 {} + || die
+ find "${instance_base}"/webapps -type f -exec chmod 640 {} + || die
+
+ # initial config #
+
+ cp -r "${tomcat_home}"/conf "${instance_conf}" || die
+
+ sed -i -e "s|\${catalina.base}/logs|${instance_logs}|" \
+ "${instance_conf}"/logging.properties || die
+ sed -i -e "s|directory=\"logs\"|directory=\"${instance_logs}\"|" \
+ "${instance_conf}"/server.xml || die
+
+ mkdir -p "${instance_conf}"/Catalina/localhost || die
+ cat > "${instance_conf}"/Catalina/localhost/host-manager.xml <<-'EOF'
+ <?xml version="1.0" encoding="UTF-8"?>
+ <Context docBase="${catalina.home}/webapps/host-manager"
+ antiResourceLocking="false" privileged="true" />
+ EOF
+
+ cat > "${instance_conf}"/Catalina/localhost/manager.xml <<-'EOF'
+ <?xml version="1.0" encoding="UTF-8"?>
+ <Context docBase="${catalina.home}/webapps/manager"
+ antiResourceLocking="false" privileged="true" />
+ EOF
+
+ if [[ -d "${tomcat_home}"/webapps/docs ]]; then
+ cat > "${instance_conf}"/Catalina/localhost/docs.xml <<-'EOF'
+ <?xml version="1.0" encoding="UTF-8"?>
+ <Context docBase="${catalina.home}/webapps/docs" />
+ EOF
+ fi
+
+ if [[ -d "${tomcat_home}"/webapps/examples ]]; then
+ cat > "${instance_conf}"/Catalina/localhost/examples.xml <<-'EOF'
+ <?xml version="1.0" encoding="UTF-8"?>
+ <Context docBase="${catalina.home}/webapps/examples" />
+ EOF
+ fi
+
+ chown -R "${instance_user}":"${instance_group}" "${instance_conf}" || die
+ find "${instance_conf}" -type d -exec chmod 750 {} + || die
+ find "${instance_conf}" -type f -exec chmod 640 {} + || die
+
+ # rc script #
+
+ cp "${tomcat_home}"/gentoo/tomcat.init \
+ "/@GENTOO_PORTAGE_EPREFIX@etc/init.d/${instance_name}" || die
+
+ sed -e "s|@INSTANCE_NAME@|${instance_name}|g" \
+ -e "s|@INSTANCE_USER@|${instance_user}|g" \
+ -e "s|@INSTANCE_GROUP@|${instance_group}|g" \
+ "${tomcat_home}"/gentoo/tomcat.conf \
+ > "/@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${instance_name}" || die
+
+ # some symlinks for tomcat and netbeans #
+
+ ln -s "${instance_conf}" "${instance_base}"/conf || die
+ ln -s "${instance_temp}" "${instance_base}"/temp || die
+
+ # a note to update the default configuration #
+
+ cat <<-EOL
+ Successfully created instance '${instance_name}'
+ It's strongly recommended for production systems to go carefully through the
+ configuration files at '${instance_conf}'.
+ The generated initial configuration is close to upstreams default which
+ favours the demo aspect over hardening.
+ EOL
+}
+
+remove_instance() {
+ echo "The following files will be removed permanently:"
+ local target; for target in "${all_targets[@]}"; do
+ find ${target}
+ done
+
+ echo "Type 'yes' to continue"
+ read
+ if [[ ${REPLY} == yes ]]; then
+ rm -rv "${all_targets[@]}"
+ else
+ echo "Aborting as requested ..."
+ fi
+}
+
+parse_argv "$@"
+
+if [[ ${action} == create ]]; then
+ deploy_instance
+elif [[ ${action} == remove ]]; then
+ remove_instance
+elif [[ ${action} == "not specified" ]]; then
+ echo "No action specified!"
+ usage
+ exit 1
+else
+ echo "${action} not yet implemented!"
+ usage
+ exit 1
+fi
diff --git a/www-servers/tomcat/files/tomcat.conf b/www-servers/tomcat/files/tomcat.conf
new file mode 100644
index 000000000000..a27f93342678
--- /dev/null
+++ b/www-servers/tomcat/files/tomcat.conf
@@ -0,0 +1,49 @@
+# Set the handle of the JVM to use. If unset uses the system-vm.
+# run 'eselect java-vm list' to get possible values.
+#
+#TOMCAT_JVM="icedtea-7"
+
+# Additional options to pass to the JVM.
+# Example to set library path for tomcat-native:
+# JAVA_OPTS="-Djava.library.path=/usr/lib"
+#
+#JAVA_OPTS=""
+
+# Additional packages to put on the default classpath.
+# jakarta-jstl is needed for some of the examples.
+# Note: The extra jars listed here will be visible to webapps.
+# Example:
+# TOMCAT_EXTRA_JARS="jakarta-jstl,xerces-2"
+#
+#TOMCAT_EXTRA_JARS=""
+
+# User/Group of this instance.
+CATALINA_USER=@INSTANCE_USER@
+CATALINA_GROUP=@INSTANCE_GROUP@
+
+# Directory path location of temporary directory the JVM should
+# use (java.io.tmpdir).
+# Note: This directory must exist and be read/writable by tomcat.
+# See #246362 as an example where /var/tmp was deleted on shutdown.
+#
+#CATALINA_TMPDIR="/@GENTOO_PORTAGE_EPREFIX@var/tmp/@INSTANCE_NAME@"
+
+# TOMCAT STARTUP
+# debug Start Catalina in a debugger
+# -security debug Debug Catalina with a security manager
+# jpda start Start Catalina under JPDA debugger
+# start Start Catalina in a separate window
+# -security start Start in a separate window with security manager
+#
+#TOMCAT_START="start"
+
+# Java Platform Debugger Architecture (JPDA)
+# http://java.sun.com/products/jpda/
+# Override default JPDA address and transport for the "jpda start" command.
+#
+#JPDA_ADDRESS="8000"
+#JPDA_TRANSPORT="dt_socket"
+
+# Additional options to pass to catalina
+#
+#CATALINA_OPTS=""
diff --git a/www-servers/tomcat/files/tomcat.init b/www-servers/tomcat/files/tomcat.init
new file mode 100644
index 000000000000..b076f99b6bdf
--- /dev/null
+++ b/www-servers/tomcat/files/tomcat.init
@@ -0,0 +1,104 @@
+#!/@GENTOO_PORTAGE_EPREFIX@sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="forcestop"
+
+PIDFILE=/@GENTOO_PORTAGE_EPREFIX@var/run/${RC_SVCNAME}.pid
+
+: ${CATALINA_HOME:=/@GENTOO_PORTAGE_EPREFIX@usr/share/tomcat-@SLOT@}
+: ${CATALINA_BASE:=/@GENTOO_PORTAGE_EPREFIX@var/lib/${RC_SVCNAME}}
+: ${CATALINA_TMPDIR:=/@GENTOO_PORTAGE_EPREFIX@var/tmp/${RC_SVCNAME}}
+: ${CATALINA_USER:=tomcat}
+: ${CATALINA_GROUP:=tomcat}
+
+: ${TOMCAT_START:=start}
+
+: ${JPDA_TRANSPORT:="dt_socket"}
+: ${JPDA_ADDRESS:="8000"}
+: ${JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT},address=${JPDA_ADDRESS},server=y,suspend=n"}
+
+export JAVA_HOME=`java-config ${TOMCAT_JVM:+--select-vm ${TOMCAT_JVM}} --jre-home`
+
+CLASSPATH=`java-config --classpath tomcat-@SLOT@${TOMCAT_EXTRA_JARS:+,${TOMCAT_EXTRA_JARS}}`
+export CLASSPATH="${CLASSPATH}${TOMCAT_EXTRA_CLASSPATH:+:${TOMCAT_EXTRA_CLASSPATH}}"
+
+depend() {
+ use dns logger net
+}
+
+start() {
+ ebegin "Starting ${RC_SVCNAME}"
+
+ if [ ! -e "${CATALINA_TMPDIR}" ]; then
+ eerror "CATALINA_TMPDIR does not exist. Unable to start tomcat."
+ eerror "Please see /@GENTOO_PORTAGE_EPREFIX@etc/conf.d/${RC_SVCNAME} for more information."
+ eend 1
+ fi
+
+ cmd=java args=
+ if [ "${TOMCAT_START}" = "debug" ] || [ "${TOMCAT_START}" = "-security debug" ] ; then
+ cmd=jdb
+ args="${args} -sourcepath ${CATALINA_HOME}/../../jakarta-tomcat-catalina/catalina/src/share"
+ fi
+ if [ "${TOMCAT_START}" = "-security debug" ] || [ "${TOMCAT_START}" = "-security start" ]; then
+ args="${args} -Djava.security.manager"
+ args="${args} -Djava.security.policy=${CATALINA_BASE}/conf/catalina.policy"
+ fi
+ if [ "${TOMCAT_START}" = "jpda start" ] ; then
+ args="${args} ${JPDA_OPTS}"
+ fi
+ if [ -r "${CATALINA_HOME}"/bin/tomcat-juli.jar ]; then
+ JAVA_OPTS="${JAVA_OPTS} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
+ -Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties"
+ fi
+
+ start-stop-daemon --start \
+ --quiet --background \
+ --chdir "${CATALINA_TMPDIR}" \
+ --user ${CATALINA_USER}:${CATALINA_GROUP} \
+ --make-pidfile --pidfile ${PIDFILE} \
+ --exec ${JAVA_HOME}/bin/${cmd} \
+ -- \
+ ${JAVA_OPTS} \
+ -Dcatalina.base="${CATALINA_BASE}" \
+ -Dcatalina.home="${CATALINA_HOME}" \
+ -Djava.io.tmpdir="${CATALINA_TMPDIR}" \
+ -classpath "${CLASSPATH}" \
+ org.apache.catalina.startup.Bootstrap \
+ ${CATALINA_OPTS} \
+ ${args} ${TOMCAT_START}
+
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping '${RC_SVCNAME}'"
+
+ start-stop-daemon --stop \
+ --quiet --retry=60 \
+ --pidfile ${PIDFILE} \
+ --exec ${JAVA_HOME}/bin/java \
+ -- \
+ ${JAVA_OPTS} \
+ -classpath "${CLASSPATH}" \
+ ${CATALINA_OPTS} \
+ stop ${STD_OUT}
+
+ eend $?
+}
+
+forcestop() {
+ ebegin "Forcing '${RC_SVCNAME}' to stop"
+
+ start-stop-daemon --stop \
+ --quiet --retry=60 \
+ --pidfile ${PIDFILE} \
+ --signal=9
+
+ if service_started "${RC_SVCNAME}"; then
+ mark_service_stopped "${RC_SVCNAME}"
+ fi
+
+ eend $?
+}
diff --git a/www-servers/tomcat/metadata.xml b/www-servers/tomcat/metadata.xml
index 349379c953f8..f957b79d7d7b 100644
--- a/www-servers/tomcat/metadata.xml
+++ b/www-servers/tomcat/metadata.xml
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
- <herd>java</herd>
- <longdescription>
- Tomcat is the servlet container that is used in the official Reference
- Implementation for the Java Servlet and JavaServer Pages technologies.
- The Java Servlet and JavaServer Pages specifications are developed by
- Sun under the Java Community Process.
- </longdescription>
+ <herd>java</herd>
+ <longdescription>
+ Tomcat is the servlet container that is used in the official Reference
+ Implementation for the Java Servlet and JavaServer Pages technologies.
+ The Java Servlet and JavaServer Pages specifications are developed by
+ Sun under the Java Community Process.
+ </longdescription>
+ <use>
+ <flag name='extra-webapps'>Build also the docs and examples webapp</flag>
+ </use>
</pkgmetadata>
diff --git a/www-servers/tomcat/tomcat-6.0.35-r1.ebuild b/www-servers/tomcat/tomcat-6.0.35-r1.ebuild
new file mode 100644
index 000000000000..7243e1b13bd5
--- /dev/null
+++ b/www-servers/tomcat/tomcat-6.0.35-r1.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/tomcat/tomcat-6.0.35-r1.ebuild,v 1.1 2012/07/20 17:36:54 sera Exp $
+
+EAPI=4
+
+JAVA_PKG_IUSE="source test"
+
+inherit eutils java-pkg-2 java-ant-2 prefix
+
+MY_P="apache-${P}-src"
+
+DESCRIPTION="Tomcat Servlet-2.5/JSP-2.1 Container"
+HOMEPAGE="http://tomcat.apache.org/"
+SRC_URI="mirror://apache/${PN}/tomcat-6/v${PV}/src/${MY_P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="6"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="extra-webapps"
+
+RESTRICT="test"
+
+ECJ_SLOT="3.7"
+SAPI_SLOT="2.5"
+
+COMMON_DEP="
+ dev-java/eclipse-ecj:${ECJ_SLOT}
+ ~dev-java/tomcat-servlet-api-${PV}
+ extra-webapps? ( dev-java/jakarta-jstl:0 )"
+RDEPEND="${COMMON_DEP}
+ !<dev-java/tomcat-native-1.1.20
+ >=virtual/jre-1.5"
+DEPEND="${COMMON_DEP}
+ >=virtual/jdk-1.5
+ >=dev-java/ant-core-1.8.1:0
+ test? (
+ dev-java/ant-junit:0
+ dev-java/junit:4
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+ enewgroup tomcat 265
+ enewuser tomcat 265 -1 /dev/null tomcat
+}
+
+java_prepare() {
+ find -name '*.jar' -exec rm -v {} + || die
+ epatch "${FILESDIR}/${P}-build.xml.patch"
+
+ # For use of catalina.sh in netbeans
+ sed -i -e "/^# ----- Execute The Requested Command/ a\
+ CLASSPATH=\`java-config --classpath ${PN}-${SLOT}\`" \
+ bin/catalina.sh || die
+}
+
+JAVA_ANT_REWRITE_CLASSPATH="true"
+
+EANT_BUILD_TARGET="deploy"
+EANT_DOC_TARGET=""
+EANT_GENTOO_CLASSPATH="tomcat-servlet-api-${SAPI_SLOT},eclipse-ecj-${ECJ_SLOT}"
+EANT_GENTOO_CLASSPATH_EXTRA="${S}/output/classes"
+EANT_NEEDS_TOOLS="true"
+EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false"
+
+src_compile() {
+ EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)"
+ java-pkg-2_src_compile
+}
+
+EANT_TEST_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},junit-4"
+
+src_test() {
+ java-pkg-2_src_test
+}
+
+src_install() {
+ local dest="/usr/share/${PN}-${SLOT}"
+
+ java-pkg_jarinto "${dest}"/bin
+ java-pkg_dojar output/build/bin/*.jar
+ exeinto "${dest}"/bin
+ doexe output/build/bin/*.sh
+
+ java-pkg_jarinto "${dest}"/lib
+ java-pkg_dojar output/build/lib/*.jar
+
+ # so we don't have to call java-config with --with-dependencies, which might
+ # bring in more jars then actually desired.
+ java-pkg_addcp "$(java-pkg_getjars eclipse-ecj-${ECJ_SLOT},tomcat-servlet-api-${SAPI_SLOT})"
+
+ dodoc RELEASE-NOTES RUNNING.txt
+ #use doc && java-pkg_dojavadoc output/dist/webapps/docs/api
+ use source && java-pkg_dosrc java/*
+
+ ### Webapps ###
+
+ insinto "${dest}"/webapps
+ doins -r output/build/webapps/{host-manager,manager,ROOT}
+ use extra-webapps && doins -r output/build/webapps/{docs,examples}
+
+ ### Config ###
+
+ # replace the default pw with a random one, see #92281
+ local randpw=$(echo ${RANDOM}|md5sum|cut -c 1-15)
+ sed -i -e "s|SHUTDOWN|${randpw}|" output/build/conf/server.xml || die
+
+ insinto "${dest}"
+ doins -r output/build/conf
+
+ ### rc ###
+
+ cp "${FILESDIR}"/tomcat{.conf,.init,-instance-manager.bash} "${T}" || die
+ eprefixify "${T}"/tomcat{.conf,.init,-instance-manager.bash}
+ sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,.init,-instance-manager.bash} || die
+
+ insinto "${dest}"/gentoo
+ doins "${T}"/tomcat.conf
+ exeinto "${dest}"/gentoo
+ doexe "${T}"/tomcat{.init,-instance-manager.bash}
+}
+
+pkg_postinst() {
+ elog "For how to deploy a server instance run:"
+ elog " ${EPREFIX}/usr/share/${PN}-${SLOT}/gentoo/tomcat-instance-manager.bash --help"
+
+ ewarn "tomcat-dbcp.jar is not built at this time. Please fetch jar"
+ ewarn "from upstream binary if you need it. Gentoo Bug # 144276"
+
+# einfo "Please read http://www.gentoo.org/proj/en/java/tomcat6-guide.xml for more information."
+}
diff --git a/www-servers/tomcat/tomcat-7.0.29-r1.ebuild b/www-servers/tomcat/tomcat-7.0.29-r1.ebuild
new file mode 100644
index 000000000000..f3219f0d7d4d
--- /dev/null
+++ b/www-servers/tomcat/tomcat-7.0.29-r1.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/tomcat/tomcat-7.0.29-r1.ebuild,v 1.1 2012/07/20 17:36:54 sera Exp $
+
+EAPI=4
+
+JAVA_PKG_IUSE="doc source test"
+
+inherit eutils java-pkg-2 java-ant-2 prefix
+
+MY_P="apache-${P}-src"
+
+DESCRIPTION="Tomcat Servlet-3.0/JSP-2.2 Container"
+HOMEPAGE="http://tomcat.apache.org/"
+SRC_URI="mirror://apache/${PN}/tomcat-7/v${PV}/src/${MY_P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="7"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-fbsd"
+IUSE="extra-webapps"
+
+RESTRICT="test" # can we run them on a production system?
+
+ECJ_SLOT="3.7"
+SAPI_SLOT="3.0"
+
+COMMON_DEP="
+ dev-java/eclipse-ecj:${ECJ_SLOT}
+ ~dev-java/tomcat-servlet-api-${PV}
+ extra-webapps? ( dev-java/jakarta-jstl:0 )"
+RDEPEND="${COMMON_DEP}
+ !<dev-java/tomcat-native-1.1.20
+ >=virtual/jre-1.6"
+DEPEND="${COMMON_DEP}
+ >=virtual/jdk-1.6
+ >=dev-java/ant-core-1.8.1:0
+ test? (
+ dev-java/ant-junit:0
+ dev-java/junit:4
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+ enewgroup tomcat 265
+ enewuser tomcat 265 -1 /dev/null tomcat
+}
+
+java_prepare() {
+ find -name '*.jar' -exec rm -v {} + || die
+ epatch "${FILESDIR}/${P}-build.xml.patch"
+
+ # For use of catalina.sh in netbeans
+ sed -i -e "/^# ----- Execute The Requested Command/ a\
+ CLASSPATH=\`java-config --classpath ${PN}-${SLOT}\`" \
+ bin/catalina.sh || die
+}
+
+JAVA_ANT_REWRITE_CLASSPATH="true"
+
+EANT_BUILD_TARGET="deploy"
+EANT_GENTOO_CLASSPATH="tomcat-servlet-api-${SAPI_SLOT},eclipse-ecj-${ECJ_SLOT}"
+EANT_GENTOO_CLASSPATH_EXTRA="${S}/output/classes"
+EANT_NEEDS_TOOLS="true"
+EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false"
+
+src_compile() {
+ EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)"
+ java-pkg-2_src_compile
+}
+
+EANT_TEST_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},junit-4"
+
+src_test() {
+ java-pkg-2_src_test
+}
+
+src_install() {
+ local dest="/usr/share/${PN}-${SLOT}"
+
+ java-pkg_jarinto "${dest}"/bin
+ java-pkg_dojar output/build/bin/*.jar
+ exeinto "${dest}"/bin
+ doexe output/build/bin/*.sh
+
+ java-pkg_jarinto "${dest}"/lib
+ java-pkg_dojar output/build/lib/*.jar
+
+ # so we don't have to call java-config with --with-dependencies, which might
+ # bring in more jars then actually desired.
+ java-pkg_addcp "$(java-pkg_getjars eclipse-ecj-${ECJ_SLOT},tomcat-servlet-api-${SAPI_SLOT})"
+
+ dodoc RELEASE-NOTES RUNNING.txt
+ use doc && java-pkg_dojavadoc output/dist/webapps/docs/api
+ use source && java-pkg_dosrc java/*
+
+ ### Webapps ###
+
+ insinto "${dest}"/webapps
+ doins -r output/build/webapps/{host-manager,manager,ROOT}
+ use extra-webapps && doins -r output/build/webapps/{docs,examples}
+
+ ### Config ###
+
+ # replace the default pw with a random one, see #92281
+ local randpw=$(echo ${RANDOM}|md5sum|cut -c 1-15)
+ sed -i -e "s|SHUTDOWN|${randpw}|" output/build/conf/server.xml || die
+
+ insinto "${dest}"
+ doins -r output/build/conf
+
+ ### rc ###
+
+ cp "${FILESDIR}"/tomcat{.conf,.init,-instance-manager.bash} "${T}" || die
+ eprefixify "${T}"/tomcat{.conf,.init,-instance-manager.bash}
+ sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,.init,-instance-manager.bash} || die
+
+ insinto "${dest}"/gentoo
+ doins "${T}"/tomcat.conf
+ exeinto "${dest}"/gentoo
+ doexe "${T}"/tomcat{.init,-instance-manager.bash}
+}
+
+pkg_postinst() {
+ elog "For how to deploy a server instance run:"
+ elog " ${EPREFIX}/usr/share/${PN}-${SLOT}/gentoo/tomcat-instance-manager.bash --help"
+
+ ewarn "tomcat-dbcp.jar is not built at this time. Please fetch jar"
+ ewarn "from upstream binary if you need it. Gentoo Bug # 144276"
+
+# einfo "Please read http://www.gentoo.org/proj/en/java/tomcat6-guide.xml for more information."
+}