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 Patch6: apache-%{name}-struts.patch
31 Patch7: apache-%{name}-admin-struts.patch
32 Patch8: apache-%{name}-no_links_to_examples.patch
33 URL: http://tomcat.apache.org/
35 BuildRequires: java-sun >= 1.5
36 BuildRequires: java-sun-jre >= 1.5
38 BuildRequires: java-gcj-compat-devel
40 BuildRequires: ant >= 1.5.3
41 BuildRequires: ant-trax
42 BuildRequires: eclipse-jdt
44 BuildRequires: java-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 BuildRequires: java-jdbc-mysql
63 %{?with_jta:BuildRequires: java-jta >= 0:1.0.1}
64 BuildRequires: java-log4j
65 BuildRequires: java-mail >= 0:1.3.1
66 BuildRequires: java-puretls
67 BuildRequires: java-servletapi5 = %{version}
68 BuildRequires: java-struts >= 1.0.2
69 BuildRequires: java-xerces >= 0:2.7.1
70 BuildRequires: java-xml-commons
71 BuildRequires: jaxp_parser_impl >= 0:2.7.1
72 BuildRequires: jdbc-stdext >= 0:2.0
74 BuildRequires: jndi >= 0:1.2.1
75 BuildRequires: jpackage-utils
76 BuildRequires: junit >= 0:3.8.1
77 BuildRequires: rpmbuild(macros) >= 1.300
78 Requires(post,postun): /sbin/ldconfig
79 Requires(post,preun): /sbin/chkconfig
80 Requires(postun): /usr/sbin/groupdel
81 Requires(postun): /usr/sbin/userdel
82 Requires(pre): /bin/id
83 Requires(pre): /usr/bin/getgid
84 Requires(pre): /usr/sbin/groupadd
85 Requires(pre): /usr/sbin/useradd
86 Requires: %{name}-jasper = %{version}-%{release}
88 Requires: java-commons-beanutils
89 Requires: java-commons-collections
90 Requires: java-commons-digester
91 Requires: java-commons-el
92 Requires: java-commons-logging
93 Requires: java-commons-modeler
94 Requires: java-commons-pool-tomcat5
95 Requires: java-jdbc-mysql
97 Requires: java-servletapi5 = %{version}
98 Requires: java-xml-commons
99 Requires: javamail >= 1.2
100 Requires: jaxp_parser_impl
101 Requires: jdbc-stdext >= 2.0
102 Requires: jndi >= 1.2.1
104 Requires: jsse >= 1.0.2
105 %{?with_jta:Requires: jta >= 1.0.1}
107 Provides: group(servlet)
108 Provides: group(tomcat)
109 Provides: java-servlet-container
110 Provides: user(tomcat)
111 Obsoletes: apache-tomcat
112 Obsoletes: jakarta-tomcat
114 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
116 %define _tomcatdir %{_datadir}/tomcat
117 %define _logdir %{_var}/log
118 %define _vardir %{_var}/lib/tomcat
119 %define _sysconfdir /etc/tomcat
121 %define find_jar() %{expand:%%define jarfile {%(jar=$(find-jar %1); echo ${jar:-%%nil})}}%{?jarfile}%{!?jarfile:%{error:find-jar %1 failed}}%{nil}
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.
129 Tomcat is developed in an open and participatory environment and
130 released under the Apache Software License. Tomcat is intended to be a
131 collaboration of the best-of-breed developers from around the world.
132 We invite you to participate in this open development project.
134 %description -l pl.UTF-8
135 Tomcat to kontener serwletowy używany przez oficjalną implementację
136 wzorcową technologii Java Servlet i JavaServer Pages. Specyfikacje
137 Java Servlet i JavaServer Pages są rozwijane przez Suna zgodnie z Java
141 Summary: The Apache Tomcat Servlet/JSP Container documentation
142 Summary(pl.UTF-8): Dokumentacja do Tomcata - kontenera Servlet/JSP
144 Obsoletes: apache-tomcat-doc
145 Obsoletes: jakarta-tomcat-doc
148 The Tomcat Servlet/JSP Container documentation.
150 %description doc -l pl.UTF-8
151 Dokumentacja do Tomcata - kontenera Servlet/JSP.
154 Summary: Apache Tomcat`s Administration Web Application
155 Summary(pl.UTF-8): Panel Administracyjny dla Apache Tomcat
156 Group: Networking/Daemons/Java/Servlets
157 Requires: %{name} = %{version}-%{release}
158 Requires: java-commons-chain
161 Administration Web Application for Apache Tomcat.
163 %description admin -l pl.UTF-8
164 Panel Administracyjny dla Apache Tomcat.
167 Summary: JSP compiler
168 Summary(pl.UTF-8): Kompilator JSP
169 Group: Libraries/Java
170 Requires: jpackage-utils
171 Obsoletes: apache-tomcat-jasper
174 Jasper is Java ServerPages compiler used by Apache Tomcat servlet
177 %description jasper -l pl.UTF-8
178 Jasper jest kompilatorem Java ServerPages używanym przez kontener
179 servletów Apache Tomcat.
182 %setup -q -n apache-%{name}-%{version}-src
193 # we don't need those scripts
194 rm -f container/catalina/src/bin/*.bat
195 rm -f container/catalina/src/bin/{startup,shutdown}.sh
197 # causes file(1) rpm to abort, and not really neccessary file
198 # file: Thumbs.db: ERROR: Cannot read short stream (Invalid argument)
199 # rpm: error: magic_file(ms, "Thumbs.db") failed: mode 37777700644 Cannot read short stream (Invalid argument)
200 rm container/webapps/admin/images/Thumbs.db
202 # servletapi built from java-servletapi5.spec
205 # Remove pre-built jars
206 find -name '*.jar' | xargs rm -fv
212 cat > build.properties <<EOF
213 commons-beanutils.jar=$(find-jar commons-beanutils-core)
214 commons-launcher.jar=$(find-jar commons-launcher)
215 commons-daemon.jar=$(find-jar commons-daemon)
216 commons-digester.jar=$(find-jar commons-digester)
217 commons-el.jar=$(find-jar commons-el)
218 commons-logging-api.jar=$(find-jar commons-logging-api)
219 commons-logging.jar=$(find-jar commons-logging)
220 commons-modeler.jar=$(find-jar commons-modeler)
221 xercesImpl.jar=$(find-jar jaxp_parser_impl)
222 xml-apis.jar=$(find-jar xml-commons-apis)
223 jdt.jar=$(find-jar org.eclipse.jdt.core)
224 jasper-compiler-jdt.home=$TOPDIR/tomcat-deps
225 commons-httpclient.jar=$(find-jar commons-httpclient)
226 commons-collections.jar=$(find-jar commons-collections)
227 commons-fileupload.jar=$(find-jar commons-fileupload)
228 commons-io.jar=$(find-jar commons-io)
229 jmx.jar=$(find-jar jmx)
230 jmx-tools.jar=$(find-jar jmx)
231 junit.jar=$(find-jar junit)
232 struts.jar=$(find-jar struts-core)
233 struts-core.jar=$(find-jar struts-core)
234 struts-taglib.jar=$(find-jar struts-taglib)
235 jcert.jar=$(find-jar jcert)
236 jnet.jar=$(find-jar jnet)
237 jsse.jar=$(find-jar jsse)
238 %{?with_jta:jta.jar=$(find-jar jta)}
239 puretls.jar=$(find-jar puretls)
240 servlet-api.jar=$(find-jar servlet-api)
241 servletapi.build.notrequired=true
242 jsp-api.jar=$(find-jar jsp-api)
243 jspapi.build.notrequired=true
244 log4j.jar=$(find-jar log4j)
245 tomcat-dbcp.jar=$(find-jar commons-dbcp-tomcat5)
246 struts.lib=%{_javadir}-struts
249 if grep '=$' build.properties; then
250 : Some .jar could not be found
258 rm -rf $RPM_BUILD_ROOT
260 TOMCATDIR=$RPM_BUILD_ROOT%{_tomcatdir}
261 CATALINADIR=$RPM_BUILD_ROOT/var/lib/tomcat
263 randpw=$(echo $RANDOM$$ | md5sum | cut -c 1-15)
264 %{__sed} -i -e "s:SHUTDOWN:${randpw}:" conf/{server,server-minimal}.xml
266 install -d $TOMCATDIR/bin \
267 $TOMCATDIR/common/{lib,classes,endorsed} \
268 $TOMCATDIR/server/{lib,classes} \
270 $RPM_BUILD_ROOT%{_logdir}/tomcat \
271 $RPM_BUILD_ROOT%{_vardir}/webapps \
272 $RPM_BUILD_ROOT%{_vardir}/work \
273 $RPM_BUILD_ROOT%{_vardir}/conf \
274 $RPM_BUILD_ROOT/etc/sysconfig \
275 $RPM_BUILD_ROOT/etc/rc.d/init.d
277 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/tomcat
278 install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/tomcat
280 cp -a conf/* $CATALINADIR/conf
281 install %{SOURCE10} $CATALINADIR/conf/Catalina/localhost/ROOT.xml
282 install %{SOURCE11} $CATALINADIR/conf/Catalina/localhost/balancer.xml
283 install %{SOURCE12} $CATALINADIR/conf/Catalina/localhost/jsp-examples.xml
284 install %{SOURCE13} $CATALINADIR/conf/Catalina/localhost/tomcat-docs.xml
285 install %{SOURCE14} $CATALINADIR/conf/Catalina/localhost/webdav.xml
286 cp -HR bin common server $TOMCATDIR
288 cp -a server/webapps $TOMCATDIR/server
289 cp -a webapps $TOMCATDIR
290 cp -a shared $TOMCATDIR
291 cp -a temp $CATALINADIR
293 ln -sf %{_logdir}/tomcat $CATALINADIR/logs
294 ln -sf %{_logdir}/tomcat $TOMCATDIR/logs
295 ln -sf %{_vardir}/work $TOMCATDIR/work
296 ln -sf %{_vardir}/conf $TOMCATDIR/conf
297 ln -sf %{_vardir}/conf $RPM_BUILD_ROOT%{_sysconfdir}
299 # symlinks instead of copies
300 jars="commons-daemon commons-logging-api"
303 ln -sf $jar $TOMCATDIR/bin
306 jars="commons-el commons-dbcp-tomcat5 commons-pool-tomcat5 servlet-api jsp-api commons-modeler jdbc-mysql"
309 ln -sf $jar $TOMCATDIR/common/lib
312 jars="jaxp_parser_impl xml-commons-apis"
315 ln -sf $jar $TOMCATDIR/common/endorsed
318 jars="struts-core struts-taglib commons-collections commons-beanutils-core commons-digester commons-chain"
321 ln -sf $jar $TOMCATDIR/server/webapps/admin/WEB-INF/lib
324 jars="commons-modeler"
327 ln -sf $jar $TOMCATDIR/server/lib
330 install -d $RPM_BUILD_ROOT%{_javadir}
331 mv $TOMCATDIR/common/lib/jasper*.jar $RPM_BUILD_ROOT%{_javadir}
332 ln -sf %{_javadir}/jasper-compiler-jdt.jar $TOMCATDIR/common/lib
333 ln -sf %{_javadir}/jasper-compiler.jar $TOMCATDIR/common/lib
334 ln -sf %{_javadir}/jasper-runtime.jar $TOMCATDIR/common/lib
337 rm -rf $RPM_BUILD_ROOT
340 %groupadd -g 234 -r -f tomcat
341 %groupadd -g 237 -r -f servlet
342 %useradd -u 234 -r -d /var/lib/tomcat -s /bin/false -c "Tomcat User" -g tomcat -G servlet tomcat
345 /sbin/chkconfig --add tomcat
346 %service tomcat restart
349 if [ "$1" = "0" ]; then
351 /sbin/chkconfig --del tomcat
355 if [ "$1" = "0" ]; then
362 %defattr(644,root,root,755)
363 %doc build/{RELEASE-NOTES,RUNNING.txt}
364 %attr(754,root,root) /etc/rc.d/init.d/tomcat
365 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/tomcat
368 %dir %{_tomcatdir}/conf
369 %dir %{_tomcatdir}/bin
370 %{_tomcatdir}/bin/catalina-tasks.xml
371 %{_tomcatdir}/bin/jkstatus-tasks.xml
372 %{_tomcatdir}/bin/jmxaccessor-tasks.xml
373 %attr(755,root,root) %{_tomcatdir}/bin/*.sh
374 %{_tomcatdir}/bin/*.jar
375 %dir %{_tomcatdir}/common
376 %dir %{_tomcatdir}/common/classes
377 %dir %{_tomcatdir}/common/endorsed
378 %dir %{_tomcatdir}/common/i18n
379 %{_tomcatdir}/common/endorsed/*.jar
380 %{_tomcatdir}/common/i18n/tomcat-i18n-en.jar
381 %lang(es) %{_tomcatdir}/common/i18n/tomcat-i18n-es.jar
382 %lang(fr) %{_tomcatdir}/common/i18n/tomcat-i18n-fr.jar
383 %lang(ja) %{_tomcatdir}/common/i18n/tomcat-i18n-ja.jar
384 %{_tomcatdir}/common/lib
385 %dir %{_tomcatdir}/server
386 %dir %{_tomcatdir}/server/classes
387 %{_tomcatdir}/server/lib
388 %dir %{_tomcatdir}/server/webapps
390 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/host-manager.xml
391 %{_tomcatdir}/server/webapps/host-manager
393 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/manager.xml
394 %{_tomcatdir}/server/webapps/manager
396 %dir %{_tomcatdir}/webapps
398 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/ROOT.xml
399 %{_tomcatdir}/webapps/ROOT
401 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/balancer.xml
402 %{_tomcatdir}/webapps/balancer
404 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/webdav.xml
405 %{_tomcatdir}/webapps/webdav
411 # these directory has to be writeable because /admin need to modify config
412 # files and create temporary files
413 %dir %attr(775,root,tomcat) %{_vardir}/conf
414 %dir %attr(775,root,tomcat) %{_vardir}/conf/Catalina
415 %dir %{_vardir}/conf/Catalina/localhost
416 # tomcat config has to be writeable because of tomcat-users.xml file and Catalina dir
417 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/MANIFEST.MF
418 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/catalina.policy
419 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.properties*
420 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.manifest
421 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/*.xml
422 %dir %attr(1730,root,tomcat) %{_vardir}/work
423 %dir %attr(775,root,tomcat) %{_vardir}/webapps
424 %dir %attr(775,root,tomcat) %{_vardir}/temp
425 %dir %attr(775,root,tomcat) %{_logdir}/tomcat
429 %defattr(644,root,root,755)
430 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/tomcat-docs.xml
431 %{_tomcatdir}/webapps/tomcat-docs
434 %defattr(644,root,root,755)
435 %config(noreplace) %attr(664,root,tomcat) %verify(not md5 mtime size) %{_vardir}/conf/Catalina/localhost/admin.xml
436 %{_tomcatdir}/server/webapps/admin
439 %defattr(644,root,root,755)
440 %{_javadir}/jasper-compiler-jdt.jar
441 %{_javadir}/jasper-compiler.jar
442 %{_javadir}/jasper-runtime.jar