2 %bcond_without javadoc # skip building javadocs
3 %bcond_with jta # put jta jar into tomcat lib dir.
4 %bcond_without java_sun # build with gcj (does not work)
6 Summary: Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API
7 Summary(pl.UTF-8): Silnik Servlet/JSP Apache będący wzorcową implementacją API Servlet 2.4/JSP 2.0
12 Group: Networking/Daemons/Java
13 Source0: http://www.apache.org/dist/tomcat/tomcat-5/v%{version}/src/apache-%{name}-%{version}-src.tar.gz
14 # Source0-md5: eb3f196013550b9b1684e4ff18593a8e
15 Source1: apache-%{name}.init
16 Source2: apache-%{name}.sysconfig
17 Source10: apache-%{name}-context-ROOT.xml
18 Source11: apache-%{name}-context-balancer.xml
19 Source12: apache-%{name}-context-jsp-examples.xml
20 Source13: apache-%{name}-context-tomcat-docs.xml
21 Source14: apache-%{name}-context-webdav.xml
22 Patch0: apache-%{name}-skip-servletapi.patch
23 Patch1: apache-%{name}-nsis.patch
24 Patch2: apache-%{name}-native.patch
25 Patch3: apache-%{name}-skip-jdt.patch
26 Patch4: apache-%{name}-no-connectors.patch
27 Patch5: apache-%{name}-dbcp.patch
28 # this patch is needed for struts >= 1.3
29 Patch6: apache-%{name}-struts.patch
30 # WTF? Why is it needed? Is it related to struts version?
31 Patch7: apache-%{name}-admin-struts.patch
32 URL: http://tomcat.apache.org/
34 BuildRequires: java-sun >= 1.5
35 BuildRequires: java-sun-jre >= 1.5
37 # BuildRequires: jsse >= 0:1.0.3
38 BuildRequires: java-gcj-compat-devel
40 BuildRequires: ant >= 1.5.3
41 BuildRequires: ant-trax
42 BuildRequires: eclipse-jdt
44 BuildRequires: jakarta-regexp >= 0:1.3
45 BuildRequires: java-commons-beanutils >= 1.7
46 BuildRequires: java-commons-chain
47 BuildRequires: java-commons-collections >= 0:3.1
48 BuildRequires: java-commons-collections-tomcat5 >= 0:3.1
49 BuildRequires: java-commons-daemon >= 1.0
50 BuildRequires: java-commons-dbcp >= 0:1.2.1
51 BuildRequires: java-commons-dbcp-tomcat5 >= 0:1.2.1
52 BuildRequires: java-commons-digester >= 0:1.7
53 BuildRequires: java-commons-el >= 0:1.0
54 BuildRequires: java-commons-fileupload >= 0:1.0
55 BuildRequires: java-commons-httpclient
56 BuildRequires: java-commons-io >= 1.4
57 BuildRequires: java-commons-launcher >= 0:0.9
58 BuildRequires: java-commons-logging >= 0:1.0.4
59 BuildRequires: java-commons-modeler >= 2.0
60 BuildRequires: java-commons-pool >= 0:1.2
61 BuildRequires: java-commons-pool-tomcat5 >= 0:1.2
62 %{?with_jta:BuildRequires: java-jta >= 0:1.0.1}
63 BuildRequires: java-log4j
64 BuildRequires: java-mail >= 0:1.3.1
65 BuildRequires: java-puretls
66 BuildRequires: java-servletapi5 = %{version}
67 #BuildRequires: java-struts >= 0:1.2.7
68 BuildRequires: java-struts >= 1.0.2
69 BuildRequires: java-xerces >= 0:2.7.1
70 BuildRequires: java-xml-commons
71 #BuildRequires: java-xml-commons >= 1.3
72 BuildRequires: jaxp_parser_impl >= 0:2.7.1
73 BuildRequires: jdbc-stdext >= 0:2.0
75 BuildRequires: jndi >= 0:1.2.1
76 BuildRequires: jpackage-utils
77 BuildRequires: junit >= 0:3.8.1
78 BuildRequires: rpmbuild(macros) >= 1.300
79 Requires(post,postun): /sbin/ldconfig
80 Requires(post,preun): /sbin/chkconfig
81 Requires(postun): /usr/sbin/groupdel
82 Requires(postun): /usr/sbin/userdel
83 Requires(pre): /bin/id
84 Requires(pre): /usr/bin/getgid
85 Requires(pre): /usr/sbin/groupadd
86 Requires(pre): /usr/sbin/useradd
87 Requires: %{name}-jasper = %{version}-%{release}
89 #Requires: jaf >= 1.0.1
90 Requires: java-commons-beanutils
91 Requires: java-commons-collections
92 #Requires: java-commons-dbcp-tomcat5
93 Requires: java-commons-digester
94 Requires: java-commons-el
95 #Requires: java-commons-fileupload
96 Requires: java-commons-logging
97 Requires: java-commons-modeler
99 Requires: java-servletapi5 = %{version}
100 Requires: java-xml-commons
101 Requires: javamail >= 1.2
102 Requires: jaxp_parser_impl
103 Requires: jdbc-stdext >= 2.0
104 Requires: jndi >= 1.2.1
106 Requires: jsse >= 1.0.2
107 %{?with_jta:Requires: jta >= 1.0.1}
109 Provides: group(tomcat)
110 Provides: java-servlet-container
111 Provides: user(tomcat)
112 Obsoletes: apache-tomcat
113 Obsoletes: jakarta-tomcat
115 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
117 %define _tomcatdir %{_datadir}/tomcat
118 %define _logdir %{_var}/log
119 %define _vardir %{_var}/lib/tomcat
120 %define _sysconfdir /etc/tomcat
122 %define find_jar() %{expand:%%define jarfile {%(jar=$(find-jar %1); echo ${jar:-%%nil})}}%{?jarfile}%{!?jarfile:%{error:find-jar %1 failed}}%{nil}
125 Tomcat is the servlet container that is used in the official Reference
126 Implementation for the Java Servlet and JavaServer Pages technologies.
127 The Java Servlet and JavaServer Pages specifications are developed by
128 Sun under the Java Community Process.
130 Tomcat is developed in an open and participatory environment and
131 released under the Apache Software License. Tomcat is intended to be a
132 collaboration of the best-of-breed developers from around the world.
133 We invite you to participate in this open development project.
135 %description -l pl.UTF-8
136 Tomcat to kontener serwletowy używany przez oficjalną implementację
137 wzorcową technologii Java Servlet i JavaServer Pages. Specyfikacje
138 Java Servlet i JavaServer Pages są rozwijane przez Suna zgodnie z Java
142 Summary: The Apache Tomcat Servlet/JSP Container documentation
143 Summary(pl.UTF-8): Dokumentacja do Tomcata - kontenera Servlet/JSP
145 Obsoletes: apache-tomcat-doc
146 Obsoletes: jakarta-tomcat-doc
149 The Tomcat Servlet/JSP Container documentation.
151 %description doc -l pl.UTF-8
152 Dokumentacja do Tomcata - kontenera Servlet/JSP.
155 Summary: Apache Tomcat`s Administration Web Application
156 Summary(pl.UTF-8): Panel Administracyjny dla Apache Tomcat
157 Group: Networking/Daemons/Java/Servlets
158 Requires: %{name} = %{version}-%{release}
159 Requires: java-commons-chain
162 Administration Web Application for Apache Tomcat.
164 %description admin -l pl.UTF-8
165 Panel Administracyjny dla Apache Tomcat.
168 Summary: JSP compiler
169 Summary(pl.UTF-8): Kompilator JSP
170 Group: Libraries/Java
171 Requires: jpackage-utils
172 Obsoletes: apache-tomcat-jasper
175 Jasper is Java ServerPages compiler used by Apache Tomcat servlet
178 %description jasper -l pl.UTF-8
179 Jasper jest kompilatorem Java ServerPages używanym przez kontener
180 servletów Apache Tomcat.
183 %setup -q -n apache-%{name}-%{version}-src
192 # we don't need dos scripts
193 rm -f container/catalina/src/bin/*.bat
195 # causes file(1) rpm to abort, and not really neccessary file
196 rm container/webapps/admin/images/Thumbs.db
197 # file: Thumbs.db: ERROR: Cannot read short stream (Invalid argument)
198 # rpm: error: magic_file(ms, "Thumbs.db") failed: mode 37777700644 Cannot read short stream (Invalid argument)
200 # servletapi built from jakarta-servletapi5.spec
203 # Remove pre-built jars
204 find -name '*.jar' | xargs rm -fv
210 cat > build.properties <<EOF
211 commons-beanutils.jar=$(find-jar commons-beanutils-core)
212 commons-launcher.jar=$(find-jar commons-launcher)
213 commons-daemon.jar=$(find-jar commons-daemon)
214 commons-digester.jar=$(find-jar commons-digester)
215 commons-el.jar=$(find-jar commons-el)
216 commons-logging-api.jar=$(find-jar commons-logging-api)
217 commons-logging.jar=$(find-jar commons-logging)
218 commons-modeler.jar=$(find-jar commons-modeler)
219 xercesImpl.jar=$(find-jar jaxp_parser_impl)
220 xml-apis.jar=$(find-jar xml-commons-apis)
221 jdt.jar=$(find-jar org.eclipse.jdt.core)
222 jasper-compiler-jdt.home=$TOPDIR/tomcat-deps
223 commons-httpclient.jar=$(find-jar commons-httpclient)
224 commons-collections.jar=$(find-jar commons-collections)
225 commons-fileupload.jar=$(find-jar commons-fileupload)
226 commons-io.jar=$(find-jar commons-io)
227 jmx.jar=$(find-jar jmx)
228 jmx-tools.jar=$(find-jar jmx)
229 junit.jar=$(find-jar junit)
230 struts.jar=$(find-jar struts-core)
231 struts-core.jar=$(find-jar struts-core)
232 struts-taglib.jar=$(find-jar struts-taglib)
233 jcert.jar=$(find-jar jcert)
234 jnet.jar=$(find-jar jnet)
235 jsse.jar=$(find-jar jsse)
236 %{?with_jta:jta.jar=$(find-jar jta)}
237 puretls.jar=$(find-jar puretls)
238 servlet-api.jar=$(find-jar servlet-api)
239 servletapi.build.notrequired=true
240 jsp-api.jar=$(find-jar jsp-api)
241 jspapi.build.notrequired=true
242 log4j.jar=$(find-jar log4j)
243 tomcat-dbcp.jar=$(find-jar commons-dbcp-tomcat5)
244 struts.lib=%{_javadir}-struts
247 if grep '=$' build.properties; then
248 : Some .jar could not be found
256 rm -rf $RPM_BUILD_ROOT
258 TOMCATDIR=$RPM_BUILD_ROOT%{_tomcatdir}
259 CATALINADIR=$RPM_BUILD_ROOT/var/lib/tomcat
261 randpw=$(echo $RANDOM$$ | md5sum | cut -c 1-15)
262 %{__sed} -i -e "s:SHUTDOWN:${randpw}:" conf/{server,server-minimal}.xml
264 install -d $TOMCATDIR/bin \
265 $TOMCATDIR/common/{lib,classes,endorsed} \
266 $TOMCATDIR/server/{lib,classes} \
268 $RPM_BUILD_ROOT%{_logdir}/tomcat \
269 $RPM_BUILD_ROOT%{_vardir}/webapps \
270 $RPM_BUILD_ROOT%{_vardir}/work \
271 $RPM_BUILD_ROOT%{_vardir}/conf \
272 $RPM_BUILD_ROOT/etc/sysconfig \
273 $RPM_BUILD_ROOT/etc/rc.d/init.d
275 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/tomcat
276 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/tomcat
278 cp -a conf/* $CATALINADIR/conf
279 install %{SOURCE10} $CATALINADIR/conf/Catalina/localhost/ROOT.xml
280 install %{SOURCE11} $CATALINADIR/conf/Catalina/localhost/balancer.xml
281 install %{SOURCE12} $CATALINADIR/conf/Catalina/localhost/jsp-examples.xml
282 install %{SOURCE13} $CATALINADIR/conf/Catalina/localhost/tomcat-docs.xml
283 install %{SOURCE14} $CATALINADIR/conf/Catalina/localhost/webdav.xml
284 cp -HR bin common server $TOMCATDIR
286 cp -a server/webapps $TOMCATDIR/server
287 cp -a webapps $TOMCATDIR
288 cp -a shared $TOMCATDIR
289 cp -a temp $CATALINADIR
291 ln -sf %{_logdir}/tomcat $CATALINADIR/logs
292 ln -sf %{_vardir}/work $TOMCATDIR/work
293 ln -sf %{_vardir}/conf $TOMCATDIR/conf
294 ln -sf %{_vardir}/conf $RPM_BUILD_ROOT%{_sysconfdir}
296 # symlinks instead of copies
297 jars="commons-el commons-dbcp-tomcat5 servlet-api jsp-api commons-modeler"
300 ln -sf $jar $TOMCATDIR/common/lib
303 jars="jaxp_parser_impl xml-commons-apis"
306 ln -sf $jar $TOMCATDIR/common/endorsed
309 jars="struts-core struts-taglib commons-collections commons-beanutils-core commons-digester commons-chain"
312 ln -sf $jar $TOMCATDIR/server/webapps/admin/WEB-INF/lib
316 # do not make these symlinks as ant didn't do
317 jars="commons-daemon"
320 ln -sf $jar $TOMCATDIR/bin
323 jars="activation ant commons-dbcp commons-logging-api commons-pool servlet jdbc-stdext
324 jmxri jndi %{?with_jta:jta} mail jsse junit mailapi pop3"
327 ln -sf $jar $TOMCATDIR/common/lib
330 ln -sf servlet.jar $TOMCATDIR/common/lib/servletapi4.jar
331 ln -sf jdbc-stdext.jar $TOMCATDIR/common/lib/jdbc2_0-stdext.jar
332 ln -sf jdbc-stdext.jar $TOMCATDIR/common/lib/jdbc-stdext-2.0.jar
333 ln -sf pop3.jar $TOMCATDIR/common/lib/pop.jar
335 jars="commons-beanutils commons-digester commons-fileupload commons-logging jaas regexp"
338 ln -sf $jar $TOMCATDIR/server/lib
340 ln -sf regexp.jar $TOMCATDIR/server/lib/jakarta-regexp-1.2.jar
341 ln -sf regexp.jar $TOMCATDIR/server/lib/regexp-1.2.jar
344 install -d $RPM_BUILD_ROOT%{_javadir}
345 mv $TOMCATDIR/common/lib/jasper*.jar $RPM_BUILD_ROOT%{_javadir}
346 ln -sf %{_javadir}/jasper-compiler-jdt.jar $TOMCATDIR/common/lib
347 ln -sf %{_javadir}/jasper-compiler.jar $TOMCATDIR/common/lib
348 ln -sf %{_javadir}/jasper-runtime.jar $TOMCATDIR/common/lib
351 rm -rf $RPM_BUILD_ROOT
354 %groupadd -g 234 -r -f tomcat
355 %useradd -u 234 -r -d /var/lib/tomcat -s /bin/false -c "Tomcat User" -g tomcat 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
374 %defattr(644,root,root,755)
375 %doc build/{RELEASE-NOTES,RUNNING.txt}
376 %attr(754,root,root) /etc/rc.d/init.d/tomcat
377 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/tomcat
380 %dir %{_tomcatdir}/conf
381 %dir %{_tomcatdir}/bin
382 %{_tomcatdir}/bin/catalina-tasks.xml
383 %{_tomcatdir}/bin/jkstatus-tasks.xml
384 %{_tomcatdir}/bin/jmxaccessor-tasks.xml
385 %attr(755,root,root) %{_tomcatdir}/bin/*.sh
386 %{_tomcatdir}/bin/*.jar
387 %dir %{_tomcatdir}/common
388 %dir %{_tomcatdir}/common/classes
389 %dir %{_tomcatdir}/common/endorsed
390 %dir %{_tomcatdir}/common/i18n
391 %{_tomcatdir}/common/endorsed/*.jar
392 %{_tomcatdir}/common/i18n/tomcat-i18n-en.jar
393 %lang(es) %{_tomcatdir}/common/i18n/tomcat-i18n-es.jar
394 %lang(fr) %{_tomcatdir}/common/i18n/tomcat-i18n-fr.jar
395 %lang(ja) %{_tomcatdir}/common/i18n/tomcat-i18n-ja.jar
396 %{_tomcatdir}/common/lib
397 %dir %{_tomcatdir}/server
398 %dir %{_tomcatdir}/server/classes
399 %{_tomcatdir}/server/lib
400 %dir %{_tomcatdir}/server/webapps
402 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/host-manager.xml
403 %{_tomcatdir}/server/webapps/host-manager
405 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/manager.xml
406 %{_tomcatdir}/server/webapps/manager
408 %dir %{_tomcatdir}/webapps
410 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/ROOT.xml
411 %{_tomcatdir}/webapps/ROOT
413 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/balancer.xml
414 %{_tomcatdir}/webapps/balancer
416 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/webdav.xml
417 %{_tomcatdir}/webapps/webdav
423 %dir %{_vardir}/conf/Catalina
424 %dir %{_vardir}/conf/Catalina/localhost
425 # tomcat config has to be writeable because of tomcat-users.xml file and Catalina dir
426 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/MANIFEST.MF
427 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/catalina.policy
428 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.properties*
429 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.manifest
430 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.xml
431 %dir %attr(1730,root,tomcat) %{_vardir}/work
432 %dir %attr(775,root,tomcat) %{_vardir}/webapps
433 %dir %attr(775,root,tomcat) %{_vardir}/temp
434 %dir %attr(775,root,tomcat) %{_logdir}/tomcat
438 %defattr(644,root,root,755)
439 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/tomcat-docs.xml
440 %{_tomcatdir}/webapps/tomcat-docs
443 %defattr(644,root,root,755)
444 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/admin.xml
445 %{_tomcatdir}/server/webapps/admin
448 %defattr(644,root,root,755)
449 %{_javadir}/jasper-compiler-jdt.jar
450 %{_javadir}/jasper-compiler.jar
451 %{_javadir}/jasper-runtime.jar