3 %bcond_without javadoc # skip building javadocs
4 %bcond_with jta # put jta jar into tomcat lib dir.
5 %bcond_without java_sun # build with gcj (does not work)
7 Summary: Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API
8 Summary(pl.UTF-8): Silnik Servlet/JSP Apache będący wzorcową implementacją API Servlet 2.4/JSP 2.0
13 Group: Networking/Daemons/Java
14 Source0: http://www.apache.org/dist/tomcat/tomcat-5/v%{version}/src/apache-%{name}-%{version}-src.tar.gz
15 # Source0-md5: eb3f196013550b9b1684e4ff18593a8e
16 Source1: apache-%{name}.init
17 Source2: apache-%{name}.sysconfig
18 Source10: apache-%{name}-context-ROOT.xml
19 Source11: apache-%{name}-context-balancer.xml
20 Source12: apache-%{name}-context-jsp-examples.xml
21 Source13: apache-%{name}-context-tomcat-docs.xml
22 Source14: apache-%{name}-context-webdav.xml
23 Patch0: apache-%{name}-skip-servletapi.patch
24 Patch1: apache-%{name}-nsis.patch
25 Patch2: apache-%{name}-native.patch
26 Patch3: apache-%{name}-skip-jdt.patch
27 Patch4: apache-%{name}-no-connectors.patch
28 Patch5: apache-%{name}-dbcp.patch
29 Patch6: apache-%{name}-struts.patch
30 Patch7: apache-%{name}-admin-struts.patch
31 Patch8: apache-%{name}-no_links_to_examples.patch
32 # Following patches are applied in tomcat svn. Remove them while updating to 5.5.28
33 # See: http://tomcat.apache.org/security-5.html
34 Patch100: tomcat-CVE-2008-5515.patch
35 Patch101: tomcat-CVE-2009-0033.patch
36 Patch102: tomcat-CVE-2009-0580.patch
37 Patch103: tomcat-CVE-2009-0781.patch
38 Patch104: tomcat-CVE-2009-0783.patch
39 URL: http://tomcat.apache.org/
41 BuildRequires: java-sun >= 1.5
42 BuildRequires: java-sun-jre >= 1.5
44 BuildRequires: java-gcj-compat-devel
46 BuildRequires: ant >= 1.5.3
47 BuildRequires: ant-trax
48 BuildRequires: eclipse-jdt
50 BuildRequires: java-regexp >= 0:1.3
51 BuildRequires: java-commons-beanutils >= 1.7
52 BuildRequires: java-commons-chain
53 BuildRequires: java-commons-collections >= 0:3.1
54 BuildRequires: java-commons-collections-tomcat5 >= 0:3.1
55 BuildRequires: java-commons-daemon >= 1.0
56 BuildRequires: java-commons-dbcp >= 0:1.2.1
57 BuildRequires: java-commons-dbcp-tomcat5 >= 0:1.2.1
58 BuildRequires: java-commons-digester >= 0:1.7
59 BuildRequires: java-commons-el >= 0:1.0
60 BuildRequires: java-commons-fileupload >= 0:1.0
61 BuildRequires: java-commons-httpclient
62 BuildRequires: java-commons-io >= 1.4
63 BuildRequires: java-commons-launcher >= 0:0.9
64 BuildRequires: java-commons-logging >= 0:1.0.4
65 BuildRequires: java-commons-modeler >= 2.0
66 BuildRequires: java-commons-pool >= 0:1.2
67 BuildRequires: java-commons-pool-tomcat5 >= 0:1.2
68 BuildRequires: java-jdbc-mysql
69 %{?with_jta:BuildRequires: java-jta >= 0:1.0.1}
70 BuildRequires: java-log4j
71 BuildRequires: java-mail >= 0:1.3.1
72 BuildRequires: java-puretls
73 BuildRequires: java-servletapi5 = %{version}
74 BuildRequires: java-struts >= 1.0.2
75 BuildRequires: java-xerces >= 0:2.7.1
76 BuildRequires: java-xml-commons
77 BuildRequires: jaxp_parser_impl >= 0:2.7.1
78 BuildRequires: jdbc-stdext >= 0:2.0
80 BuildRequires: jndi >= 0:1.2.1
81 BuildRequires: jpackage-utils
82 BuildRequires: junit >= 0:3.8.1
83 BuildRequires: rpmbuild(macros) >= 1.300
84 Requires(post,postun): /sbin/ldconfig
85 Requires(post,preun): /sbin/chkconfig
86 Requires(postun): /usr/sbin/groupdel
87 Requires(postun): /usr/sbin/userdel
88 Requires(pre): /bin/id
89 Requires(pre): /usr/bin/getgid
90 Requires(pre): /usr/sbin/groupadd
91 Requires(pre): /usr/sbin/useradd
92 Requires: %{name}-jasper = %{version}-%{release}
94 Requires: java-commons-beanutils
95 Requires: java-commons-collections
96 Requires: java-commons-digester
97 Requires: java-commons-el
98 Requires: java-commons-logging
99 Requires: java-commons-modeler
100 Requires: java-commons-pool-tomcat5
101 Requires: java-jdbc-mysql
102 Requires: java-regexp
103 Requires: java-servletapi5 = %{version}
104 Requires: java-xml-commons
105 Requires: javamail >= 1.2
106 Requires: jaxp_parser_impl
107 Requires: jdbc-stdext >= 2.0
108 Requires: jndi >= 1.2.1
110 Requires: jsse >= 1.0.2
111 %{?with_jta:Requires: jta >= 1.0.1}
113 Provides: group(servlet)
114 Provides: group(tomcat)
115 Provides: java-servlet-container
116 Provides: user(tomcat)
117 Obsoletes: apache-tomcat
118 Obsoletes: jakarta-tomcat
120 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
122 %define _tomcatdir %{_datadir}/tomcat
123 %define _logdir %{_var}/log
124 %define _vardir %{_var}/lib/tomcat
125 %define _sysconfdir /etc/tomcat
127 %define find_jar() %{expand:%%define jarfile {%(jar=$(find-jar %1); echo ${jar:-%%nil})}}%{?jarfile}%{!?jarfile:%{error:find-jar %1 failed}}%{nil}
130 Tomcat is the servlet container that is used in the official Reference
131 Implementation for the Java Servlet and JavaServer Pages technologies.
132 The Java Servlet and JavaServer Pages specifications are developed by
133 Sun under the Java Community Process.
135 Tomcat is developed in an open and participatory environment and
136 released under the Apache Software License. Tomcat is intended to be a
137 collaboration of the best-of-breed developers from around the world.
138 We invite you to participate in this open development project.
140 %description -l pl.UTF-8
141 Tomcat to kontener serwletowy używany przez oficjalną implementację
142 wzorcową technologii Java Servlet i JavaServer Pages. Specyfikacje
143 Java Servlet i JavaServer Pages są rozwijane przez Suna zgodnie z Java
147 Summary: The Apache Tomcat Servlet/JSP Container documentation
148 Summary(pl.UTF-8): Dokumentacja do Tomcata - kontenera Servlet/JSP
150 Obsoletes: apache-tomcat-doc
151 Obsoletes: jakarta-tomcat-doc
154 The Tomcat Servlet/JSP Container documentation.
156 %description doc -l pl.UTF-8
157 Dokumentacja do Tomcata - kontenera Servlet/JSP.
160 Summary: Apache Tomcat`s Administration Web Application
161 Summary(pl.UTF-8): Panel Administracyjny dla Apache Tomcat
162 Group: Networking/Daemons/Java/Servlets
163 Requires: %{name} = %{version}-%{release}
164 Requires: java-commons-chain
165 Obsoletes: apache-tomcat-admin
168 Administration Web Application for Apache Tomcat.
170 %description admin -l pl.UTF-8
171 Panel Administracyjny dla Apache Tomcat.
174 Summary: JSP compiler
175 Summary(pl.UTF-8): Kompilator JSP
176 Group: Libraries/Java
177 Requires: jpackage-utils
178 Obsoletes: apache-tomcat-jasper
181 Jasper is Java ServerPages compiler used by Apache Tomcat servlet
184 %description jasper -l pl.UTF-8
185 Jasper jest kompilatorem Java ServerPages używanym przez kontener
186 servletów Apache Tomcat.
189 %setup -q -n apache-%{name}-%{version}-src
206 # we don't need those scripts
207 rm -f container/catalina/src/bin/*.bat
208 rm -f container/catalina/src/bin/{startup,shutdown}.sh
210 # causes file(1) rpm to abort, and not really neccessary file
211 # file: Thumbs.db: ERROR: Cannot read short stream (Invalid argument)
212 # rpm: error: magic_file(ms, "Thumbs.db") failed: mode 37777700644 Cannot read short stream (Invalid argument)
213 rm container/webapps/admin/images/Thumbs.db
215 # servletapi built from java-servletapi5.spec
218 # Remove pre-built jars
219 find -name '*.jar' | xargs rm -fv
225 cat > build.properties <<EOF
226 commons-beanutils.jar=$(find-jar commons-beanutils-core)
227 commons-launcher.jar=$(find-jar commons-launcher)
228 commons-daemon.jar=$(find-jar commons-daemon)
229 commons-digester.jar=$(find-jar commons-digester)
230 commons-el.jar=$(find-jar commons-el)
231 commons-logging-api.jar=$(find-jar commons-logging-api)
232 commons-logging.jar=$(find-jar commons-logging)
233 commons-modeler.jar=$(find-jar commons-modeler)
234 xercesImpl.jar=$(find-jar jaxp_parser_impl)
235 xml-apis.jar=$(find-jar xml-commons-apis)
236 jdt.jar=$(find-jar org.eclipse.jdt.core)
237 jasper-compiler-jdt.home=$TOPDIR/tomcat-deps
238 commons-httpclient.jar=$(find-jar commons-httpclient)
239 commons-collections.jar=$(find-jar commons-collections)
240 commons-fileupload.jar=$(find-jar commons-fileupload)
241 commons-io.jar=$(find-jar commons-io)
242 jmx.jar=$(find-jar jmx)
243 jmx-tools.jar=$(find-jar jmx)
244 junit.jar=$(find-jar junit)
245 struts.jar=$(find-jar struts-core)
246 struts-core.jar=$(find-jar struts-core)
247 struts-taglib.jar=$(find-jar struts-taglib)
248 jcert.jar=$(find-jar jcert)
249 jnet.jar=$(find-jar jnet)
250 jsse.jar=$(find-jar jsse)
251 %{?with_jta:jta.jar=$(find-jar jta)}
252 puretls.jar=$(find-jar puretls)
253 servlet-api.jar=$(find-jar servlet-api)
254 servletapi.build.notrequired=true
255 jsp-api.jar=$(find-jar jsp-api)
256 jspapi.build.notrequired=true
257 log4j.jar=$(find-jar log4j)
258 tomcat-dbcp.jar=$(find-jar commons-dbcp-tomcat5)
259 struts.lib=%{_javadir}-struts
262 if grep '=$' build.properties; then
263 : Some .jar could not be found
271 rm -rf $RPM_BUILD_ROOT
273 TOMCATDIR=$RPM_BUILD_ROOT%{_tomcatdir}
274 CATALINADIR=$RPM_BUILD_ROOT/var/lib/tomcat
276 randpw=$(echo $RANDOM$$ | md5sum | cut -c 1-15)
277 %{__sed} -i -e "s:SHUTDOWN:${randpw}:" conf/{server,server-minimal}.xml
279 install -d $TOMCATDIR/bin \
280 $TOMCATDIR/common/{lib,classes,endorsed} \
281 $TOMCATDIR/server/{lib,classes} \
283 $RPM_BUILD_ROOT%{_logdir}/tomcat \
284 $RPM_BUILD_ROOT%{_vardir}/webapps \
285 $RPM_BUILD_ROOT%{_vardir}/work \
286 $RPM_BUILD_ROOT%{_vardir}/conf \
287 $RPM_BUILD_ROOT/etc/sysconfig \
288 $RPM_BUILD_ROOT/etc/rc.d/init.d
290 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/tomcat
291 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/tomcat
293 cp -a conf/* $CATALINADIR/conf
294 install %{SOURCE10} $CATALINADIR/conf/Catalina/localhost/ROOT.xml
295 install %{SOURCE11} $CATALINADIR/conf/Catalina/localhost/balancer.xml
296 install %{SOURCE12} $CATALINADIR/conf/Catalina/localhost/jsp-examples.xml
297 install %{SOURCE13} $CATALINADIR/conf/Catalina/localhost/tomcat-docs.xml
298 install %{SOURCE14} $CATALINADIR/conf/Catalina/localhost/webdav.xml
299 cp -HR bin common server $TOMCATDIR
301 cp -a server/webapps $TOMCATDIR/server
302 cp -a webapps $TOMCATDIR
303 cp -a shared $TOMCATDIR
304 cp -a temp $CATALINADIR
306 ln -sf %{_logdir}/tomcat $CATALINADIR/logs
307 ln -sf %{_logdir}/tomcat $TOMCATDIR/logs
308 ln -sf %{_vardir}/work $TOMCATDIR/work
309 ln -sf %{_vardir}/conf $TOMCATDIR/conf
310 ln -sf %{_vardir}/conf $RPM_BUILD_ROOT%{_sysconfdir}
312 # symlinks instead of copies
313 jars="commons-daemon commons-logging-api"
316 ln -sf $jar $TOMCATDIR/bin
319 jars="commons-el commons-dbcp-tomcat5 commons-pool-tomcat5 servlet-api jsp-api commons-modeler jdbc-mysql"
322 ln -sf $jar $TOMCATDIR/common/lib
325 jars="jaxp_parser_impl xml-commons-apis"
328 ln -sf $jar $TOMCATDIR/common/endorsed
331 jars="struts-core struts-taglib commons-collections commons-beanutils-core commons-digester commons-chain"
334 ln -sf $jar $TOMCATDIR/server/webapps/admin/WEB-INF/lib
337 jars="commons-modeler"
340 ln -sf $jar $TOMCATDIR/server/lib
343 install -d $RPM_BUILD_ROOT%{_javadir}
344 mv $TOMCATDIR/common/lib/jasper*.jar $RPM_BUILD_ROOT%{_javadir}
345 ln -sf %{_javadir}/jasper-compiler-jdt.jar $TOMCATDIR/common/lib
346 ln -sf %{_javadir}/jasper-compiler.jar $TOMCATDIR/common/lib
347 ln -sf %{_javadir}/jasper-runtime.jar $TOMCATDIR/common/lib
350 rm -rf $RPM_BUILD_ROOT
353 %groupadd -g 234 -r -f tomcat
354 %groupadd -g 237 -r -f servlet
355 %useradd -u 234 -r -d /var/lib/tomcat -s /bin/false -c "Tomcat User" -g tomcat -G servlet tomcat
358 /sbin/chkconfig --add tomcat
359 %service tomcat restart
362 if [ "$1" = "0" ]; then
364 /sbin/chkconfig --del tomcat
368 if [ "$1" = "0" ]; then
375 %defattr(644,root,root,755)
376 %doc build/{RELEASE-NOTES,RUNNING.txt}
377 %attr(754,root,root) /etc/rc.d/init.d/tomcat
378 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/tomcat
381 %dir %{_tomcatdir}/conf
382 %dir %{_tomcatdir}/bin
383 %{_tomcatdir}/bin/catalina-tasks.xml
384 %{_tomcatdir}/bin/jkstatus-tasks.xml
385 %{_tomcatdir}/bin/jmxaccessor-tasks.xml
386 %attr(755,root,root) %{_tomcatdir}/bin/*.sh
387 %{_tomcatdir}/bin/*.jar
388 %dir %{_tomcatdir}/common
389 %dir %{_tomcatdir}/common/classes
390 %dir %{_tomcatdir}/common/endorsed
391 %dir %{_tomcatdir}/common/i18n
392 %{_tomcatdir}/common/endorsed/*.jar
393 %{_tomcatdir}/common/i18n/tomcat-i18n-en.jar
394 %lang(es) %{_tomcatdir}/common/i18n/tomcat-i18n-es.jar
395 %lang(fr) %{_tomcatdir}/common/i18n/tomcat-i18n-fr.jar
396 %lang(ja) %{_tomcatdir}/common/i18n/tomcat-i18n-ja.jar
397 %{_tomcatdir}/common/lib
398 %dir %{_tomcatdir}/server
399 %dir %{_tomcatdir}/server/classes
400 %{_tomcatdir}/server/lib
401 %dir %{_tomcatdir}/server/webapps
403 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/host-manager.xml
404 %{_tomcatdir}/server/webapps/host-manager
406 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/manager.xml
407 %{_tomcatdir}/server/webapps/manager
409 %dir %{_tomcatdir}/webapps
411 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/ROOT.xml
412 %{_tomcatdir}/webapps/ROOT
414 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/balancer.xml
415 %{_tomcatdir}/webapps/balancer
417 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/webdav.xml
418 %{_tomcatdir}/webapps/webdav
424 # these directory has to be writeable because /admin need to modify config
425 # files and create temporary files
426 %dir %attr(775,root,tomcat) %{_vardir}/conf
427 %dir %attr(775,root,tomcat) %{_vardir}/conf/Catalina
428 %dir %{_vardir}/conf/Catalina/localhost
429 # tomcat config has to be writeable because of tomcat-users.xml file and Catalina dir
430 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/MANIFEST.MF
431 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/catalina.policy
432 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.properties*
433 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.manifest
434 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.xml
435 %dir %attr(1730,root,tomcat) %{_vardir}/work
436 %dir %attr(775,root,tomcat) %{_vardir}/webapps
437 %dir %attr(775,root,tomcat) %{_vardir}/temp
438 %dir %attr(775,root,tomcat) %{_logdir}/tomcat
442 %defattr(644,root,root,755)
443 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/tomcat-docs.xml
444 %{_tomcatdir}/webapps/tomcat-docs
447 %defattr(644,root,root,755)
448 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/admin.xml
449 %{_tomcatdir}/server/webapps/admin
452 %defattr(644,root,root,755)
453 %{_javadir}/jasper-compiler-jdt.jar
454 %{_javadir}/jasper-compiler.jar
455 %{_javadir}/jasper-runtime.jar