]> git.pld-linux.org Git - packages/ApacheJServ.git/blame - ApacheJServ.spec
- DESTDIR patch.
[packages/ApacheJServ.git] / ApacheJServ.spec
CommitLineData
0464d88f 1%define myprefix /usr
2
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
7##
8
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 ?)
12
13#%define libexecdir `apxs -q LIBEXECDIR`
14%define libexecdir /usr/lib/apache
15
16#%define httpdconf `apxs -q SYSCONFDIR`
17%define httpdconf /etc/httpd/conf
18
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
24
25Source: %{name}-%{version}.tar.gz
26Source1: http://www.euronet.nl/~pauls/java/servlet/download/classpathx_servlet-%{jsdkversion}.tar.gz
27Patch0: jserv-enable-secret.patch
28Patch1: ApacheJServ-1.1-megaloman.patch
29
30Summary: Servlet engine with support for the leading web server
31Name: ApacheJServ
32Version: 1.1
33Release: 3
34URL: http://java.apache.org/
35Copyright: Freely distributable & usable
36Group: Networking/Daemons
37Packager: Henner Zeller <zeller@to.com>
38Docdir: %{myprefix}/doc
39Requires: apache >= 1.3.6
40Provides: jserv jsdk20
41BuildRoot: /var/tmp/%{name}-%{version}-root
42Prefix: %{myprefix}
43
44#BuildRequires: any-java-compiler
45
46BuildRequires: automake >= 1.4
47BuildRequires: autoconf >= 2.13
48BuildRequires: libtool >= 1.3.3
49
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
56## -8 works)
57BuildRequires: apache-devel >= 1.3.9-8
58
59%description
60Apache JServ is a servlet engine, developed by the
61Java Apache Project <http://java.apache.org/>.
62
63The Apache JServ servlet engine is written in 100pc Java application, and
64listens for servlet requests using the Apache Java protocol (AJp). Typically,
65these requests will originate from the mod_jserv Apache module (DSO included).
66
67This package contains a LGPL'ed implementation of sun's java servlet api
68version 2.0 by Paul Siegmann <http://www.euronet.nl/~pauls/java/servlet/>
69
70%prep
71rm -rf $RPM_BUILD_ROOT
72%setup -a 1 -n %{name}-%{version}
73
74# enable socket authentification
75%patch0
76%patch1 -p1
77
78# final position of GNU JSDK-Classes
79sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
80 < conf/jserv.properties.in > conf/jserv.properties.in.new
81mv conf/jserv.properties.in.new conf/jserv.properties.in
82
83# do not load module in provided jserv.conf; we do this in httpd.conf
84sed 's|@LOAD_OR_NOT@|#|g' \
85 < conf/jserv.conf.in > conf/jserv.conf.in.new
86mv conf/jserv.conf.in.new conf/jserv.conf.in
87
88# prepare compilation
89aclocal
90autoconf
91automake
92
93%build
94
95### jsdk API
96make -C classpathx_servlet-%{jsdkversion} jar_2_0
97make -C classpathx_servlet-%{jsdkversion}/apidoc
98
99# copy API-doc
100mkdir jsdk-doc
101cp classpathx_servlet-%{jsdkversion}/README \
102 classpathx_servlet-%{jsdkversion}/AUTHORS \
103 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
104 jsdk-doc
105cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
106
107
108### JSERV
109
110# find apxs utility ..
111# .. in PATH
112APXS_UTIL=`type -p apxs || true`
113
114# .. from RPM
115if 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
121 APXS_UTIL=$f
122 break
123 fi
124 done
125fi
126
127# .. at usual places
128if test "x$APXS_UTIL" = x ; then
129 for loc in \
130 /usr/bin \
131 /usr/sbin \
132 /usr/local/apache/bin \
133 /usr/local/apache/sbin \
134 /usr/local/httpd/bin \
135 /usr/local/httpd/sbin
136 do
137 if test -x "$loc/apxs" ; then
138 APXS_UTIL="$loc/apxs"
139 break
140 fi
141 done
142fi
143
144if test "x$APXS_UTIL" = x ; then
145 echo "Didn't find apxs .. exiting"
146 exit -1
147fi
148
149APXS_CFLAGS=`$APXS_UTIL -q CFLAGS`
150CFLAGS="$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
157make
158
159%install
160make DESTDIR=$RPM_BUILD_ROOT install
161
162echo "default - change on install `date`" > $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
163chmod 600 $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
164
165# currently disabled
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
172
173### GNU JSDK-classes
174install -d ${RPM_BUILD_ROOT}%{classesdir}
175install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ${RPM_BUILD_ROOT}%{classesdir}
176
177%clean
178rm -rf $RPM_BUILD_ROOT
179
180%post
181
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
187chmod 600 %{jservconf}/jserv.secret.key
188
189#
190# determine apache-USER and chown the jserv.secrect.key - file
191#
192APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
193if test ! "x$APACHEUSER" = x ; then
194 USERCOMMENT="(which is '$APACHEUSER' ?)"
195else
196 # assumption:
197 APACHEUSER=nobody
198fi
199chown $APACHEUSER %{jservconf}/jserv.secret.key
200
201#
202# determine apache-GROUP and allow this group to write to %{logdir}
203APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
204if test "x$APACHEGROUP" = x ; then
205 APACHEGROUP=nobody
206fi
207chgrp $APACHEGROUP %{logdir}
208chmod g+w %{logdir}
209
210#
211# Add 'jserv' as an independent service (manual mode)
212#/sbin/chkconfig --add jserv
213#/etc/rc.d/init.d/jserv start
214
215#
216# Find Include Statement or add it if necessary
217#
218cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
219grep '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf \
220 >/dev/null
221if 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
227else
228 # append it
229 (
230 echo "<IfModule mod_jserv.c>"
231 echo " Include %{jservconf}/jserv.conf"
232 echo "</IfModule>"
233 ) >> %{httpdconf}/httpd.conf
234fi
235
236#
237# LoadModule; uncomment or insert
238#
239grep '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf \
240 >/dev/null
241if 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
247else
248 # Insert LoadModule line before first valid LoadModule
249 ( echo "/^LoadModule"
250 echo "i"
251 echo "LoadModule jserv_module modules/mod_jserv.so"
252 echo "."
253 echo "wq"
254 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
255fi
256
257#
258# AddModule; uncomment or insert
259#
260grep '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf >/dev/null
261if 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
267else
268 ( echo "/^AddModule"
269 echo "i"
270 echo "AddModule mod_jserv.c"
271 echo "."
272 echo "wq"
273 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
274fi
275
276#
277# Search vor JAVA at possible locations and edit wrapper.bin
278#
279unset JAVABIN
280for lookfor in java jre ; do
281 for loc in \
282 $JAVA_HOME \
283 $JDK_HOME \
284 /usr/local/java \
285 /usr/local/jdk \
286 /usr/local/jdk117_v3 \
287 /usr/local/jdk117_v1a
288 do
289 if test -x "$loc/bin/$lookfor" ; then
290 JAVABIN="$loc/bin/$lookfor"
291 break
292 fi
293 done
294
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"
301 break
302 fi
303 done
304 if test ! -z "$JAVABIN" ; then break ; fi
305 done
306 if test ! -z "$JAVABIN" ; then break ; fi
307 done
308 fi
309 if test ! -z "$JAVABIN" ; then break ; fi
310done
311
312if 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
317fi
318
319#
320# Get Server Port to echo right URL below
321#
322SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
323 head -1 | awk '{print ":" $2}'`
324if test "$SERVERPORT" = ":80" ; then
325 SERVERPORT=""
326fi
327
328#FIXME: make this i18n-aware
329
330if test ! "x$JAVABIN" = x ; then
331 echo "using java VM $JAVABIN"
332else
333 echo "## didn't find java or jre. Please install it and edit the"
334 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
335fi
336echo ""
337echo "In order to enable JServ, restart the webserver and try"
338echo " http://localhost$SERVERPORT/servlets/IsItWorking"
339echo " and"
340echo " http://localhost$SERVERPORT/jserv/"
341echo "-- ENJOY! --"
342echo ""
343
344## we hopefully may distribute SUN-jsdk.jar with jserv once ..
345echo " | NOTE that this distribution contains a fully functional"
346echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
347echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
348echo " | in the wrapper.classpath - line in the file"
349echo " | %{jservconf}/jserv.properties"
350echo " | with the SUN jsdk."
351echo " | Get it from <http://java.sun.com/products/servlet/>."
352echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
353echo " | is supported (_EXACTLY_ 2.0)."
354echo ""
355
356echo "Please send comments/suggestions regarding"
357echo "this RPM to <zeller@to.com>."
358
359
360%preun
361# do not remove the configured stuff if we upgrade.
362# the $1 argument contains the number of packages _after_ installation.
363if [ ! $1 -eq 0 ] ; then
364 exit 0
365fi
366
367# Remove 'jserv' service (manual mode)
368#/etc/rc.d/init.d/jserv stop
369#/sbin/chkconfig --del jserv
370
371#
372# Find jserv related configuration settings and comment
373# them out
374#
375cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
376sed '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
381# remove old logs
382/bin/rm -fr %{logdir}/mod_jserv.log
383/bin/rm -fr %{logdir}/jserv.log
384
385%files
386%defattr(-,root,root)
387# mmh, we can't give %{prefix}/docs to %doc ..
388%doc index.html README docs jsdk-doc
389
390%dir %{jservconf}
391%config %{jservconf}/jserv.properties
392%config %{jservconf}/zone.properties
393%config %{jservconf}/jserv.conf
394
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
401
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
406
407%{libexecdir}/mod_jserv.so
408%{libexecdir}/ApacheJServ.jar
409
410%dir %{classesdir}
411%{classesdir}/servlet-2.0.jar
412
413%dir %{servletdir}
414%{servletdir}/IsItWorking.java
415%{servletdir}/IsItWorking.class
416
417# we need to have write access here
418%attr(-,nobody,-) %dir %{logdir}
419
420%changelog
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
424 (because of EAPI)
425
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'
430
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.
436
437* Thu Sep 30 1999 HZ <zeller@to.com>
438 - Release of 1.1 Beta 1
439
440* Wed Sep 29 1999 Henner Zeller <zeller@to.com>
441 - new build scheme (1.1)
442
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
447
448* Fri Sep 17 1999 Henner Zeller <zeller@to.com>
449 - added LGPL'ed servlet DK by Paul Siegmann
450
451* Wed Aug 18 1999 Henner Zeller <zeller@to.com>
452 - edit httpd.conf automatically
453
454* Sat Jul 24 1999 Henner Zeller <zeller@to.com>
455 - update to install JServ 1.0.*
456
457* Thu Nov 05 1998 Ross Golder <rossigee@bigfoot.com>
458- updated to use the autoconf build system
459
460* Mon Oct 19 1998 Ross Golder <rossg@cpd.co.uk>
461- created from previous work to deploy daily snapshot RPMs
This page took 0.098204 seconds and 4 git commands to generate.