3 # we should determine these places with apxs..
4 # it would be nice to do this at install-time
5 # as well in order to dynamically 'relocate' the package.
6 # .. but I think we've to wait for a new RPM to make this happen
9 ## unfortuatly, we don't know the location of the apxs-binary yet .. and
10 ## it may not be in the path which will make the build fail (can
11 ## we set defines conditionally ?)
13 #%define libexecdir `apxs -q LIBEXECDIR`
14 %define libexecdir /usr/lib/apache
16 #%define httpdconf `apxs -q SYSCONFDIR`
17 %define httpdconf /etc/httpd/conf
19 %define jservconf %{httpdconf}/jserv
20 %define logdir /var/log/httpd
21 %define servletdir /home/httpd/servlets
22 %define classesdir /home/httpd/classes
23 %define jsdkversion 19991120
25 Source: %{name}-%{version}.tar.gz
26 Source1: http://www.euronet.nl/~pauls/java/servlet/download/classpathx_servlet-%{jsdkversion}.tar.gz
27 Patch0: jserv-enable-secret.patch
28 Patch1: ApacheJServ-1.1-megaloman.patch
30 Summary: Servlet engine with support for the leading web server
34 URL: http://java.apache.org/
35 Copyright: Freely distributable & usable
36 Group: Networking/Daemons
37 Packager: Henner Zeller <zeller@to.com>
38 Docdir: %{myprefix}/doc
39 Requires: apache >= 1.3.6
40 Provides: jserv jsdk20
41 BuildRoot: /var/tmp/%{name}-%{version}-root
44 #BuildRequires: any-java-compiler
46 BuildRequires: automake >= 1.4
47 BuildRequires: autoconf >= 2.13
48 BuildRequires: libtool >= 1.3.3
50 ## Building this package depending on standard RPM packages
51 ## requires the apxs utility to be there, located in the apache-devel package.
52 ## Because the RH 6.1 1.3.9-4 version has a bug, we need a newer package.
53 ## Comment this out if you want to build this SRC-RPM on your personal
54 ## installation of apache (and thus, apxs).
55 ## (dunno, at which particular release this was fixed .. -4 was faulty and
57 BuildRequires: apache-devel >= 1.3.9-8
60 Apache JServ is a servlet engine, developed by the
61 Java Apache Project <http://java.apache.org/>.
63 The Apache JServ servlet engine is written in 100pc Java application, and
64 listens for servlet requests using the Apache Java protocol (AJp). Typically,
65 these requests will originate from the mod_jserv Apache module (DSO included).
67 This package contains a LGPL'ed implementation of sun's java servlet api
68 version 2.0 by Paul Siegmann <http://www.euronet.nl/~pauls/java/servlet/>
71 rm -rf $RPM_BUILD_ROOT
72 %setup -a 1 -n %{name}-%{version}
74 # enable socket authentification
78 # final position of GNU JSDK-Classes
79 sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
80 < conf/jserv.properties.in > conf/jserv.properties.in.new
81 mv conf/jserv.properties.in.new conf/jserv.properties.in
83 # do not load module in provided jserv.conf; we do this in httpd.conf
84 sed 's|@LOAD_OR_NOT@|#|g' \
85 < conf/jserv.conf.in > conf/jserv.conf.in.new
86 mv conf/jserv.conf.in.new conf/jserv.conf.in
96 make -C classpathx_servlet-%{jsdkversion} jar_2_0
97 make -C classpathx_servlet-%{jsdkversion}/apidoc
101 cp classpathx_servlet-%{jsdkversion}/README \
102 classpathx_servlet-%{jsdkversion}/AUTHORS \
103 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
105 cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
110 # find apxs utility ..
112 APXS_UTIL=`type -p apxs || true`
115 if test "x$APXS_UTIL" = x ; then
116 # mmh, is it possible to query just for
117 # the executeables (like -qd and -qc) ?
118 APXSMATCH=`rpm -ql apache-devel apache | grep apxs`
119 for f in $APXSMATCH ; do
120 if test -x "$f" ; then
128 if test "x$APXS_UTIL" = x ; then
132 /usr/local/apache/bin \
133 /usr/local/apache/sbin \
134 /usr/local/httpd/bin \
135 /usr/local/httpd/sbin
137 if test -x "$loc/apxs" ; then
138 APXS_UTIL="$loc/apxs"
144 if test "x$APXS_UTIL" = x ; then
145 echo "Didn't find apxs .. exiting"
149 APXS_CFLAGS=`$APXS_UTIL -q CFLAGS`
150 CFLAGS="$APXS_CFLAGS $RPM_OPT_FLAGS" ./configure \
151 --prefix=%{myprefix} \
152 --disable-debugging \
153 --with-apxs=$APXS_UTIL \
154 --with-logdir=%{logdir} \
155 --with-servlets=%{servletdir} \
156 --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar
160 make DESTDIR=$RPM_BUILD_ROOT install
162 echo "default - change on install `date`" > $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
163 chmod 600 $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
166 #install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
167 #install -d $RPM_BUILD_ROOT/etc/profile.d
168 #install -d $RPM_BUILD_ROOT/etc/logrotate.d
169 #install -m755 src/scripts/package/rpm/jserv.init $RPM_BUILD_ROOT/etc/rc.d/init.d/jserv
170 #install -m755 src/scripts/package/rpm/jserv.sh $RPM_BUILD_ROOT/etc/profile.d
171 #install -m644 src/scripts/package/rpm/jserv.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/jserv
174 install -d ${RPM_BUILD_ROOT}%{classesdir}
175 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ${RPM_BUILD_ROOT}%{classesdir}
178 rm -rf $RPM_BUILD_ROOT
182 # use fortune + install-date + process-list to create pseudo-random, hardly
183 # guessable secret key. Use md5sum to create a hash from this, if available:
184 (/usr/games/fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
185 | (md5sum 2>/dev/null || cat) \
186 > %{jservconf}/jserv.secret.key
187 chmod 600 %{jservconf}/jserv.secret.key
190 # determine apache-USER and chown the jserv.secrect.key - file
192 APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
193 if test ! "x$APACHEUSER" = x ; then
194 USERCOMMENT="(which is '$APACHEUSER' ?)"
199 chown $APACHEUSER %{jservconf}/jserv.secret.key
202 # determine apache-GROUP and allow this group to write to %{logdir}
203 APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
204 if test "x$APACHEGROUP" = x ; then
207 chgrp $APACHEGROUP %{logdir}
211 # Add 'jserv' as an independent service (manual mode)
212 #/sbin/chkconfig --add jserv
213 #/etc/rc.d/init.d/jserv start
216 # Find Include Statement or add it if necessary
218 cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
219 grep '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf \
221 if test $? -eq 0 ; then
222 # found. Insert our include statement here
223 ## this depends on GNU-sed ('|') .. but we're on a RedHat system anyway
224 sed 's|^#\?\(.*Include\).*/jserv.conf.*$|\1 %{jservconf}/jserv.conf|g' \
225 < %{httpdconf}/httpd.conf.rpmorig \
226 > %{httpdconf}/httpd.conf
230 echo "<IfModule mod_jserv.c>"
231 echo " Include %{jservconf}/jserv.conf"
233 ) >> %{httpdconf}/httpd.conf
237 # LoadModule; uncomment or insert
239 grep '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf \
241 if test $? -eq 0 ; then
242 # found. Remove any comment
243 sed 's|^#.*\(LoadModule.*mod_jserv.so\)|\1|g' \
244 < %{httpdconf}/httpd.conf \
245 > %{httpdconf}/httpd.conf.loadMod
246 mv %{httpdconf}/httpd.conf.loadMod %{httpdconf}/httpd.conf
248 # Insert LoadModule line before first valid LoadModule
249 ( echo "/^LoadModule"
251 echo "LoadModule jserv_module modules/mod_jserv.so"
254 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
258 # AddModule; uncomment or insert
260 grep '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf >/dev/null
261 if test $? -eq 0 ; then
262 # found. Remove any comment
263 sed 's|^#.*\(AddModule.*mod_jserv.c\)|\1|g' \
264 < %{httpdconf}/httpd.conf \
265 > %{httpdconf}/httpd.conf.addMod
266 mv %{httpdconf}/httpd.conf.addMod %{httpdconf}/httpd.conf
270 echo "AddModule mod_jserv.c"
273 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
277 # Search vor JAVA at possible locations and edit wrapper.bin
280 for lookfor in java jre ; do
286 /usr/local/jdk117_v3 \
287 /usr/local/jdk117_v1a
289 if test -x "$loc/bin/$lookfor" ; then
290 JAVABIN="$loc/bin/$lookfor"
295 if test -z "$JAVABIN" ; then
296 for prefix in /usr/jdk /usr/jdk- /usr/local/jdk /usr/local/jdk- ; do
297 for jplatform in 2 1 ; do
298 for subvers in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
299 if test -x "${prefix}1.$jplatform$subvers/bin/$lookfor" ; then
300 JAVABIN="${prefix}1.$jplatform$subvers/bin/$lookfor"
304 if test ! -z "$JAVABIN" ; then break ; fi
306 if test ! -z "$JAVABIN" ; then break ; fi
309 if test ! -z "$JAVABIN" ; then break ; fi
312 if test ! -z "$JAVABIN" ; then
313 sed "s|^wrapper.bin=.*$|wrapper.bin=$JAVABIN|" \
314 < %{jservconf}/jserv.properties \
315 > %{jservconf}/jserv.properties.new
316 mv %{jservconf}/jserv.properties.new %{jservconf}/jserv.properties
320 # Get Server Port to echo right URL below
322 SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
323 head -1 | awk '{print ":" $2}'`
324 if test "$SERVERPORT" = ":80" ; then
328 #FIXME: make this i18n-aware
330 if test ! "x$JAVABIN" = x ; then
331 echo "using java VM $JAVABIN"
333 echo "## didn't find java or jre. Please install it and edit the"
334 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
337 echo "In order to enable JServ, restart the webserver and try"
338 echo " http://localhost$SERVERPORT/servlets/IsItWorking"
340 echo " http://localhost$SERVERPORT/jserv/"
344 ## we hopefully may distribute SUN-jsdk.jar with jserv once ..
345 echo " | NOTE that this distribution contains a fully functional"
346 echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
347 echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
348 echo " | in the wrapper.classpath - line in the file"
349 echo " | %{jservconf}/jserv.properties"
350 echo " | with the SUN jsdk."
351 echo " | Get it from <http://java.sun.com/products/servlet/>."
352 echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
353 echo " | is supported (_EXACTLY_ 2.0)."
356 echo "Please send comments/suggestions regarding"
357 echo "this RPM to <zeller@to.com>."
361 # do not remove the configured stuff if we upgrade.
362 # the $1 argument contains the number of packages _after_ installation.
363 if [ ! $1 -eq 0 ] ; then
367 # Remove 'jserv' service (manual mode)
368 #/etc/rc.d/init.d/jserv stop
369 #/sbin/chkconfig --del jserv
372 # Find jserv related configuration settings and comment
375 cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
376 sed 's|.*\(Include.*%{jservconf}/jserv.conf\)|#\1|g' \
377 < %{httpdconf}/httpd.conf.rpmorig \
378 | sed 's|^\(AddModule.*mod_jserv.c\)|#\1|g' \
379 | sed 's|^\(LoadModule.*mod_jserv.so\)|#\1|g' \
380 > %{httpdconf}/httpd.conf
382 /bin/rm -fr %{logdir}/mod_jserv.log
383 /bin/rm -fr %{logdir}/jserv.log
386 %defattr(-,root,root)
387 # mmh, we can't give %{prefix}/docs to %doc ..
388 %doc index.html README docs jsdk-doc
391 %config %{jservconf}/jserv.properties
392 %config %{jservconf}/zone.properties
393 %config %{jservconf}/jserv.conf
395 # these are just for demonstration and thus,
396 # no %config-files per-se; do not install
397 # them for the RPM-packet
398 #%{jservconf}/jserv.properties.default
399 #%{jservconf}/zone.properties.default
400 #%{jservconf}/jserv.conf.default
402 %attr(-,nobody,nobody) %{jservconf}/jserv.secret.key
403 #%config /etc/rc.d/init.d/jserv
404 #%config /etc/logrotate.d/jserv
405 #%config /etc/profile.d/jserv.sh
407 %{libexecdir}/mod_jserv.so
408 %{libexecdir}/ApacheJServ.jar
411 %{classesdir}/servlet-2.0.jar
414 %{servletdir}/IsItWorking.java
415 %{servletdir}/IsItWorking.class
417 # we need to have write access here
418 %attr(-,nobody,-) %dir %{logdir}
421 * Sun Feb 13 2000 Peter Hanecak <hanecak@megaloman.sk>
422 - used 'APXS_CFLAGS=`$APXS_UTIL -q CFLAGS`' and
423 'CFLAGS="$APXS_CFLAGS $RPM_OPT_FLAGS"' to determine build flags
426 * Tue Feb 8 2000 Peter Hanecak <hanecak@megaloman.sk>
427 - RPM_OPT_FLAGS passed to CFLAGS
428 - build root changed from '/tmp/...' to '/var/tmp/...'
429 - install process fixed for 'docs/api'
431 * Tue Dec 28 1999 HZ <zeller@to.com>
432 - use BuildRequires to reflect the need for current
433 versions of the autoconf/automake suite and a
434 recent apache-devel because of a bug in older
435 versions of this package.
437 * Thu Sep 30 1999 HZ <zeller@to.com>
438 - Release of 1.1 Beta 1
440 * Wed Sep 29 1999 Henner Zeller <zeller@to.com>
441 - new build scheme (1.1)
443 * Sun Sep 19 1999 Henner Zeller <zeller@to.com>
444 - make it work with the apache-1.3.9 RPM
445 - use 'test' instead of '[ ]' in conditionals
446 - look for java virtual machine and edit jserv.properties' wrapper.bin
448 * Fri Sep 17 1999 Henner Zeller <zeller@to.com>
449 - added LGPL'ed servlet DK by Paul Siegmann
451 * Wed Aug 18 1999 Henner Zeller <zeller@to.com>
452 - edit httpd.conf automatically
454 * Sat Jul 24 1999 Henner Zeller <zeller@to.com>
455 - update to install JServ 1.0.*
457 * Thu Nov 05 1998 Ross Golder <rossigee@bigfoot.com>
458 - updated to use the autoconf build system
460 * Mon Oct 19 1998 Ross Golder <rossg@cpd.co.uk>
461 - created from previous work to deploy daily snapshot RPMs