Use https by default
[gentoo.git] / www-servers / tomcat / tomcat-6.0.44-r0.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 JAVA_PKG_IUSE="source test"
8
9 inherit eutils java-pkg-2 java-ant-2 prefix user
10
11 MY_P="apache-${P}-src"
12
13 DESCRIPTION="Tomcat Servlet-2.5/JSP-2.1 Container"
14 HOMEPAGE="http://tomcat.apache.org/"
15 SRC_URI="mirror://apache/${PN}/tomcat-6/v${PV}/src/${MY_P}.tar.gz"
16
17 LICENSE="Apache-2.0"
18 SLOT="6"
19 KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd"
20 IUSE="extra-webapps"
21
22 RESTRICT="test"
23
24 ECJ_SLOT="3.7"
25 SAPI_SLOT="2.5"
26
27 CDEPEND="dev-java/eclipse-ecj:${ECJ_SLOT}
28         dev-java/tomcat-servlet-api:${SAPI_SLOT}"
29 RDEPEND="${CDEPEND}
30         >=virtual/jre-1.6
31         !<dev-java/tomcat-native-1.1.20"
32 DEPEND="${CDEPEND}
33         >=virtual/jdk-1.6
34         >=dev-java/ant-core-1.8.1:0
35         test? (
36                 dev-java/ant-junit:0
37                 dev-java/junit:4
38         )"
39
40 S=${WORKDIR}/${MY_P}
41
42 pkg_setup() {
43         java-pkg-2_pkg_setup
44         enewgroup tomcat 265
45         enewuser tomcat 265 -1 /dev/null tomcat
46 }
47
48 java_prepare() {
49         find -name '*.jar' -exec rm -v {} + || die
50         epatch "${FILESDIR}/${P}-build.xml.patch"
51
52         # For use of catalina.sh in netbeans
53         sed -i -e "/^# ----- Execute The Requested Command/ a\
54                 CLASSPATH=\`java-config --classpath ${PN}-${SLOT}\`" \
55                 bin/catalina.sh || die
56 }
57
58 JAVA_ANT_REWRITE_CLASSPATH="true"
59
60 EANT_BUILD_TARGET="deploy"
61 EANT_DOC_TARGET=""
62 EANT_GENTOO_CLASSPATH="tomcat-servlet-api-${SAPI_SLOT},eclipse-ecj-${ECJ_SLOT}"
63 EANT_GENTOO_CLASSPATH_EXTRA="${S}/output/classes"
64 EANT_NEEDS_TOOLS="true"
65 EANT_EXTRA_ARGS="-Dversion=${PV}-gentoo -Dversion.number=${PV} -Dcompile.debug=false"
66
67 # revision of the instance-manager script
68 IM_REV="-r1"
69
70 src_compile() {
71         EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)"
72         java-pkg-2_src_compile
73 }
74
75 EANT_TEST_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},junit-4"
76
77 src_test() {
78         java-pkg-2_src_test
79 }
80
81 src_install() {
82         local dest="/usr/share/${PN}-${SLOT}"
83
84         java-pkg_jarinto "${dest}"/bin
85         java-pkg_dojar output/build/bin/*.jar
86         exeinto "${dest}"/bin
87         doexe output/build/bin/*.sh
88
89         java-pkg_jarinto "${dest}"/lib
90         java-pkg_dojar output/build/lib/*.jar
91
92         # so we don't have to call java-config with --with-dependencies, which might
93         # bring in more jars than actually desired.
94         java-pkg_addcp "$(java-pkg_getjars eclipse-ecj-${ECJ_SLOT},tomcat-servlet-api-${SAPI_SLOT})"
95
96         dodoc RELEASE-NOTES RUNNING.txt
97         use source && java-pkg_dosrc java/*
98
99         ### Webapps ###
100
101         insinto "${dest}"/webapps
102         doins -r output/build/webapps/{host-manager,manager,ROOT}
103         use extra-webapps && doins -r output/build/webapps/{docs,examples}
104
105         ### Config ###
106
107         # create "logs" directory in $CATALINA_BASE
108         # and set correct perms, see #458890
109         dodir "${dest}"/logs
110         fperms 0750 "${dest}"/logs
111
112         # replace the default pw with a random one, see #92281
113         local randpw=$(echo ${RANDOM}|md5sum|cut -c 1-15)
114         sed -i -e "s|SHUTDOWN|${randpw}|" output/build/conf/server.xml || die
115
116         insinto "${dest}"
117         doins -r output/build/conf
118
119         ### rc ###
120
121         cp "${FILESDIR}"/tomcat{.conf,.init,-instance-manager${IM_REV}.bash} "${T}" || die
122         eprefixify "${T}"/tomcat{.conf,.init,-instance-manager${IM_REV}.bash}
123         sed -i -e "s|@SLOT@|${SLOT}|g" "${T}"/tomcat{.conf,.init,-instance-manager${IM_REV}.bash} || die
124
125         insinto "${dest}"/gentoo
126         doins "${T}"/tomcat.conf
127         exeinto "${dest}"/gentoo
128         doexe "${T}"/tomcat.init
129         newexe "${T}"/tomcat-instance-manager${IM_REV}.bash tomcat-instance-manager.bash
130 }
131
132 pkg_postinst() {
133         elog "New ebuilds of Tomcat support running multiple instances. If you used prior version"
134         elog "of Tomcat (<6.0.36), you have to migrate your existing instance to work with new Tomcat."
135         elog "You can find more information at https://wiki.gentoo.org/wiki/Apache_Tomcat"
136
137         elog "To manage Tomcat instances, run:"
138         elog "  ${EPREFIX}/usr/share/${PN}-${SLOT}/gentoo/tomcat-instance-manager.bash --help"
139
140         ewarn "tomcat-dbcp.jar is not built at this time. Please fetch jar"
141         ewarn "from upstream binary if you need it. Gentoo Bug # 144276"
142
143 #       einfo "Please read https://www.gentoo.org/proj/en/java/tomcat6-guide.xml for more information."
144 }