1 #%define libexecdir `apxs -q LIBEXECDIR`
2 %define libexecdir /usr/lib/apache
4 #%define httpdconf `apxs -q SYSCONFDIR`
5 %define httpdconf /etc/httpd/conf
7 %define jservconf %{httpdconf}/jserv
8 %define logdir /var/log/httpd
9 %define servletdir /home/httpd/servlets
10 %define classesdir /home/httpd/classes
11 %define jsdkversion 19991120
13 Summary: Servlet engine with support for the leading web server
17 Source0: http://java.apache.org/jserv/dist/%{name}-%{version}.tar.gz
18 Source1: http://www.euronet.nl/~pauls/java/servlet/download/%{version}%{name}classpathx_servlet-%{jsdkversion}.tar.gz
19 Patch0: ApacheJServ-enable-secret.patch
20 Patch1: ApacheJServ-DESTDIR.patch
21 URL: http://java.apache.org/
22 Copyright: Freely distributable & usable
23 Group: Networking/Daemons
24 Group(pl): Sieciowe/Serwery
26 Requires: apache >= 1.3.6
27 Provides: jserv jsdk20
28 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30 #BuildRequires: any-java-compiler
32 BuildRequires: automake >= 1.4
33 BuildRequires: autoconf >= 2.13
34 BuildRequires: libtool >= 1.3.3
35 BuildRequires: apache-devel >= 1.3.9-8
38 Apache JServ is a servlet engine, developed by the Java Apache Project
39 <http://java.apache.org/>. The Apache JServ servlet engine is written in
40 100pc Java application, and listens for servlet requests using the Apache
41 Java protocol (AJp). Typically, these requests will originate from the
42 mod_jserv Apache module (DSO included). This package contains a LGPL'ed
43 implementation of sun's java servlet api version 2.0 by Paul Siegmann
44 <http://www.euronet.nl/~pauls/java/servlet/>
47 rm -rf $RPM_BUILD_ROOT
53 # final position of GNU JSDK-Classes
54 sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
55 < conf/jserv.properties.in > conf/jserv.properties.in.new
56 mv conf/jserv.properties.in.new conf/jserv.properties.in
58 # do not load module in provided jserv.conf; we do this in httpd.conf
59 sed 's|@LOAD_OR_NOT@|#|g' \
60 < conf/jserv.conf.in > conf/jserv.conf.in.new
61 mv conf/jserv.conf.in.new conf/jserv.conf.in
69 make -C classpathx_servlet-%{jsdkversion} jar_2_0
70 make -C classpathx_servlet-%{jsdkversion}/apidoc
74 cp classpathx_servlet-%{jsdkversion}/README \
75 classpathx_servlet-%{jsdkversion}/AUTHORS \
76 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
78 cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
82 # find apxs utility ..
84 APXS_UTIL=`type -p apxs || true`
87 if test "x$APXS_UTIL" = x ; then
88 # mmh, is it possible to query just for
89 # the executeables (like -qd and -qc) ?
90 APXSMATCH=`rpm -ql apache-devel apache | grep apxs`
91 for f in $APXSMATCH ; do
92 if test -x "$f" ; then
100 if test "x$APXS_UTIL" = x ; then
104 %{_prefix}/local/apache/bin \
105 %{_prefix}/local/apache/sbin \
106 %{_prefix}/local/httpd/bin \
107 %{_prefix}/local/httpd/sbin
109 if test -x "$loc/apxs" ; then
110 APXS_UTIL="$loc/apxs"
116 if test "x$APXS_UTIL" = x ; then
117 echo "Didn't find apxs .. exiting"
121 APXS_CFLAGS=`$APXS_UTIL -q CFLAGS`
122 CFLAGS="$APXS_CFLAGS $RPM_OPT_FLAGS" ./configure \
123 --prefix=%{_prefix} \
124 --disable-debugging \
125 --with-apxs=$APXS_UTIL \
126 --with-logdir=%{logdir} \
127 --with-servlets=%{servletdir} \
128 --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar
132 rm -rf $RPM_BUILD_ROOT
134 make DESTDIR=$RPM_BUILD_ROOT install
136 echo "default - change on install `date`" > $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
137 chmod 600 $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
140 #install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
141 #install -d $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
142 #install -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
143 #install -m755 src/scripts/package/rpm/jserv.init $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/jserv
144 #install -m755 src/scripts/package/rpm/jserv.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
145 #install -m644 src/scripts/package/rpm/jserv.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/jserv
148 install -d ${RPM_BUILD_ROOT}%{classesdir}
149 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ${RPM_BUILD_ROOT}%{classesdir}
152 rm -rf $RPM_BUILD_ROOT
156 # use fortune + install-date + process-list to create pseudo-random, hardly
157 # guessable secret key. Use md5sum to create a hash from this, if available:
158 (%{_prefix}/games/fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
159 | (md5sum 2>/dev/null || cat) \
160 > %{jservconf}/jserv.secret.key
161 chmod 600 %{jservconf}/jserv.secret.key
164 # determine apache-USER and chown the jserv.secrect.key - file
166 APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
167 if test ! "x$APACHEUSER" = x ; then
168 USERCOMMENT="(which is '$APACHEUSER' ?)"
173 chown $APACHEUSER %{jservconf}/jserv.secret.key
176 # determine apache-GROUP and allow this group to write to %{logdir}
177 APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
178 if test "x$APACHEGROUP" = x ; then
181 chgrp $APACHEGROUP %{logdir}
185 # Add 'jserv' as an independent service (manual mode)
186 #/sbin/chkconfig --add jserv
187 #/etc/rc.d/init.d/jserv start
190 # Find Include Statement or add it if necessary
192 cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
193 grep '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf \
195 if test $? -eq 0 ; then
196 # found. Insert our include statement here
197 ## this depends on GNU-sed ('|') .. but we're on a RedHat system anyway
198 sed 's|^#\?\(.*Include\).*/jserv.conf.*$|\1 %{jservconf}/jserv.conf|g' \
199 < %{httpdconf}/httpd.conf.rpmorig \
200 > %{httpdconf}/httpd.conf
204 echo "<IfModule mod_jserv.c>"
205 echo " Include %{jservconf}/jserv.conf"
207 ) >> %{httpdconf}/httpd.conf
211 # LoadModule; uncomment or insert
213 grep '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf \
215 if test $? -eq 0 ; then
216 # found. Remove any comment
217 sed 's|^#.*\(LoadModule.*mod_jserv.so\)|\1|g' \
218 < %{httpdconf}/httpd.conf \
219 > %{httpdconf}/httpd.conf.loadMod
220 mv %{httpdconf}/httpd.conf.loadMod %{httpdconf}/httpd.conf
222 # Insert LoadModule line before first valid LoadModule
223 ( echo "/^LoadModule"
225 echo "LoadModule jserv_module modules/mod_jserv.so"
228 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
232 # AddModule; uncomment or insert
234 grep '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf >/dev/null
235 if test $? -eq 0 ; then
236 # found. Remove any comment
237 sed 's|^#.*\(AddModule.*mod_jserv.c\)|\1|g' \
238 < %{httpdconf}/httpd.conf \
239 > %{httpdconf}/httpd.conf.addMod
240 mv %{httpdconf}/httpd.conf.addMod %{httpdconf}/httpd.conf
244 echo "AddModule mod_jserv.c"
247 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
251 # Search vor JAVA at possible locations and edit wrapper.bin
254 for lookfor in java jre ; do
260 /usr/local/jdk117_v3 \
261 /usr/local/jdk117_v1a
263 if test -x "$loc/bin/$lookfor" ; then
264 JAVABIN="$loc/bin/$lookfor"
269 if test -z "$JAVABIN" ; then
270 for prefix in /usr/jdk /usr/jdk- /usr/local/jdk /usr/local/jdk- ; do
271 for jplatform in 2 1 ; do
272 for subvers in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
273 if test -x "${prefix}1.$jplatform$subvers/bin/$lookfor" ; then
274 JAVABIN="${prefix}1.$jplatform$subvers/bin/$lookfor"
278 if test ! -z "$JAVABIN" ; then break ; fi
280 if test ! -z "$JAVABIN" ; then break ; fi
283 if test ! -z "$JAVABIN" ; then break ; fi
286 if test ! -z "$JAVABIN" ; then
287 sed "s|^wrapper.bin=.*$|wrapper.bin=$JAVABIN|" \
288 < %{jservconf}/jserv.properties \
289 > %{jservconf}/jserv.properties.new
290 mv %{jservconf}/jserv.properties.new %{jservconf}/jserv.properties
294 # Get Server Port to echo right URL below
296 SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
297 head -1 | awk '{print ":" $2}'`
298 if test "$SERVERPORT" = ":80" ; then
302 #FIXME: make this i18n-aware
304 if test ! "x$JAVABIN" = x ; then
305 echo "using java VM $JAVABIN"
307 echo "## didn't find java or jre. Please install it and edit the"
308 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
311 echo "In order to enable JServ, restart the webserver and try"
312 echo " http://localhost$SERVERPORT/servlets/IsItWorking"
314 echo " http://localhost$SERVERPORT/jserv/"
318 ## we hopefully may distribute SUN-jsdk.jar with jserv once ..
319 echo " | NOTE that this distribution contains a fully functional"
320 echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
321 echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
322 echo " | in the wrapper.classpath - line in the file"
323 echo " | %{jservconf}/jserv.properties"
324 echo " | with the SUN jsdk."
325 echo " | Get it from <http://java.sun.com/products/servlet/>."
326 echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
327 echo " | is supported (_EXACTLY_ 2.0)."
330 echo "Please send comments/suggestions regarding"
331 echo "this RPM to <zeller@to.com>."
334 # do not remove the configured stuff if we upgrade.
335 # the $1 argument contains the number of packages _after_ installation.
336 if [ ! $1 -eq 0 ] ; then
340 # Remove 'jserv' service (manual mode)
341 #/etc/rc.d/init.d/jserv stop
342 #/sbin/chkconfig --del jserv
345 # Find jserv related configuration settings and comment
348 cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
349 sed 's|.*\(Include.*%{jservconf}/jserv.conf\)|#\1|g' \
350 < %{httpdconf}/httpd.conf.rpmorig \
351 | sed 's|^\(AddModule.*mod_jserv.c\)|#\1|g' \
352 | sed 's|^\(LoadModule.*mod_jserv.so\)|#\1|g' \
353 > %{httpdconf}/httpd.conf
355 /bin/rm -fr %{logdir}/mod_jserv.log
356 /bin/rm -fr %{logdir}/jserv.log
359 %defattr(644,root,root,755)
360 # mmh, we can't give %{_prefix}/docs to %doc ..
361 %doc index.html README docs jsdk-doc
364 %config %{jservconf}/jserv.properties
365 %config %{jservconf}/zone.properties
366 %config %{jservconf}/jserv.conf
368 # these are just for demonstration and thus,
369 # no %config-files per-se; do not install
370 # them for the RPM-packet
371 #%{jservconf}/jserv.properties.default
372 #%{jservconf}/zone.properties.default
373 #%{jservconf}/jserv.conf.default
375 %attr(-,nobody,nobody) %{jservconf}/jserv.secret.key
376 #%config %{_sysconfdir}/rc.d/init.d/jserv
377 #%config %{_sysconfdir}/logrotate.d/jserv
378 #%config %{_sysconfdir}/profile.d/jserv.sh
380 %{libexecdir}/mod_jserv.so
381 %{libexecdir}/ApacheJServ.jar
384 %{classesdir}/servlet-2.0.jar
387 %{servletdir}/IsItWorking.java
388 %{servletdir}/IsItWorking.class
390 # we need to have write access here
391 %attr(-,nobody,-) %dir %{logdir}