1 %define jsdkversion 20000924
2 %define apxs /usr/sbin/apxs1
4 Summary: Servlet engine with support for the leading web server
5 Summary(pl): Silnik serwletów ze wsparciem dla wiod±cego serwera WWW
9 License: freely distributable & usable (JServ), LGPL (JSDK)
10 Group: Networking/Daemons
11 Source0: http://java.apache.org/jserv/dist/%{name}-%{version}.tar.gz
12 # Source0-md5: 6d48a1b9fcc5eea4dfebaae29ba5a485
13 Source1: http://www.euronet.nl/~pauls/java/servlet/download/classpathx_servlet-%{jsdkversion}.tar.gz
14 # Source1-md5: a81feddb91b1358f9aaed94e83eddb54
15 Patch0: %{name}-enable-secret.patch
16 Patch1: %{name}-ac.patch
17 URL: http://java.apache.org/
18 BuildRequires: apache1-devel >= 1.3.9-8
23 Requires(post): sh-utils
24 Requires(post): textutils
25 Requires(post,preun): fileutils
26 Requires(post,preun): sed
27 Requires: apache1 >= 1.3.6
30 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32 %define libexecdir %(%{apxs} -q LIBEXECDIR)
33 %define httpdconf %(%{apxs} -q SYSCONFDIR)
34 %define jservconf %{httpdconf}/jserv
35 %define logdir /var/log/httpd
36 %define servletdir %{_datadir}/jserv/servlets
37 %define classesdir %{_datadir}/jserv/classes
40 Apache JServ is a servlet engine, developed by the Java Apache Project
41 <http://java.apache.org/>. The Apache JServ servlet engine is written
42 in 100pc Java application, and listens for servlet requests using the
43 Apache Java protocol (AJp). Typically, these requests will originate
44 from the mod_jserv Apache module (DSO included). This package contains
45 a LGPL'ed implementation of sun's java servlet api version 2.0 by Paul
46 Siegmann <http://www.euronet.nl/~pauls/java/servlet/>
49 Apache JServ jest silnikiem serwletowym, rozwijanym przez Java Apache
50 Project <http://java.apache.org/>. Silnik serwletowy Apache JServ
51 zosta³ napisany od pocz±tku do koñca w Javie; nas³uchuje wywo³añ
52 serwletu wykorzystuj±c protokó³ Apache Java (AJp). Zazwyczaj wywo³ania
53 te pochodz± z modu³u Apache mod_jservmodule (³±cznie z DSO). Pakiet
54 ten zawiera sunowsk± implementacjê api serletów w javie w wersji 2.0
55 (na licencji LGPL) napisana przez Paula Siegmanna
56 <http://www.euronet.nl/~pauls/java/servlet/>
63 # final position of GNU JSDK-Classes
64 sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
65 conf/jserv.properties.in > conf/jserv.properties.in.new
66 mv -f conf/jserv.properties.in.new conf/jserv.properties.in
68 # do not load module in provided jserv.conf; we do this in httpd.conf
69 sed 's|@LOAD_OR_NOT@|#|g' conf/jserv.conf.in \
70 > conf/jserv.conf.in.new
71 mv -f conf/jserv.conf.in.new conf/jserv.conf.in
82 %{__make} -C classpathx_servlet-%{jsdkversion} jar_2_0
83 %{__make} -C classpathx_servlet-%{jsdkversion}/apidoc
87 cp classpathx_servlet-%{jsdkversion}/README \
88 classpathx_servlet-%{jsdkversion}/AUTHORS \
89 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
91 cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
95 APXS_CFLAGS=`%{apxs} -q CFLAGS`
96 CFLAGS="$APXS_CFLAGS %{rpmcflags}" ./configure \
100 --with-logdir=%{logdir} \
101 --with-servlets=%{servletdir} \
102 --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar \
103 --with-jdk-home=%{_libdir}/java
108 rm -rf $RPM_BUILD_ROOT
109 install -d $RPM_BUILD_ROOT%{classesdir}
110 #install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,profile.d,logrotate.d}
113 DESTDIR=$RPM_BUILD_ROOT
115 echo "default - change on install `date`" > $RPM_BUILD_ROOT%{jservconf}/jserv.secret.key
116 chmod 600 $RPM_BUILD_ROOT%{jservconf}/jserv.secret.key
119 #install -m755 src/scripts/package/rpm/jserv.init $RPM_BUILD_ROOT/etc/rc.d/init.d/jserv
120 #install -m755 src/scripts/package/rpm/jserv.sh $RPM_BUILD_ROOT/etc/profile.d
121 #install -m644 src/scripts/package/rpm/jserv.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/jserv
124 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar $RPM_BUILD_ROOT%{classesdir}
126 find docs jsdk-doc -name 'Makefile*' | xargs rm -f
127 rm -rf jsdk-doc/{COPYING.LIB,CVS}
130 rm -rf $RPM_BUILD_ROOT
133 # use fortune + install-date + process-list to create pseudo-random, hardly
134 # guessable secret key. Use md5sum to create a hash from this, if available:
135 (fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
136 | (md5sum 2>/dev/null || cat) > %{jservconf}/jserv.secret.key
137 chmod 600 %{jservconf}/jserv.secret.key
140 # determine apache-USER and chown the jserv.secrect.key - file
142 APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
143 if test ! "x$APACHEUSER" = x ; then
144 USERCOMMENT="(which is '$APACHEUSER' ?)"
149 chown $APACHEUSER %{jservconf}/jserv.secret.key
152 # determine apache-GROUP and allow this group to write to %{logdir}
153 APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
154 if test "x$APACHEGROUP" = x ; then
157 chgrp $APACHEGROUP %{logdir}
161 # Add 'jserv' as an independent service (manual mode)
162 #/sbin/chkconfig --add jserv
163 #/etc/rc.d/init.d/jserv start
166 # Find Include Statement or add it if necessary
169 cp -f %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
170 grep -q '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf
171 if test $? -eq 0 ; then
172 # found. Insert our include statement here
173 ## this depends on GNU-sed ('|')
174 sed 's|^#\?\(.*Include\).*/jserv.conf.*$|\1 %{jservconf}/jserv.conf|g' \
175 %{httpdconf}/httpd.conf.rpmorig > %{httpdconf}/httpd.conf
179 echo "<IfModule mod_jserv.c>"
180 echo " Include %{jservconf}/jserv.conf"
182 ) >> %{httpdconf}/httpd.conf
186 # LoadModule; uncomment or insert
188 grep -q '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf
189 if test $? -eq 0 ; then
190 # found. Remove any comment
191 sed 's|^#.*\(LoadModule.*mod_jserv.so\)|\1|g' \
192 %{httpdconf}/httpd.conf > %{httpdconf}/httpd.conf.loadMod
193 mv -f %{httpdconf}/httpd.conf.loadMod %{httpdconf}/httpd.conf
195 # Insert LoadModule line before first valid LoadModule
199 echo "LoadModule jserv_module modules/mod_jserv.so"
202 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
206 # AddModule; uncomment or insert
208 grep -q '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf
209 if test $? -eq 0 ; then
210 # found. Remove any comment
211 sed 's|^#.*\(AddModule.*mod_jserv.c\)|\1|g' \
212 %{httpdconf}/httpd.conf > %{httpdconf}/httpd.conf.addMod
213 mv -f %{httpdconf}/httpd.conf.addMod %{httpdconf}/httpd.conf
218 echo "AddModule mod_jserv.c"
221 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
225 # Search for JAVA at possible locations and edit wrapper.bin
228 for lookfor in java jre ; do
236 if test -x "$loc/bin/$lookfor" ; then
237 JAVABIN="$loc/bin/$lookfor"
242 if test -z "$JAVABIN" ; then
243 for prefix in /usr/jdk /usr/jdk- /usr/local/jdk /usr/local/jdk- ; do
244 for jplatform in 2 1 ; do
245 for subvers in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
246 if test -x "${prefix}1.$jplatform$subvers/bin/$lookfor" ; then
247 JAVABIN="${prefix}1.$jplatform$subvers/bin/$lookfor"
251 if test ! -z "$JAVABIN" ; then break ; fi
253 if test ! -z "$JAVABIN" ; then break ; fi
256 if test ! -z "$JAVABIN" ; then break ; fi
260 if test ! -z "$JAVABIN" ; then
261 sed "s|^wrapper.bin=.*$|wrapper.bin=$JAVABIN|" \
262 %{jservconf}/jserv.properties > %{jservconf}/jserv.properties.new
263 mv -f %{jservconf}/jserv.properties.new %{jservconf}/jserv.properties
267 # Get Server Port to echo right URL below
269 SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
270 head -n 1 | awk '{print ":" $2}'`
271 if test "$SERVERPORT" = ":80" ; then
275 #FIXME: make this i18n-aware
277 if test ! "x$JAVABIN" = x ; then
278 echo "using java VM $JAVABIN"
280 echo "## didn't find java or jre. Please install it and edit the"
281 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
284 echo "In order to enable JServ, restart the webserver and try"
285 echo " http://localhost$SERVERPORT/servlets/IsItWorking"
287 echo " http://localhost$SERVERPORT/jserv/"
291 ## we hopefully may distribute SUN-jsdk.jar with jserv once ..
292 echo " | NOTE that this distribution contains a fully functional"
293 echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
294 echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
295 echo " | in the wrapper.classpath - line in the file"
296 echo " | %{jservconf}/jserv.properties"
297 echo " | with the SUN jsdk."
298 echo " | Get it from <http://java.sun.com/products/servlet/>."
299 echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
300 echo " | is supported (_EXACTLY_ 2.0)."
303 echo "Please send comments/suggestions regarding"
304 echo "this RPM to <zeller@to.com>."
307 # do not remove the configured stuff if we upgrade.
308 # the $1 argument contains the number of packages _after_ installation.
309 if [ "$1" != "0" ] ; then
313 # Remove 'jserv' service (manual mode)
314 #/etc/rc.d/init.d/jserv stop
315 #/sbin/chkconfig --del jserv
318 # Find jserv related configuration settings and comment
322 cp -f %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
323 sed 's|.*\(Include.*%{jservconf}/jserv.conf\)|#\1|g' \
324 %{httpdconf}/httpd.conf.rpmorig \
325 | sed 's|^\(AddModule.*mod_jserv.c\)|#\1|g' \
326 | sed 's|^\(LoadModule.*mod_jserv.so\)|#\1|g' \
327 > %{httpdconf}/httpd.conf
329 /bin/rm -fr %{logdir}/mod_jserv.log
330 /bin/rm -fr %{logdir}/jserv.log
333 %defattr(644,root,root,755)
334 # mmh, we can't give %{_prefix}/docs to %doc ..
335 %doc index.html LICENSE README docs jsdk-doc
338 %config(noreplace) %verify(not md5 mtime size) %{jservconf}/jserv.properties
339 %config(noreplace) %verify(not md5 mtime size) %{jservconf}/zone.properties
340 %config(noreplace) %verify(not md5 mtime size) %{jservconf}/jserv.conf
342 # these are just for demonstration and thus,
343 # no %config-files per-se; do not install
344 # them for the RPM-packet
345 #%%{jservconf}/jserv.properties.default
346 #%%{jservconf}/zone.properties.default
347 #%%{jservconf}/jserv.conf.default
349 %attr(600,http,http) %{jservconf}/jserv.secret.key
350 #%config /etc/rc.d/init.d/jserv
351 #%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/jserv
352 #%config /etc/profile.d/jserv.sh
354 %attr(755,root,root) %{libexecdir}/mod_jserv.so
355 %{libexecdir}/ApacheJServ.jar
358 %{classesdir}/servlet-2.0.jar
361 %{servletdir}/Hello.java
362 %{servletdir}/Hello.class
363 %{servletdir}/IsItWorking.java
364 %{servletdir}/IsItWorking.class
366 # we need to have write access here
367 %attr(770,root,http) %dir %{logdir}