1 |
# Copyright (c) 2000-2008, JPackage Project |
2 |
# All rights reserved. |
3 |
# |
4 |
# Redistribution and use in source and binary forms, with or without |
5 |
# modification, are permitted provided that the following conditions |
6 |
# are met: |
7 |
# |
8 |
# 1. Redistributions of source code must retain the above copyright |
9 |
# notice, this list of conditions and the following disclaimer. |
10 |
# 2. Redistributions in binary form must reproduce the above copyright |
11 |
# notice, this list of conditions and the following disclaimer in the |
12 |
# documentation and/or other materials provided with the |
13 |
# distribution. |
14 |
# 3. Neither the name of the JPackage Project nor the names of its |
15 |
# contributors may be used to endorse or promote products derived |
16 |
# from this software without specific prior written permission. |
17 |
# |
18 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 |
# |
30 |
|
31 |
%global jspspec 2.2 |
32 |
%global major_version 7 |
33 |
%global minor_version 0 |
34 |
%global micro_version 32 |
35 |
%global packdname apache-tomcat-%{version}-src |
36 |
%global servletspec 3.0 |
37 |
%global elspec 2.2 |
38 |
%global tcuid 91 |
39 |
|
40 |
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ |
41 |
%global basedir %{_var}/lib/%{name} |
42 |
%global appdir %{basedir}/webapps |
43 |
%global homedir %{_datadir}/%{name} |
44 |
%global bindir %{homedir}/bin |
45 |
%global confdir %{_sysconfdir}/%{name} |
46 |
%global libdir %{_javadir}/%{name} |
47 |
%global logdir %{_var}/log/%{name} |
48 |
%global cachedir %{_var}/cache/%{name} |
49 |
%global tempdir %{cachedir}/temp |
50 |
%global workdir %{cachedir}/work |
51 |
%global _initrddir %{_sysconfdir}/init.d |
52 |
%global _systemddir /lib/systemd/system |
53 |
|
54 |
Name: tomcat |
55 |
Epoch: 0 |
56 |
Version: %{major_version}.%{minor_version}.%{micro_version} |
57 |
Release: %mkrel 3 |
58 |
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API |
59 |
|
60 |
Group: Development/Java |
61 |
License: ASL 2.0 |
62 |
URL: http://tomcat.apache.org/ |
63 |
Source0: http://www.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz |
64 |
Source1: %{name}-%{major_version}.%{minor_version}.conf |
65 |
Source2: %{name}-%{major_version}.%{minor_version}.init |
66 |
Source3: %{name}-%{major_version}.%{minor_version}.sysconfig |
67 |
Source4: %{name}-%{major_version}.%{minor_version}.wrapper |
68 |
Source5: %{name}-%{major_version}.%{minor_version}.logrotate |
69 |
Source6: %{name}-%{major_version}.%{minor_version}-digest.script |
70 |
Source7: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script |
71 |
Source8: servlet-api-OSGi-MANIFEST.MF |
72 |
Source9: jsp-api-OSGi-MANIFEST.MF |
73 |
Source10: %{name}-%{major_version}.%{minor_version}-log4j.properties |
74 |
Source11: %{name}-%{major_version}.%{minor_version}.service |
75 |
Source12: el-api-OSGi-MANIFEST.MF |
76 |
Source13: jasper-el-OSGi-MANIFEST.MF |
77 |
Source14: jasper-OSGi-MANIFEST.MF |
78 |
Source15: tomcat-api-OSGi-MANIFEST.MF |
79 |
Source16: tomcat-juli-OSGi-MANIFEST.MF |
80 |
Source17: %{name}-%{major_version}.%{minor_version}-tomcat-sysd |
81 |
Source18: %{name}-%{major_version}.%{minor_version}-tomcat-jsvc-sysd |
82 |
Source19: %{name}-%{major_version}.%{minor_version}-jsvc.wrapper |
83 |
Source20: %{name}-%{major_version}.%{minor_version}-jsvc.service |
84 |
|
85 |
|
86 |
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch |
87 |
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch |
88 |
|
89 |
BuildArch: noarch |
90 |
|
91 |
BuildRequires: ant |
92 |
BuildRequires: ant-nodeps |
93 |
BuildRequires: ecj |
94 |
BuildRequires: findutils |
95 |
BuildRequires: apache-commons-collections |
96 |
BuildRequires: apache-commons-daemon |
97 |
BuildRequires: apache-commons-dbcp |
98 |
BuildRequires: apache-commons-pool |
99 |
BuildRequires: jakarta-taglibs-standard |
100 |
BuildRequires: java-devel >= 0:1.6.0 |
101 |
BuildRequires: jpackage-utils >= 0:1.7.0 |
102 |
BuildRequires: junit |
103 |
BuildRequires: log4j |
104 |
BuildRequires: geronimo-jaxrpc |
105 |
BuildRequires: wsdl4j |
106 |
BuildRequires: systemd-units |
107 |
BuildRequires: zip |
108 |
Requires: apache-commons-daemon |
109 |
Requires: apache-commons-logging |
110 |
Requires: apache-commons-collections |
111 |
Requires: apache-commons-dbcp |
112 |
Requires: apache-commons-pool |
113 |
Requires: java >= 0:1.6.0 |
114 |
Requires: procps |
115 |
Requires: %{name}-lib = %{epoch}:%{version}-%{release} |
116 |
Requires(pre): shadow-utils |
117 |
Requires(post): chkconfig |
118 |
Requires(preun): chkconfig |
119 |
Requires(post): systemd-units |
120 |
Requires(preun): systemd-units |
121 |
Requires(postun): systemd-units |
122 |
|
123 |
%description |
124 |
Tomcat is the servlet container that is used in the official Reference |
125 |
Implementation for the Java Servlet and JavaServer Pages technologies. |
126 |
The Java Servlet and JavaServer Pages specifications are developed by |
127 |
Sun under the Java Community Process. |
128 |
|
129 |
Tomcat is developed in an open and participatory environment and |
130 |
released under the Apache Software License version 2.0. Tomcat is intended |
131 |
to be a collaboration of the best-of-breed developers from around the world. |
132 |
|
133 |
%package admin-webapps |
134 |
Group: Development/Java |
135 |
Summary: The host-manager and manager web applications for Apache Tomcat |
136 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
137 |
|
138 |
%description admin-webapps |
139 |
The host-manager and manager web applications for Apache Tomcat. |
140 |
|
141 |
%package docs-webapp |
142 |
Group: Development/Java |
143 |
Summary: The docs web application for Apache Tomcat |
144 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
145 |
|
146 |
%description docs-webapp |
147 |
The docs web application for Apache Tomcat. |
148 |
|
149 |
%package javadoc |
150 |
Group: Development/Java |
151 |
Summary: Javadoc generated documentation for Apache Tomcat |
152 |
Requires: jpackage-utils |
153 |
|
154 |
%description javadoc |
155 |
Javadoc generated documentation for Apache Tomcat. |
156 |
|
157 |
%package systemv |
158 |
Group: Development/Java |
159 |
Summary: Systemv scripts for Apache Tomcat |
160 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
161 |
Requires(post): chkconfig |
162 |
Requires(postun): chkconfig |
163 |
|
164 |
%description systemv |
165 |
SystemV scripts to start and stop tomcat service |
166 |
|
167 |
%package jsvc |
168 |
Group: Development/Java |
169 |
Summary: Apache jsvc wrapper for Apache Tomcat as separate service |
170 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
171 |
Requires: apache-commons-daemon-jsvc |
172 |
|
173 |
%description jsvc |
174 |
Systemd service and wrapper scripts to start tomcat with jsvc, |
175 |
which allows tomcat to perform some privileged operations |
176 |
(e.g. bind to a port < 1024) and then switch identity to a non-privileged user. |
177 |
|
178 |
%package jsp-%{jspspec}-api |
179 |
Group: Development/Java |
180 |
Summary: Apache Tomcat JSP API implementation classes |
181 |
Provides: jsp = %{jspspec} |
182 |
Provides: jsp22 |
183 |
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} |
184 |
|
185 |
%description jsp-%{jspspec}-api |
186 |
Apache Tomcat JSP API implementation classes. |
187 |
|
188 |
|
189 |
%package lib |
190 |
Group: Development/Java |
191 |
Summary: Libraries needed to run the Tomcat Web container |
192 |
Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release} |
193 |
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} |
194 |
Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release} |
195 |
Requires: ecj |
196 |
Requires: apache-commons-collections |
197 |
Requires: apache-commons-dbcp |
198 |
Requires: apache-commons-pool |
199 |
Requires(preun): coreutils |
200 |
|
201 |
%description lib |
202 |
Libraries needed to run the Tomcat Web container. |
203 |
|
204 |
%package servlet-%{servletspec}-api |
205 |
Group: Development/Java |
206 |
Summary: Apache Tomcat Servlet API implementation classes |
207 |
Provides: servlet = %{servletspec} |
208 |
Provides: servlet6 |
209 |
Provides: servlet3 |
210 |
|
211 |
%description servlet-%{servletspec}-api |
212 |
Apache Tomcat Servlet API implementation classes. |
213 |
|
214 |
%package el-%{elspec}-api |
215 |
Group: Development/Java |
216 |
Summary: Expression Language v1.0 API |
217 |
Provides: el_1_0_api = %{epoch}:%{version}-%{release} |
218 |
Provides: el_api = %{elspec} |
219 |
|
220 |
%description el-%{elspec}-api |
221 |
Expression Language 1.0. |
222 |
|
223 |
%package webapps |
224 |
Group: Development/Java |
225 |
Summary: The ROOT and examples web applications for Apache Tomcat |
226 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
227 |
Requires: jakarta-taglibs-standard >= 0:1.1 |
228 |
|
229 |
%description webapps |
230 |
The ROOT and examples web applications for Apache Tomcat. |
231 |
|
232 |
%prep |
233 |
%setup -q -n %{packdname} |
234 |
# remove pre-built binaries and windows files |
235 |
find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \ |
236 |
-name "*.jar" -o -name "*.war" -o -name "*.zip" \) -delete |
237 |
|
238 |
%patch0 -p0 |
239 |
%patch1 -p0 |
240 |
%{__ln_s} $(build-classpath jakarta-taglibs-core) webapps/examples/WEB-INF/lib/jstl.jar |
241 |
%{__ln_s} $(build-classpath jakarta-taglibs-standard) webapps/examples/WEB-INF/lib/standard.jar |
242 |
|
243 |
%build |
244 |
export OPT_JAR_LIST="xalan-j2-serializer" |
245 |
# we don't care about the tarballs and we're going to replace |
246 |
# tomcat-dbcp.jar with apache-commons-{collections,dbcp,pool}-tomcat5.jar |
247 |
# so just create a dummy file for later removal |
248 |
touch HACK |
249 |
%{__mkdir_p} HACKDIR |
250 |
touch HACKDIR/build.xml |
251 |
# who needs a build.properties file anyway |
252 |
%{ant} -Dbase.path="." \ |
253 |
-Dbuild.compiler="modern" \ |
254 |
-Dcommons-collections.jar="$(build-classpath apache-commons-collections)" \ |
255 |
-Dcommons-daemon.jar="$(build-classpath apache-commons-daemon)" \ |
256 |
-Dcommons-daemon.native.src.tgz="HACK" \ |
257 |
-Djasper-jdt.jar="$(build-classpath ecj)" \ |
258 |
-Djdt.jar="$(build-classpath ecj)" \ |
259 |
-Dtomcat-dbcp.jar="$(build-classpath apache-commons-dbcp)" \ |
260 |
-Dtomcat-native.tar.gz="HACK" \ |
261 |
-Dtomcat-native.home="." \ |
262 |
-Dcommons-daemon.native.win.mgr.exe="HACK" \ |
263 |
-Dnsis.exe="HACK" \ |
264 |
-Djaxrpc-lib.jar="$(build-classpath jaxrpc)" \ |
265 |
-Dwsdl4j-lib.jar="$(build-classpath wsdl4j)" \ |
266 |
-Dcommons-pool.home="HACKDIR" \ |
267 |
-Dcommons-dbcp.home="HACKDIR" \ |
268 |
-Dno.build.dbcp=true \ |
269 |
-Dversion="%{version}" \ |
270 |
-Dversion.build="%{micro_version}" \ |
271 |
deploy dist-prepare dist-source javadoc |
272 |
|
273 |
# remove some jars that we'll replace with symlinks later |
274 |
%{__rm} output/build/bin/commons-daemon.jar \ |
275 |
output/build/lib/ecj.jar |
276 |
# remove the cruft we created |
277 |
%{__rm} output/build/bin/tomcat-native.tar.gz |
278 |
pushd output/dist/src/webapps/docs/appdev/sample/src |
279 |
%{__mkdir_p} ../web/WEB-INF/classes |
280 |
%{javac} -cp ../../../../../../../../output/build/lib/servlet-api.jar -d ../web/WEB-INF/classes mypackage/Hello.java |
281 |
pushd ../web |
282 |
%{jar} cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.war * |
283 |
popd |
284 |
popd |
285 |
|
286 |
# Allow linking for example webapp |
287 |
%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/examples/META-INF |
288 |
pushd ${RPM_BUILD_ROOT}%{appdir}/examples/META-INF |
289 |
echo '<?xml version="1.0" encoding="UTF-8"?>'>context.xml |
290 |
echo '<Context allowLinking="true"/>'>>context.xml |
291 |
popd |
292 |
%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/examples/WEB-INF/lib |
293 |
pushd ${RPM_BUILD_ROOT}%{appdir}/examples/WEB-INF/lib |
294 |
%{__ln_s} -f $(build-classpath jakarta-taglibs-core) jstl.jar |
295 |
%{__ln_s} -f $(build-classpath jakarta-taglibs-standard) standard.jar |
296 |
popd |
297 |
|
298 |
# inject OSGi manifests |
299 |
mkdir -p META-INF |
300 |
cp -p %{SOURCE8} META-INF/MANIFEST.MF |
301 |
touch META-INF/MANIFEST.MF |
302 |
zip -u output/build/lib/servlet-api.jar META-INF/MANIFEST.MF |
303 |
cp -p %{SOURCE9} META-INF/MANIFEST.MF |
304 |
touch META-INF/MANIFEST.MF |
305 |
zip -u output/build/lib/jsp-api.jar META-INF/MANIFEST.MF |
306 |
cp -p %{SOURCE12} META-INF/MANIFEST.MF |
307 |
touch META-INF/MANIFEST.MF |
308 |
zip -u output/build/lib/el-api.jar META-INF/MANIFEST.MF |
309 |
cp -p %{SOURCE13} META-INF/MANIFEST.MF |
310 |
touch META-INF/MANIFEST.MF |
311 |
zip -u output/build/lib/jasper-el.jar META-INF/MANIFEST.MF |
312 |
cp -p %{SOURCE14} META-INF/MANIFEST.MF |
313 |
touch META-INF/MANIFEST.MF |
314 |
zip -u output/build/lib/jasper.jar META-INF/MANIFEST.MF |
315 |
cp -p %{SOURCE15} META-INF/MANIFEST.MF |
316 |
touch META-INF/MANIFEST.MF |
317 |
zip -u output/build/lib/tomcat-api.jar META-INF/MANIFEST.MF |
318 |
cp -p %{SOURCE16} META-INF/MANIFEST.MF |
319 |
touch META-INF/MANIFEST.MF |
320 |
zip -u output/build/bin/tomcat-juli.jar META-INF/MANIFEST.MF |
321 |
|
322 |
%install |
323 |
# build initial path structure |
324 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} |
325 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir} |
326 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} |
327 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_initrddir} |
328 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_systemddir} |
329 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d |
330 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig |
331 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir} |
332 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir} |
333 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir} |
334 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}/Catalina/localhost |
335 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir} |
336 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir} |
337 |
/bin/touch ${RPM_BUILD_ROOT}%{logdir}/catalina.out |
338 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{_localstatedir}/run |
339 |
/bin/touch ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}.pid |
340 |
/bin/echo "%{name}-%{major_version}.%{minor_version}.%{micro_version} RPM installed" >> ${RPM_BUILD_ROOT}%{logdir}/catalina.out |
341 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir} |
342 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir} |
343 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{workdir} |
344 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_unitdir} |
345 |
|
346 |
# move things into place |
347 |
# First copy supporting libs to tomcat lib |
348 |
pushd output/build |
349 |
%{__cp} -a bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir} |
350 |
%{__cp} %{SOURCE10} conf/log4j.properties |
351 |
%{__cp} -a conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir} |
352 |
%{__cp} -a lib/*.jar ${RPM_BUILD_ROOT}%{libdir} |
353 |
%{__cp} -a webapps/* ${RPM_BUILD_ROOT}%{appdir} |
354 |
popd |
355 |
# javadoc |
356 |
%{__cp} -a output/dist/webapps/docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} |
357 |
|
358 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
359 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
360 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE1} \ |
361 |
> ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf |
362 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
363 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
364 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE3} \ |
365 |
> ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} |
366 |
%{__install} -m 0644 %{SOURCE2} \ |
367 |
${RPM_BUILD_ROOT}%{_initrddir}/%{name} |
368 |
%{__install} -m 0644 %{SOURCE4} \ |
369 |
${RPM_BUILD_ROOT}%{_sbindir}/%{name} |
370 |
%{__install} -m 0644 %{SOURCE11} \ |
371 |
${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service |
372 |
%{__install} -m 0644 %{SOURCE17} \ |
373 |
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-sysd |
374 |
%{__install} -m 0644 %{SOURCE19} \ |
375 |
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-jsvc |
376 |
%{__install} -m 0644 %{SOURCE20} \ |
377 |
${RPM_BUILD_ROOT}%{_unitdir}/%{name}-jsvc.service |
378 |
%{__install} -m 0644 %{SOURCE18} \ |
379 |
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-jsvc-sysd |
380 |
%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} |
381 |
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \ |
382 |
> ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name} |
383 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
384 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
385 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \ |
386 |
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest |
387 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
388 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
389 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \ |
390 |
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper |
391 |
# create jsp and servlet API symlinks |
392 |
pushd ${RPM_BUILD_ROOT}%{_javadir} |
393 |
%{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api.jar |
394 |
%{__ln_s} %{name}-jsp-%{jspspec}-api.jar %{name}-jsp-api.jar |
395 |
%{__mv} %{name}/servlet-api.jar %{name}-servlet-%{servletspec}-api.jar |
396 |
%{__ln_s} %{name}-servlet-%{servletspec}-api.jar %{name}-servlet-api.jar |
397 |
%{__mv} %{name}/el-api.jar %{name}-el-%{elspec}-api.jar |
398 |
%{__ln_s} %{name}-el-%{elspec}-api.jar %{name}-el-api.jar |
399 |
popd |
400 |
|
401 |
pushd output/build |
402 |
%{_bindir}/build-jar-repository lib apache-commons-collections \ |
403 |
apache-commons-dbcp apache-commons-pool ecj 2>&1 |
404 |
# need to use -p here with b-j-r otherwise the examples webapp fails to |
405 |
# load with a java.io.IOException |
406 |
%{_bindir}/build-jar-repository -p webapps/examples/WEB-INF/lib \ |
407 |
taglibs-core.jar taglibs-standard.jar 2>&1 |
408 |
popd |
409 |
|
410 |
pushd ${RPM_BUILD_ROOT}%{libdir} |
411 |
# symlink JSP and servlet API jars |
412 |
%{__ln_s} ../%{name}-jsp-%{jspspec}-api.jar . |
413 |
%{__ln_s} ../%{name}-servlet-%{servletspec}-api.jar . |
414 |
%{__ln_s} ../%{name}-el-%{elspec}-api.jar . |
415 |
%{__ln_s} $(build-classpath apache-commons-collections) commons-collections.jar |
416 |
%{__ln_s} $(build-classpath apache-commons-dbcp) commons-dbcp.jar |
417 |
%{__ln_s} $(build-classpath log4j) log4j.jar |
418 |
%{__ln_s} $(build-classpath ecj) jasper-jdt.jar |
419 |
|
420 |
# Temporary copy the juli jar here from /usr/share/java/tomcat (for maven depmap) |
421 |
%{__cp} -a ${RPM_BUILD_ROOT}%{bindir}/tomcat-juli.jar ./ |
422 |
popd |
423 |
|
424 |
# symlink to the FHS locations where we've installed things |
425 |
pushd ${RPM_BUILD_ROOT}%{homedir} |
426 |
%{__ln_s} %{appdir} webapps |
427 |
%{__ln_s} %{confdir} conf |
428 |
%{__ln_s} %{libdir} lib |
429 |
%{__ln_s} %{logdir} logs |
430 |
%{__ln_s} %{tempdir} temp |
431 |
%{__ln_s} %{workdir} work |
432 |
popd |
433 |
|
434 |
# install sample webapp |
435 |
%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/sample |
436 |
pushd ${RPM_BUILD_ROOT}%{appdir}/sample |
437 |
%{jar} xf ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war |
438 |
popd |
439 |
%{__rm} ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war |
440 |
|
441 |
|
442 |
# Install the maven metadata |
443 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir} |
444 |
pushd output/dist/src/res/maven |
445 |
for pom in *.pom; do |
446 |
# fix-up version in all pom files |
447 |
sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom |
448 |
done |
449 |
|
450 |
# we won't install dbcp, juli-adapters and juli-extras pom files |
451 |
for libname in annotations-api catalina jasper-el jasper catalina-ha; do |
452 |
%{__cp} -a %{name}-$libname.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-$libname.pom |
453 |
%add_maven_depmap JPP.%{name}-$libname.pom %{name}/$libname.jar |
454 |
done |
455 |
|
456 |
# servlet-api jsp-api and el-api are not in tomcat subdir, since they are widely re-used elsewhere |
457 |
%{__cp} -a tomcat-jsp-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-jsp-api.pom |
458 |
%add_maven_depmap JPP-tomcat-jsp-api.pom tomcat-jsp-api.jar -f "tomcat-jsp-api" -a "javax.servlet.jsp:javax.servlet.jsp-api,javax.servlet:jsp-api" |
459 |
|
460 |
%{__cp} -a tomcat-el-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-el-api.pom |
461 |
%add_maven_depmap JPP-tomcat-el-api.pom tomcat-el-api.jar -f "tomcat-el-api" -a "javax.el:javax.el-api,javax.el:el-api" |
462 |
|
463 |
%{__cp} -a tomcat-servlet-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-servlet-api.pom |
464 |
# Generate a depmap fragment javax.servlet:servlet-api pointing to |
465 |
# tomcat-servlet-3.0-api for backwards compatibility |
466 |
# also provide jetty depmap (originally in jetty package, but it's cleaner to have it here |
467 |
%add_maven_depmap JPP-tomcat-servlet-api.pom tomcat-servlet-api.jar -f "tomcat-servlet-api" -a "javax.servlet:servlet-api,javax.servlet:javax.servlet-api,org.mortbay.jetty:servlet-api" |
468 |
|
469 |
# two special pom where jar files have different names |
470 |
%{__cp} -a tomcat-tribes.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom |
471 |
%add_maven_depmap JPP.%{name}-catalina-tribes.pom %{name}/catalina-tribes.jar |
472 |
|
473 |
%{__cp} -a tomcat-juli.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom |
474 |
%add_maven_depmap JPP.%{name}-tomcat-juli.pom %{name}/tomcat-juli.jar |
475 |
|
476 |
%{__cp} -a tomcat-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom |
477 |
%add_maven_depmap JPP.%{name}-tomcat-api.pom %{name}/tomcat-api.jar |
478 |
|
479 |
%{__cp} -a tomcat-util.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom |
480 |
%add_maven_depmap JPP.%{name}-tomcat-util.pom %{name}/tomcat-util.jar |
481 |
|
482 |
# replace temporary copy with link |
483 |
%{__ln_s} -f %{bindir}/tomcat-juli.jar ${RPM_BUILD_ROOT}%{libdir}/ |
484 |
|
485 |
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/lib/tmpfiles.d |
486 |
cat > ${RPM_BUILD_ROOT}%{_prefix}/lib/tmpfiles.d/%{name}.conf <<EOF |
487 |
f %{_localstatedir}/run/%{name}.pid 0644 tomcat tomcat - |
488 |
EOF |
489 |
|
490 |
|
491 |
%pre |
492 |
# add the tomcat user and group |
493 |
%{_sbindir}/groupadd -g %{tcuid} -r tomcat 2>/dev/null || : |
494 |
%{_sbindir}/useradd -c "Apache Tomcat" -u %{tcuid} -g tomcat \ |
495 |
-s /bin/nologin -r -d %{homedir} tomcat 2>/dev/null || : |
496 |
|
497 |
%post |
498 |
# install but don't activate |
499 |
/sbin/chkconfig --add %{name} |
500 |
if [ $1 -eq 1 ]; then |
501 |
#initial installation |
502 |
/bin/systemctl daemon-reload >/dev/null 2>&1 || : |
503 |
fi |
504 |
|
505 |
%post systemv |
506 |
# install but don't activate |
507 |
/sbin/chkconfig --add %{name} |
508 |
|
509 |
%post jsp-%{jspspec}-api |
510 |
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \ |
511 |
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20200 |
512 |
|
513 |
%post servlet-%{servletspec}-api |
514 |
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \ |
515 |
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 30000 |
516 |
|
517 |
%post el-%{elspec}-api |
518 |
%{_sbindir}/update-alternatives --install %{_javadir}/elspec.jar elspec \ |
519 |
%{_javadir}/%{name}-el-%{elspec}-api.jar 20300 |
520 |
|
521 |
%preun systemv |
522 |
%{_initrddir}/%{name} stop >/dev/null 2>&1 |
523 |
/sbin/chkconfig --del %{name} |
524 |
|
525 |
%preun |
526 |
# clean tempdir and workdir on removal or upgrade |
527 |
%{__rm} -rf %{workdir}/* %{tempdir}/* |
528 |
if [ "$1" = "0" ]; then |
529 |
# package removal, not upgrade |
530 |
/bin/systemctl --no-reload disable tomcat.service > /dev/null 2>&1 || : |
531 |
/bin/systemctl stop tomcat.service > /dev/null 2>&1 || : |
532 |
fi |
533 |
|
534 |
%postun |
535 |
/bin/systemctl daemon-reload > /dev/null 2>&1 || : |
536 |
if [ $1 -ge 1 ]; then |
537 |
#package upgrade, not uninstall |
538 |
/bin/systemctl try-restart tomcat.service > /dev/null 2>&1 || : |
539 |
fi |
540 |
|
541 |
|
542 |
%postun jsp-%{jspspec}-api |
543 |
if [ "$1" = "0" ]; then |
544 |
%{_sbindir}/update-alternatives --remove jsp \ |
545 |
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar |
546 |
fi |
547 |
|
548 |
%postun servlet-%{servletspec}-api |
549 |
if [ "$1" = "0" ]; then |
550 |
%{_sbindir}/update-alternatives --remove servlet \ |
551 |
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar |
552 |
fi |
553 |
|
554 |
%postun el-%{elspec}-api |
555 |
if [ "$1" = "0" ]; then |
556 |
%{_sbindir}/update-alternatives --remove elspec \ |
557 |
%{_javadir}/%{name}-el-%{elspec}-api.jar |
558 |
fi |
559 |
|
560 |
%triggerun -- tomcat < 0:7.0.22-2 |
561 |
# Run these becasue the SysV package being removed won't do them |
562 |
/sbin/chkconfig --del tomcat > /dev/null 2>&1 || : |
563 |
/bin/systemctl try-restart tomcat.service > /dev/null 2>&1 || : |
564 |
|
565 |
%files |
566 |
%defattr(0664,root,tomcat,0755) |
567 |
%doc {LICENSE,NOTICE,RELEASE*} |
568 |
%attr(0755,root,root) %{_bindir}/%{name}-digest |
569 |
%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper |
570 |
%attr(0755,root,root) %{_sbindir}/%{name} |
571 |
%attr(0644,root,root) %{_unitdir}/%{name}.service |
572 |
%attr(0755,root,root) %{_sbindir}/%{name}-sysd |
573 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
574 |
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
575 |
%attr(0755,root,tomcat) %dir %{basedir} |
576 |
%attr(0755,root,tomcat) %dir %{confdir} |
577 |
%defattr(0664,root,tomcat,0770) |
578 |
%attr(0770,root,tomcat) %dir %{logdir} |
579 |
%attr(0660,tomcat,tomcat) %{logdir}/catalina.out |
580 |
%attr(0644,tomcat,tomcat) %{_localstatedir}/run/%{name}.pid |
581 |
%attr(0770,root,tomcat) %dir %{cachedir} |
582 |
%attr(0770,root,tomcat) %dir %{tempdir} |
583 |
%attr(0770,root,tomcat) %dir %{workdir} |
584 |
%defattr(0664,root,tomcat,0775) |
585 |
%attr(0775,root,tomcat) %dir %{appdir} |
586 |
%attr(0775,root,tomcat) %dir %{confdir}/Catalina |
587 |
%attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost |
588 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/%{name}.conf |
589 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/*.policy |
590 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/*.properties |
591 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/context.xml |
592 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/server.xml |
593 |
%attr(0660,tomcat,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml |
594 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/web.xml |
595 |
%dir %{homedir} |
596 |
%{bindir}/bootstrap.jar |
597 |
%{_prefix}/lib/tmpfiles.d/%{name}.conf |
598 |
%{bindir}/catalina-tasks.xml |
599 |
%{homedir}/lib |
600 |
%{homedir}/temp |
601 |
%{homedir}/webapps |
602 |
%{homedir}/work |
603 |
%{homedir}/logs |
604 |
%{homedir}/conf |
605 |
|
606 |
%files admin-webapps |
607 |
%defattr(0664,root,tomcat,0755) |
608 |
%{appdir}/host-manager |
609 |
%{appdir}/manager |
610 |
|
611 |
%files docs-webapp |
612 |
%defattr(-,root,root,-) |
613 |
%{appdir}/docs |
614 |
|
615 |
%files javadoc |
616 |
%defattr(-,root,root,-) |
617 |
%{_javadocdir}/%{name} |
618 |
|
619 |
%files jsp-%{jspspec}-api |
620 |
%defattr(-,root,root,-) |
621 |
%{_javadir}/%{name}-jsp-%{jspspec}*.jar |
622 |
%{_javadir}/%{name}-jsp-api.jar |
623 |
%{_mavenpomdir}/JPP-%{name}-jsp-api.pom |
624 |
%{_mavendepmapfragdir}/%{name}-tomcat-jsp-api |
625 |
|
626 |
%files lib |
627 |
%defattr(-,root,root,-) |
628 |
%{libdir} |
629 |
%{bindir}/tomcat-juli.jar |
630 |
%{_mavendepmapfragdir}/%{name} |
631 |
%{_mavenpomdir}/JPP.%{name}-annotations-api.pom |
632 |
%{_mavenpomdir}/JPP.%{name}-catalina-ha.pom |
633 |
%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom |
634 |
%{_mavenpomdir}/JPP.%{name}-catalina.pom |
635 |
%{_mavenpomdir}/JPP.%{name}-jasper-el.pom |
636 |
%{_mavenpomdir}/JPP.%{name}-jasper.pom |
637 |
%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom |
638 |
%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom |
639 |
%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom |
640 |
|
641 |
%exclude %{libdir}/%{name}-el-%{elspec}-api.jar |
642 |
|
643 |
%files servlet-%{servletspec}-api |
644 |
%defattr(-,root,root,-) |
645 |
%doc LICENSE |
646 |
%{_javadir}/%{name}-servlet-%{servletspec}*.jar |
647 |
%{_javadir}/%{name}-servlet-api.jar |
648 |
%{_mavendepmapfragdir}/%{name}-tomcat-servlet-api |
649 |
%{_mavenpomdir}/JPP-%{name}-servlet-api.pom |
650 |
|
651 |
%files el-%{elspec}-api |
652 |
%defattr(-,root,root,-) |
653 |
%doc LICENSE |
654 |
%{_javadir}/%{name}-el-%{elspec}-api.jar |
655 |
%{_javadir}/%{name}-el-api.jar |
656 |
%{libdir}/%{name}-el-%{elspec}-api.jar |
657 |
%{_mavenpomdir}/JPP-%{name}-el-api.pom |
658 |
%{_mavendepmapfragdir}/%{name}-tomcat-el-api |
659 |
|
660 |
|
661 |
%files webapps |
662 |
%defattr(0644,tomcat,tomcat,0755) |
663 |
%{appdir}/ROOT |
664 |
%{appdir}/examples |
665 |
%{appdir}/sample |
666 |
|
667 |
%files systemv |
668 |
%defattr(755,root,root,0755) |
669 |
%{_sbindir}/d%{name} |
670 |
%{_initrddir}/%{name} |
671 |
|
672 |
%files jsvc |
673 |
%defattr(755,root,root,0755) |
674 |
%{_sbindir}/%{name}-jsvc |
675 |
%{_sbindir}/%{name}-jsvc-sysd |
676 |
%attr(0644,root,root) %{_unitdir}/%{name}-jsvc.service |
677 |
|