2 # - packages for *.renametojar files (-cgi and -ssi in server/lib)
4 %bcond_without javadoc # skip building javadocs
5 %bcond_with jta # put jta jar into tomcat lib dir.
6 %bcond_without java_sun # build with gcj (does not work)
8 Summary: Apache Servlet/JSP Engine, RI for Servlet 2.4/JSP 2.0 API
9 Summary(pl.UTF-8): Silnik Servlet/JSP Apache będący wzorcową implementacją API Servlet 2.4/JSP 2.0
14 Group: Networking/Daemons/Java
15 Source0: http://www.apache.org/dist/tomcat/tomcat-5/v%{version}/src/apache-%{name}-%{version}-src.tar.gz
16 # Source0-md5: eb3f196013550b9b1684e4ff18593a8e
17 Source1: apache-%{name}.init
18 Source2: apache-%{name}.sysconfig
19 Source10: apache-%{name}-context-ROOT.xml
20 Source11: apache-%{name}-context-balancer.xml
21 Source12: apache-%{name}-context-jsp-examples.xml
22 Source13: apache-%{name}-context-tomcat-docs.xml
23 Source14: apache-%{name}-context-webdav.xml
24 Patch0: apache-%{name}-skip-servletapi.patch
25 Patch1: apache-%{name}-nsis.patch
26 Patch2: apache-%{name}-native.patch
27 Patch3: apache-%{name}-skip-jdt.patch
28 Patch4: apache-%{name}-no-connectors.patch
29 Patch5: apache-%{name}-dbcp.patch
30 # this patch is needed for struts >= 1.3
31 Patch6: apache-%{name}-struts.patch
32 # WTF? Why is it needed? Is it related to struts version?
33 Patch7: apache-%{name}-admin-struts.patch
34 Patch8: apache-%{name}-no_links_to_examples.patch
35 URL: http://tomcat.apache.org/
37 BuildRequires: java-sun >= 1.5
38 BuildRequires: java-sun-jre >= 1.5
40 # BuildRequires: jsse >= 0:1.0.3
41 BuildRequires: java-gcj-compat-devel
43 BuildRequires: ant >= 1.5.3
44 BuildRequires: ant-trax
45 BuildRequires: eclipse-jdt
47 BuildRequires: jakarta-regexp >= 0:1.3
48 BuildRequires: java-commons-beanutils >= 1.7
49 BuildRequires: java-commons-chain
50 BuildRequires: java-commons-collections >= 0:3.1
51 BuildRequires: java-commons-collections-tomcat5 >= 0:3.1
52 BuildRequires: java-commons-daemon >= 1.0
53 BuildRequires: java-commons-dbcp >= 0:1.2.1
54 BuildRequires: java-commons-dbcp-tomcat5 >= 0:1.2.1
55 BuildRequires: java-commons-digester >= 0:1.7
56 BuildRequires: java-commons-el >= 0:1.0
57 BuildRequires: java-commons-fileupload >= 0:1.0
58 BuildRequires: java-commons-httpclient
59 BuildRequires: java-commons-io >= 1.4
60 BuildRequires: java-commons-launcher >= 0:0.9
61 BuildRequires: java-commons-logging >= 0:1.0.4
62 BuildRequires: java-commons-modeler >= 2.0
63 BuildRequires: java-commons-pool >= 0:1.2
64 BuildRequires: java-commons-pool-tomcat5 >= 0:1.2
65 BuildRequires: java-jdbc-mysql
66 %{?with_jta:BuildRequires: java-jta >= 0:1.0.1}
67 BuildRequires: java-log4j
68 BuildRequires: java-mail >= 0:1.3.1
69 BuildRequires: java-puretls
70 BuildRequires: java-servletapi5 = %{version}
71 #BuildRequires: java-struts >= 0:1.2.7
72 BuildRequires: java-struts >= 1.0.2
73 BuildRequires: java-xerces >= 0:2.7.1
74 BuildRequires: java-xml-commons
75 #BuildRequires: java-xml-commons >= 1.3
76 BuildRequires: jaxp_parser_impl >= 0:2.7.1
77 BuildRequires: jdbc-stdext >= 0:2.0
79 BuildRequires: jndi >= 0:1.2.1
80 BuildRequires: jpackage-utils
81 BuildRequires: junit >= 0:3.8.1
82 BuildRequires: rpmbuild(macros) >= 1.300
83 Requires(post,postun): /sbin/ldconfig
84 Requires(post,preun): /sbin/chkconfig
85 Requires(postun): /usr/sbin/groupdel
86 Requires(postun): /usr/sbin/userdel
87 Requires(pre): /bin/id
88 Requires(pre): /usr/bin/getgid
89 Requires(pre): /usr/sbin/groupadd
90 Requires(pre): /usr/sbin/useradd
91 Requires: %{name}-jasper = %{version}-%{release}
93 #Requires: jaf >= 1.0.1
94 Requires: java-commons-beanutils
95 Requires: java-commons-collections
96 #Requires: java-commons-dbcp-tomcat5
97 Requires: java-commons-digester
98 Requires: java-commons-el
99 #Requires: java-commons-fileupload
100 Requires: java-commons-logging
101 Requires: java-commons-modeler
102 Requires: java-commons-pool-tomcat5
103 Requires: java-jdbc-mysql
104 Requires: java-regexp
105 Requires: java-servletapi5 = %{version}
106 Requires: java-xml-commons
107 Requires: javamail >= 1.2
108 Requires: jaxp_parser_impl
109 Requires: jdbc-stdext >= 2.0
110 Requires: jndi >= 1.2.1
112 Requires: jsse >= 1.0.2
113 %{?with_jta:Requires: jta >= 1.0.1}
115 Provides: group(servlet)
116 Provides: group(tomcat)
117 Provides: java-servlet-container
118 Provides: user(tomcat)
119 Obsoletes: apache-tomcat
120 Obsoletes: jakarta-tomcat
122 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
124 %define _tomcatdir %{_datadir}/tomcat
125 %define _logdir %{_var}/log
126 %define _vardir %{_var}/lib/tomcat
127 %define _sysconfdir /etc/tomcat
129 %define find_jar() %{expand:%%define jarfile {%(jar=$(find-jar %1); echo ${jar:-%%nil})}}%{?jarfile}%{!?jarfile:%{error:find-jar %1 failed}}%{nil}
132 Tomcat is the servlet container that is used in the official Reference
133 Implementation for the Java Servlet and JavaServer Pages technologies.
134 The Java Servlet and JavaServer Pages specifications are developed by
135 Sun under the Java Community Process.
137 Tomcat is developed in an open and participatory environment and
138 released under the Apache Software License. Tomcat is intended to be a
139 collaboration of the best-of-breed developers from around the world.
140 We invite you to participate in this open development project.
142 %description -l pl.UTF-8
143 Tomcat to kontener serwletowy używany przez oficjalną implementację
144 wzorcową technologii Java Servlet i JavaServer Pages. Specyfikacje
145 Java Servlet i JavaServer Pages są rozwijane przez Suna zgodnie z Java
149 Summary: The Apache Tomcat Servlet/JSP Container documentation
150 Summary(pl.UTF-8): Dokumentacja do Tomcata - kontenera Servlet/JSP
152 Obsoletes: apache-tomcat-doc
153 Obsoletes: jakarta-tomcat-doc
156 The Tomcat Servlet/JSP Container documentation.
158 %description doc -l pl.UTF-8
159 Dokumentacja do Tomcata - kontenera Servlet/JSP.
162 Summary: Apache Tomcat`s Administration Web Application
163 Summary(pl.UTF-8): Panel Administracyjny dla Apache Tomcat
164 Group: Networking/Daemons/Java/Servlets
165 Requires: %{name} = %{version}-%{release}
166 Requires: java-commons-chain
169 Administration Web Application for Apache Tomcat.
171 %description admin -l pl.UTF-8
172 Panel Administracyjny dla Apache Tomcat.
175 Summary: JSP compiler
176 Summary(pl.UTF-8): Kompilator JSP
177 Group: Libraries/Java
178 Requires: jpackage-utils
179 Obsoletes: apache-tomcat-jasper
182 Jasper is Java ServerPages compiler used by Apache Tomcat servlet
185 %description jasper -l pl.UTF-8
186 Jasper jest kompilatorem Java ServerPages używanym przez kontener
187 servletów Apache Tomcat.
190 %setup -q -n apache-%{name}-%{version}-src
201 # we don't need dos scripts
202 rm -f container/catalina/src/bin/*.bat
204 rm -f container/catalina/src/bin/{startup,shutdown}.sh
206 # causes file(1) rpm to abort, and not really neccessary file
207 rm container/webapps/admin/images/Thumbs.db
208 # file: Thumbs.db: ERROR: Cannot read short stream (Invalid argument)
209 # rpm: error: magic_file(ms, "Thumbs.db") failed: mode 37777700644 Cannot read short stream (Invalid argument)
211 # servletapi built from jakarta-servletapi5.spec
214 # Remove pre-built jars
215 find -name '*.jar' | xargs rm -fv
221 cat > build.properties <<EOF
222 commons-beanutils.jar=$(find-jar commons-beanutils-core)
223 commons-launcher.jar=$(find-jar commons-launcher)
224 commons-daemon.jar=$(find-jar commons-daemon)
225 commons-digester.jar=$(find-jar commons-digester)
226 commons-el.jar=$(find-jar commons-el)
227 commons-logging-api.jar=$(find-jar commons-logging-api)
228 commons-logging.jar=$(find-jar commons-logging)
229 commons-modeler.jar=$(find-jar commons-modeler)
230 xercesImpl.jar=$(find-jar jaxp_parser_impl)
231 xml-apis.jar=$(find-jar xml-commons-apis)
232 jdt.jar=$(find-jar org.eclipse.jdt.core)
233 jasper-compiler-jdt.home=$TOPDIR/tomcat-deps
234 commons-httpclient.jar=$(find-jar commons-httpclient)
235 commons-collections.jar=$(find-jar commons-collections)
236 commons-fileupload.jar=$(find-jar commons-fileupload)
237 commons-io.jar=$(find-jar commons-io)
238 jmx.jar=$(find-jar jmx)
239 jmx-tools.jar=$(find-jar jmx)
240 junit.jar=$(find-jar junit)
241 struts.jar=$(find-jar struts-core)
242 struts-core.jar=$(find-jar struts-core)
243 struts-taglib.jar=$(find-jar struts-taglib)
244 jcert.jar=$(find-jar jcert)
245 jnet.jar=$(find-jar jnet)
246 jsse.jar=$(find-jar jsse)
247 %{?with_jta:jta.jar=$(find-jar jta)}
248 puretls.jar=$(find-jar puretls)
249 servlet-api.jar=$(find-jar servlet-api)
250 servletapi.build.notrequired=true
251 jsp-api.jar=$(find-jar jsp-api)
252 jspapi.build.notrequired=true
253 log4j.jar=$(find-jar log4j)
254 tomcat-dbcp.jar=$(find-jar commons-dbcp-tomcat5)
255 struts.lib=%{_javadir}-struts
258 if grep '=$' build.properties; then
259 : Some .jar could not be found
267 rm -rf $RPM_BUILD_ROOT
269 TOMCATDIR=$RPM_BUILD_ROOT%{_tomcatdir}
270 CATALINADIR=$RPM_BUILD_ROOT/var/lib/tomcat
272 randpw=$(echo $RANDOM$$ | md5sum | cut -c 1-15)
273 %{__sed} -i -e "s:SHUTDOWN:${randpw}:" conf/{server,server-minimal}.xml
275 install -d $TOMCATDIR/bin \
276 $TOMCATDIR/common/{lib,classes,endorsed} \
277 $TOMCATDIR/server/{lib,classes} \
279 $RPM_BUILD_ROOT%{_logdir}/tomcat \
280 $RPM_BUILD_ROOT%{_vardir}/webapps \
281 $RPM_BUILD_ROOT%{_vardir}/work \
282 $RPM_BUILD_ROOT%{_vardir}/conf \
283 $RPM_BUILD_ROOT/etc/sysconfig \
284 $RPM_BUILD_ROOT/etc/rc.d/init.d
286 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/tomcat
287 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/tomcat
289 cp -a conf/* $CATALINADIR/conf
290 install %{SOURCE10} $CATALINADIR/conf/Catalina/localhost/ROOT.xml
291 install %{SOURCE11} $CATALINADIR/conf/Catalina/localhost/balancer.xml
292 install %{SOURCE12} $CATALINADIR/conf/Catalina/localhost/jsp-examples.xml
293 install %{SOURCE13} $CATALINADIR/conf/Catalina/localhost/tomcat-docs.xml
294 install %{SOURCE14} $CATALINADIR/conf/Catalina/localhost/webdav.xml
295 cp -HR bin common server $TOMCATDIR
297 cp -a server/webapps $TOMCATDIR/server
298 cp -a webapps $TOMCATDIR
299 cp -a shared $TOMCATDIR
300 cp -a temp $CATALINADIR
302 ln -sf %{_logdir}/tomcat $CATALINADIR/logs
303 ln -sf %{_logdir}/tomcat $TOMCATDIR/logs
304 ln -sf %{_vardir}/work $TOMCATDIR/work
305 ln -sf %{_vardir}/conf $TOMCATDIR/conf
306 ln -sf %{_vardir}/conf $RPM_BUILD_ROOT%{_sysconfdir}
308 # symlinks instead of copies
309 jars="commons-daemon commons-logging-api"
312 ln -sf $jar $TOMCATDIR/bin
315 jars="commons-el commons-dbcp-tomcat5 commons-pool-tomcat5 servlet-api jsp-api commons-modeler jdbc-mysql"
318 ln -sf $jar $TOMCATDIR/common/lib
321 jars="jaxp_parser_impl xml-commons-apis"
324 ln -sf $jar $TOMCATDIR/common/endorsed
327 jars="struts-core struts-taglib commons-collections commons-beanutils-core commons-digester commons-chain"
330 ln -sf $jar $TOMCATDIR/server/webapps/admin/WEB-INF/lib
333 jars="commons-modeler"
336 ln -sf $jar $TOMCATDIR/server/lib
339 install -d $RPM_BUILD_ROOT%{_javadir}
340 mv $TOMCATDIR/common/lib/jasper*.jar $RPM_BUILD_ROOT%{_javadir}
341 ln -sf %{_javadir}/jasper-compiler-jdt.jar $TOMCATDIR/common/lib
342 ln -sf %{_javadir}/jasper-compiler.jar $TOMCATDIR/common/lib
343 ln -sf %{_javadir}/jasper-runtime.jar $TOMCATDIR/common/lib
346 rm -rf $RPM_BUILD_ROOT
349 %groupadd -g 234 -r -f tomcat
350 %groupadd -g 237 -r -f servlet
351 %useradd -u 234 -r -d /var/lib/tomcat -s /bin/false -c "Tomcat User" -g tomcat -G servlet tomcat
354 /sbin/chkconfig --add tomcat
355 %service tomcat restart
358 if [ "$1" = "0" ]; then
360 /sbin/chkconfig --del tomcat
364 if [ "$1" = "0" ]; then
371 %defattr(644,root,root,755)
372 %doc build/{RELEASE-NOTES,RUNNING.txt}
373 %attr(754,root,root) /etc/rc.d/init.d/tomcat
374 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/tomcat
377 %dir %{_tomcatdir}/conf
378 %dir %{_tomcatdir}/bin
379 %{_tomcatdir}/bin/catalina-tasks.xml
380 %{_tomcatdir}/bin/jkstatus-tasks.xml
381 %{_tomcatdir}/bin/jmxaccessor-tasks.xml
382 %attr(755,root,root) %{_tomcatdir}/bin/*.sh
383 %{_tomcatdir}/bin/*.jar
384 %dir %{_tomcatdir}/common
385 %dir %{_tomcatdir}/common/classes
386 %dir %{_tomcatdir}/common/endorsed
387 %dir %{_tomcatdir}/common/i18n
388 %{_tomcatdir}/common/endorsed/*.jar
389 %{_tomcatdir}/common/i18n/tomcat-i18n-en.jar
390 %lang(es) %{_tomcatdir}/common/i18n/tomcat-i18n-es.jar
391 %lang(fr) %{_tomcatdir}/common/i18n/tomcat-i18n-fr.jar
392 %lang(ja) %{_tomcatdir}/common/i18n/tomcat-i18n-ja.jar
393 %{_tomcatdir}/common/lib
394 %dir %{_tomcatdir}/server
395 %dir %{_tomcatdir}/server/classes
396 %{_tomcatdir}/server/lib
397 %dir %{_tomcatdir}/server/webapps
399 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/host-manager.xml
400 %{_tomcatdir}/server/webapps/host-manager
402 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/manager.xml
403 %{_tomcatdir}/server/webapps/manager
405 %dir %{_tomcatdir}/webapps
407 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/ROOT.xml
408 %{_tomcatdir}/webapps/ROOT
410 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/balancer.xml
411 %{_tomcatdir}/webapps/balancer
413 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/webdav.xml
414 %{_tomcatdir}/webapps/webdav
420 # these directory has to be writeable because /admin need to modify config
421 # files and create temporary files
422 %dir %attr(775,root,tomcat) %{_vardir}/conf
423 %dir %attr(775,root,tomcat) %{_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