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 20000924
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/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
25 Requires: apache >= 1.3.6
26 Provides: jserv jsdk20
27 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29 #BuildRequires: any-java-compiler
31 BuildRequires: automake >= 1.4
32 BuildRequires: autoconf >= 2.13
33 BuildRequires: libtool >= 1.3.3
34 BuildRequires: apache-devel >= 1.3.9-8
37 Apache JServ is a servlet engine, developed by the Java Apache Project
38 <http://java.apache.org/>. The Apache JServ servlet engine is written
39 in 100pc Java application, and listens for servlet requests using the
40 Apache Java protocol (AJp). Typically, these requests will originate
41 from the mod_jserv Apache module (DSO included). This package contains
42 a LGPL'ed implementation of sun's java servlet api version 2.0 by Paul
43 Siegmann <http://www.euronet.nl/~pauls/java/servlet/>
46 Apache JServ jest silnikiem serwletowym, rozwijanym przez Java Apache Project
47 <http://java.apache.org/>. Silnik serwletowy Apache JServ zosta³ napisany
48 od pocz±tku do koñca w Javie; nas³uchuje wywo³añ serwletu wykorzystuj±c
49 protokó³ Apache Java (AJp). Zazwyczaj wywo³ania te pochodz± z modu³u
50 Apache mod_jservmodule (³±cznie z DSO). Pakiet ten zawiera sunowsk±
51 implementacjê api serletów w javie w wersji 2.0 (na licencji LGPL)
52 napisana przez Paula Siegmanna <http://www.euronet.nl/~pauls/java/servlet/>
60 # final position of GNU JSDK-Classes
61 sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
62 < conf/jserv.properties.in > conf/jserv.properties.in.new
63 mv conf/jserv.properties.in.new conf/jserv.properties.in
65 # do not load module in provided jserv.conf; we do this in httpd.conf
66 sed 's|@LOAD_OR_NOT@|#|g' \
67 < conf/jserv.conf.in > conf/jserv.conf.in.new
68 mv conf/jserv.conf.in.new conf/jserv.conf.in
76 %{__make} -C classpathx_servlet-%{jsdkversion} jar_2_0
77 %{__make} -C classpathx_servlet-%{jsdkversion}/apidoc
81 cp classpathx_servlet-%{jsdkversion}/README \
82 classpathx_servlet-%{jsdkversion}/AUTHORS \
83 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
85 cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
89 APXS_CFLAGS=`$APXS_UTIL -q CFLAGS`
90 CFLAGS="$APXS_CFLAGS $RPM_OPT_FLAGS" ./configure \
93 --with-apxs=/usr/bin/apxs \
94 --with-logdir=%{logdir} \
95 --with-servlets=%{servletdir} \
96 --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar
100 rm -rf $RPM_BUILD_ROOT
102 %{__make} DESTDIR=$RPM_BUILD_ROOT install
104 echo "default - change on install `date`" > $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
105 chmod 600 $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
108 #install -d $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
109 #install -d $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
110 #install -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
111 #install -m755 src/scripts/package/rpm/jserv.init $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/jserv
112 #install -m755 src/scripts/package/rpm/jserv.sh $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
113 #install -m644 src/scripts/package/rpm/jserv.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/jserv
116 install -d ${RPM_BUILD_ROOT}%{classesdir}
117 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ${RPM_BUILD_ROOT}%{classesdir}
120 rm -rf $RPM_BUILD_ROOT
124 # use fortune + install-date + process-list to create pseudo-random, hardly
125 # guessable secret key. Use md5sum to create a hash from this, if available:
126 (%{_prefix}/games/fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
127 | (md5sum 2>/dev/null || cat) \
128 > %{jservconf}/jserv.secret.key
129 chmod 600 %{jservconf}/jserv.secret.key
132 # determine apache-USER and chown the jserv.secrect.key - file
134 APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
135 if test ! "x$APACHEUSER" = x ; then
136 USERCOMMENT="(which is '$APACHEUSER' ?)"
141 chown $APACHEUSER %{jservconf}/jserv.secret.key
144 # determine apache-GROUP and allow this group to write to %{logdir}
145 APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
146 if test "x$APACHEGROUP" = x ; then
149 chgrp $APACHEGROUP %{logdir}
153 # Add 'jserv' as an independent service (manual mode)
154 #/sbin/chkconfig --add jserv
155 #/etc/rc.d/init.d/jserv start
158 # Find Include Statement or add it if necessary
160 cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
161 grep '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf \
163 if test $? -eq 0 ; then
164 # found. Insert our include statement here
165 ## this depends on GNU-sed ('|') .. but we're on a RedHat system anyway
166 sed 's|^#\?\(.*Include\).*/jserv.conf.*$|\1 %{jservconf}/jserv.conf|g' \
167 < %{httpdconf}/httpd.conf.rpmorig \
168 > %{httpdconf}/httpd.conf
172 echo "<IfModule mod_jserv.c>"
173 echo " Include %{jservconf}/jserv.conf"
175 ) >> %{httpdconf}/httpd.conf
179 # LoadModule; uncomment or insert
181 grep '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf \
183 if test $? -eq 0 ; then
184 # found. Remove any comment
185 sed 's|^#.*\(LoadModule.*mod_jserv.so\)|\1|g' \
186 < %{httpdconf}/httpd.conf \
187 > %{httpdconf}/httpd.conf.loadMod
188 mv %{httpdconf}/httpd.conf.loadMod %{httpdconf}/httpd.conf
190 # Insert LoadModule line before first valid LoadModule
191 ( echo "/^LoadModule"
193 echo "LoadModule jserv_module modules/mod_jserv.so"
196 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
200 # AddModule; uncomment or insert
202 grep '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf >/dev/null
203 if test $? -eq 0 ; then
204 # found. Remove any comment
205 sed 's|^#.*\(AddModule.*mod_jserv.c\)|\1|g' \
206 < %{httpdconf}/httpd.conf \
207 > %{httpdconf}/httpd.conf.addMod
208 mv %{httpdconf}/httpd.conf.addMod %{httpdconf}/httpd.conf
212 echo "AddModule mod_jserv.c"
215 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
219 # Search vor JAVA at possible locations and edit wrapper.bin
222 for lookfor in java jre ; do
228 /usr/local/jdk117_v3 \
229 /usr/local/jdk117_v1a
231 if test -x "$loc/bin/$lookfor" ; then
232 JAVABIN="$loc/bin/$lookfor"
237 if test -z "$JAVABIN" ; then
238 for prefix in /usr/jdk /usr/jdk- /usr/local/jdk /usr/local/jdk- ; do
239 for jplatform in 2 1 ; do
240 for subvers in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
241 if test -x "${prefix}1.$jplatform$subvers/bin/$lookfor" ; then
242 JAVABIN="${prefix}1.$jplatform$subvers/bin/$lookfor"
246 if test ! -z "$JAVABIN" ; then break ; fi
248 if test ! -z "$JAVABIN" ; then break ; fi
251 if test ! -z "$JAVABIN" ; then break ; fi
254 if test ! -z "$JAVABIN" ; then
255 sed "s|^wrapper.bin=.*$|wrapper.bin=$JAVABIN|" \
256 < %{jservconf}/jserv.properties \
257 > %{jservconf}/jserv.properties.new
258 mv %{jservconf}/jserv.properties.new %{jservconf}/jserv.properties
262 # Get Server Port to echo right URL below
264 SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
265 head -1 | awk '{print ":" $2}'`
266 if test "$SERVERPORT" = ":80" ; then
270 #FIXME: make this i18n-aware
272 if test ! "x$JAVABIN" = x ; then
273 echo "using java VM $JAVABIN"
275 echo "## didn't find java or jre. Please install it and edit the"
276 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
279 echo "In order to enable JServ, restart the webserver and try"
280 echo " http://localhost$SERVERPORT/servlets/IsItWorking"
282 echo " http://localhost$SERVERPORT/jserv/"
286 ## we hopefully may distribute SUN-jsdk.jar with jserv once ..
287 echo " | NOTE that this distribution contains a fully functional"
288 echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
289 echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
290 echo " | in the wrapper.classpath - line in the file"
291 echo " | %{jservconf}/jserv.properties"
292 echo " | with the SUN jsdk."
293 echo " | Get it from <http://java.sun.com/products/servlet/>."
294 echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
295 echo " | is supported (_EXACTLY_ 2.0)."
298 echo "Please send comments/suggestions regarding"
299 echo "this RPM to <zeller@to.com>."
302 # do not remove the configured stuff if we upgrade.
303 # the $1 argument contains the number of packages _after_ installation.
304 if [ ! $1 -eq 0 ] ; then
308 # Remove 'jserv' service (manual mode)
309 #/etc/rc.d/init.d/jserv stop
310 #/sbin/chkconfig --del jserv
313 # Find jserv related configuration settings and comment
316 cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
317 sed 's|.*\(Include.*%{jservconf}/jserv.conf\)|#\1|g' \
318 < %{httpdconf}/httpd.conf.rpmorig \
319 | sed 's|^\(AddModule.*mod_jserv.c\)|#\1|g' \
320 | sed 's|^\(LoadModule.*mod_jserv.so\)|#\1|g' \
321 > %{httpdconf}/httpd.conf
323 /bin/rm -fr %{logdir}/mod_jserv.log
324 /bin/rm -fr %{logdir}/jserv.log
327 %defattr(644,root,root,755)
328 # mmh, we can't give %{_prefix}/docs to %doc ..
329 %doc index.html README docs jsdk-doc
332 %config %{jservconf}/jserv.properties
333 %config %{jservconf}/zone.properties
334 %config %{jservconf}/jserv.conf
336 # these are just for demonstration and thus,
337 # no %config-files per-se; do not install
338 # them for the RPM-packet
339 #%{jservconf}/jserv.properties.default
340 #%{jservconf}/zone.properties.default
341 #%{jservconf}/jserv.conf.default
343 %attr(-,nobody,nobody) %{jservconf}/jserv.secret.key
344 #%config %{_sysconfdir}/rc.d/init.d/jserv
345 #%config %{_sysconfdir}/logrotate.d/jserv
346 #%config %{_sysconfdir}/profile.d/jserv.sh
348 %{libexecdir}/mod_jserv.so
349 %{libexecdir}/ApacheJServ.jar
352 %{classesdir}/servlet-2.0.jar
355 %{servletdir}/IsItWorking.java
356 %{servletdir}/IsItWorking.class
358 # we need to have write access here
359 %attr(-,nobody,-) %dir %{logdir}