From baa11b4a987504b74752bbf8f60813064fa84230 Mon Sep 17 00:00:00 2001 From: Miroslav Šulc Date: Wed, 16 Oct 2019 10:36:11 +0200 Subject: www-servers/tomcat-8.0.53: moved from main repo (eol) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Package-Manager: Portage-2.3.77, Repoman-2.3.17 Signed-off-by: Miroslav Šulc --- www-servers/tomcat/Manifest | 7 + .../tomcat/files/tomcat-8.0.53-build.xml.patch | 270 +++++++++++++++++++++ .../tomcat/files/tomcat-instance-manager-r2.bash | 270 +++++++++++++++++++++ www-servers/tomcat/files/tomcat-r1.init | 110 +++++++++ www-servers/tomcat/files/tomcat.conf | 57 +++++ www-servers/tomcat/metadata.xml | 17 ++ www-servers/tomcat/tomcat-8.0.53.ebuild | 159 ++++++++++++ 7 files changed, 890 insertions(+) create mode 100644 www-servers/tomcat/Manifest create mode 100644 www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch create mode 100644 www-servers/tomcat/files/tomcat-instance-manager-r2.bash create mode 100644 www-servers/tomcat/files/tomcat-r1.init create mode 100644 www-servers/tomcat/files/tomcat.conf create mode 100644 www-servers/tomcat/metadata.xml create mode 100644 www-servers/tomcat/tomcat-8.0.53.ebuild diff --git a/www-servers/tomcat/Manifest b/www-servers/tomcat/Manifest new file mode 100644 index 000000000..209888d90 --- /dev/null +++ b/www-servers/tomcat/Manifest @@ -0,0 +1,7 @@ +AUX tomcat-8.0.53-build.xml.patch 10949 BLAKE2B 2693f3e74a69967ceeb5f4ee41756b840da5bc2ab3c64cb855d52bd099bad8d6115f1d01903bacdcb634c24b9085dbb2ef34027f71325f887f20826721b268aa SHA512 20373a340dcb17595e7ff52608e8d3d3b1eddd5f0104b588c5f91b21eb4510047df61a0dfd9ed8674fb7b0b709945d5014d6e1cad4027414ff9e72c2b5d56cfc +AUX tomcat-instance-manager-r2.bash 6996 BLAKE2B 23991da5a19b826d1ab4cb442ec0fe26ade5b55c2d0fb7442f0d299e7680c1218b2fb0512289463f4cd8be692dc3e35f3bec66794a6ef2365e81405dc00b50de SHA512 37e95de6a05b237343d72d8dcb7a2e93d395b446ff7e466d04f3e98e3bcc9fc0b278e151253883d1c7ec1a3343a35c512837ac30a008d58ab07274f19d54bd60 +AUX tomcat-r1.init 3197 BLAKE2B f4492201ea711c989990a5a33a63410e1ffd2720442a60b76a2c3413630c908dda6848ee9772bc52bc6aca78310935fed22a543ee50e0db77221cc12a0158a92 SHA512 50f0db4d098c1baf5381b1512ac80a840e86583320f1ed63e80368b537cea9953d914052c0624a8c093c832861969968efaf8b021f1bd699f1a28a20d3484704 +AUX tomcat.conf 1811 BLAKE2B a92606e113172c6f0f73e18ab8ad8796f38bd8c741bb2fd1f6c43d7682728729d0198d4150e42282c7e732750231b7cdbfb51de9b24f2ba780a22700965113c5 SHA512 0747dd2fdad6c68123425adce39f625d34924ae3e7c9d5a00361565a593047d7a4d01dee64c1ef831e5ad79b51750babaf642b0588d4b5948bbed441d53d654d +DIST apache-tomcat-8.0.53-src.tar.gz 5057041 BLAKE2B 3a50d2f61baecb5244909972384e36478c69e7592dd35119d8b7b974273c57a4855082f309146ed160144dbdcced3236fd586b047970bd8558bbe7b7e002e9fd SHA512 0b56bc723277b2888896ab34ec3e49cb56bac94ddf1a9b96bd023982e2ffabd5317f63b3c0971afdc8cd7a6364197409df461d22151dbaab3a2be7daf6858b9e +EBUILD tomcat-8.0.53.ebuild 4545 BLAKE2B 44a91072cfebcd628579e6859bd6769b5a6c0f6c95d09e7771324bbe3c46ca617ec727338999c7c071c2e5530a3d66d25967f7ae31788ccf7d7d902ca3c0fa97 SHA512 a812d3991b012e5b313b4269710fa15d78fd6b7edcf6b7d7a261fdbe51144389a4583a6eee96b33dbbc4fc0480fc91bf382e6c63f524f2c755ab67e0e82330eb +MISC metadata.xml 633 BLAKE2B 2569991986199138317c46b270fd102782c7f122a7b750c4d30a41a08ca207431546b834e74f32d5c10254b92b7a65f83e11793be779717cfc4eadbddf07e89b SHA512 dfdc75507ee120e3cf385aa07d229ab0df5189a70c7014883ac1546c44129fb42404c045f5e5db6633f60638207e3f16d5ef193b628412da20de5af3c82a53f1 diff --git a/www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch b/www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch new file mode 100644 index 000000000..eb12467b6 --- /dev/null +++ b/www-servers/tomcat/files/tomcat-8.0.53-build.xml.patch @@ -0,0 +1,270 @@ +diff --git a/build.xml b/build.xml +index 5ee1d86..ade4446 100644 +--- a/build.xml ++++ b/build.xml +@@ -723,24 +723,29 @@ + manifest="${tomcat.manifests}/annotations-api.jar.manifest" /> + + ++ + ++ + + ++ + + + +- ++ + + + +@@ -1072,7 +1077,7 @@ + + + +- ++ + + + +@@ -1108,7 +1113,7 @@ + + + +- ++ + + + + + +- ++ + + + + ++ + + + ++ + + + Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform. +@@ -1984,6 +1992,7 @@ Apache Tomcat ${version} native binaries for Win64 AMD64/EMT64 platform. + + ++ + + + ++ + + + +@@ -2821,7 +2833,7 @@ skip.installer property in build.properties" /> + + + ++ description="Download (and build) components necessary to compile" unless="noget"> + + + +@@ -2847,7 +2859,7 @@ skip.installer property in build.properties" /> + + + ++ description="Download additional components for the tests" unless="noget"> + + + +@@ -2925,7 +2937,7 @@ skip.installer property in build.properties" /> + + + ++ description="Download additional components for a distribution" unless="noget"> + + + +@@ -2980,13 +2992,13 @@ skip.installer property in build.properties" /> + + + +- ++ + + + + +- ++ + + + +@@ -3108,7 +3120,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3125,7 +3137,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3150,7 +3162,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3166,7 +3178,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3190,7 +3202,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3205,7 +3217,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3233,7 +3245,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3244,7 +3256,7 @@ skip.installer property in build.properties" /> + + + +- ++ + + + +@@ -3255,7 +3267,7 @@ skip.installer property in build.properties" /> + + ++ description="Prepares the source tree to be built in Eclipse" unless="noget"> + + + diff --git a/www-servers/tomcat/files/tomcat-instance-manager-r2.bash b/www-servers/tomcat/files/tomcat-instance-manager-r2.bash new file mode 100644 index 000000000..821101272 --- /dev/null +++ b/www-servers/tomcat/files/tomcat-instance-manager-r2.bash @@ -0,0 +1,270 @@ +#!/bin/bash +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# Author: Ralph Sennhauser + +die() { + echo "${@}" + exit 1 +} + +dir_is_empty() { + # usage: + # dir_is_empty + # + # returns 2 if the dir does not even exist + # returns 1 if the dir is not empty + # returns 0 (success) if the dir exists and is empty + + local dir=$1 + local files + + if [[ ! -e ${dir} ]] ; then + return 2 + fi + + shopt -s nullglob dotglob # To include hidden files + files=( "${dir}"/* ) + shopt -u nullglob dotglob + + if [[ ${#files[@]} -eq 0 ]]; then + return 0 + else + return 1 + fi + +} + +usage() { + cat < [--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 + if ! dir_is_empty "${target}" ; then + echo "Error: '${target}' already exists and is not empty." + no_deploy=yes + fi + 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 ' + to deploy an instance under a different name + + EOL + usage + exit 1 + fi + + if ! getent passwd | cut -d: -f1 | grep -Fx "${instance_user}" > /dev/null; then + echo "Error: user '${instance_user}' doesn't exist." + exit 1 + fi + + if ! getent group | cut -d: -f1 | grep -Fx "${instance_group}" > /dev/null; 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 + mkdir -p "${instance_conf}" || 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' + + + EOF + + cat > "${instance_conf}"/Catalina/localhost/manager.xml <<-'EOF' + + + EOF + + if [[ -d "${tomcat_home}"/webapps/docs ]]; then + cat > "${instance_conf}"/Catalina/localhost/docs.xml <<-'EOF' + + + EOF + fi + + if [[ -d "${tomcat_home}"/webapps/examples ]]; then + cat > "${instance_conf}"/Catalina/localhost/examples.xml <<-'EOF' + + + 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-r1.init b/www-servers/tomcat/files/tomcat-r1.init new file mode 100644 index 000000000..79074f080 --- /dev/null +++ b/www-servers/tomcat/files/tomcat-r1.init @@ -0,0 +1,110 @@ +#!/@GENTOO_PORTAGE_EPREFIX@sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# 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` +export CLASSPATH="${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar" + +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 + + local DEPEND=$(java-config --query DEPEND --package tomcat-@SLOT@):${TOMCAT_EXTRA_JARS} + DEPEND=${DEPEND%:} + + local GCLASSPATH=$(java-config --with-dependencies --classpath "${DEPEND//:/,}"):${TOMCAT_EXTRA_CLASSPATH} + GCLASSPATH=${GCLASSPATH%:} + + local 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 + args="${args} -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} \ + ${args} \ + -Dcatalina.base="${CATALINA_BASE}" \ + -Dcatalina.home="${CATALINA_HOME}" \ + -Djava.io.tmpdir="${CATALINA_TMPDIR}" \ + -Dgentoo.classpath="${GCLASSPATH//:/,}" \ + -classpath "${CLASSPATH}" \ + org.apache.catalina.startup.Bootstrap \ + ${CATALINA_OPTS} \ + ${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/files/tomcat.conf b/www-servers/tomcat/files/tomcat.conf new file mode 100644 index 000000000..376af44ad --- /dev/null +++ b/www-servers/tomcat/files/tomcat.conf @@ -0,0 +1,57 @@ +# 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="" + +# Additional paths to put on the default classpath. +# These should be separated by the : character. +# Note: The extra jars listed here will be visible to webapps. +# Example: +# TOMCAT_EXTRA_CLASSPATH="/path/to/foo.jar:/path/to/bar.jar" +# +#TOMCAT_EXTRA_CLASSPATH="" + +# 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/metadata.xml b/www-servers/tomcat/metadata.xml new file mode 100644 index 000000000..f8fa41701 --- /dev/null +++ b/www-servers/tomcat/metadata.xml @@ -0,0 +1,17 @@ + + + + + fordfrog@gentoo.org + Miroslav Šulc + + + 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. + + + Build also the docs and examples webapp + + diff --git a/www-servers/tomcat/tomcat-8.0.53.ebuild b/www-servers/tomcat/tomcat-8.0.53.ebuild new file mode 100644 index 000000000..298aa96f8 --- /dev/null +++ b/www-servers/tomcat/tomcat-8.0.53.ebuild @@ -0,0 +1,159 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +JAVA_PKG_IUSE="doc source test" + +inherit eutils java-pkg-2 java-ant-2 prefix user + +MY_P="apache-${P}-src" + +DESCRIPTION="Tomcat Servlet-3.1/JSP-2.3/EL-3.0/WebSocket-1.1 Container" +HOMEPAGE="https://tomcat.apache.org/" +SRC_URI="mirror://apache/${PN}/tomcat-8/v${PV}/src/${MY_P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="8" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x86-solaris" +IUSE="extra-webapps" + +RESTRICT="test" # can we run them on a production system? + +ECJ_SLOT="4.5" +SAPI_SLOT="3.1" + +COMMON_DEP="dev-java/eclipse-ecj:${ECJ_SLOT} + dev-java/tomcat-servlet-api:${SAPI_SLOT}" +RDEPEND="${COMMON_DEP} + !=virtual/jre-1.7" +DEPEND="${COMMON_DEP} + app-admin/pwgen + >=dev-java/ant-core-1.9.13 + >=virtual/jdk-1.7 + test? ( + >=dev-java/ant-junit-1.9:0 + dev-java/easymock:3.2 + )" + +S=${WORKDIR}/${MY_P} + +pkg_setup() { + java-pkg-2_pkg_setup + enewgroup tomcat 265 + enewuser tomcat 265 -1 /dev/null tomcat +} + +src_prepare() { + default + + find -name '*.jar' -type f -delete -print || die + + # Remove bundled servlet-api + rm -rv java/javax/{el,servlet} || die + + eapply "${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-pkg-2_src_prepare +} + +JAVA_ANT_REWRITE_CLASSPATH="true" + +EANT_BUILD_TARGET="deploy" +EANT_GENTOO_CLASSPATH="eclipse-ecj-${ECJ_SLOT},tomcat-servlet-api-${SAPI_SLOT}" +EANT_TEST_GENTOO_CLASSPATH="easymock-3.2" +EANT_GENTOO_CLASSPATH_EXTRA="${S}/output/classes" +EANT_NEEDS_TOOLS="true" +EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false" + +# revisions of the scripts +IM_REV="-r2" +INIT_REV="-r1" + +src_compile() { + EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)" + java-pkg-2_src_compile +} + +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 + + dodoc RELEASE-NOTES RUNNING.txt + use doc && java-pkg_dojavadoc output/dist/webapps/docs/api + use source && java-pkg_dosrc java/* + + ### Webapps ### + + # add missing docBase + local apps="host-manager manager" + for app in ${apps}; do + sed -i -e "s|=\"true\" >|=\"true\" docBase=\"\$\{catalina.home\}/webapps/${app}\" >|" \ + output/build/webapps/${app}/META-INF/context.xml || die + done + + insinto "${dest}"/webapps + doins -r output/build/webapps/{host-manager,manager,ROOT} + use extra-webapps && doins -r output/build/webapps/{docs,examples} + + ### Config ### + + # create "logs" directory in $CATALINA_BASE + # and set correct perms, see #458890 + dodir "${dest}"/logs + fperms 0750 "${dest}"/logs + + # replace the default pw with a random one, see #92281 + local randpw="$(pwgen -s -B 15 1)" + sed -i -e "s|SHUTDOWN|${randpw}|" output/build/conf/server.xml || die + + # prepend gentoo.classpath to common.loader, see #453212 + sed -i -e 's/^common\.loader=/\0${gentoo.classpath},/' output/build/conf/catalina.properties || die + + insinto "${dest}" + doins -r output/build/conf + + ### rc ### + + cp "${FILESDIR}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} "${T}" || die + eprefixify "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} + sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,${INIT_REV}.init,-instance-manager${IM_REV}.bash} || die + + insinto "${dest}"/gentoo + doins "${T}"/tomcat.conf + exeinto "${dest}"/gentoo + newexe "${T}"/tomcat${INIT_REV}.init tomcat.init + newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash +} + +pkg_postinst() { + elog "New ebuilds of Tomcat support running multiple instances. If you used prior version" + elog "of Tomcat (<7.0.32), you have to migrate your existing instance to work with new Tomcat." + elog "You can find more information at https://wiki.gentoo.org/wiki/Apache_Tomcat" + + elog "To manage Tomcat instances, 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 https://wiki.gentoo.org/wiki/Apache_Tomcat and" + einfo "https://wiki.gentoo.org/wiki/Project:Java/Tomcat_6_Guide for more information." +} -- cgit v1.2.3-65-gdbad