]> git.pld-linux.org Git - packages/ApacheJServ.git/blame - ApacheJServ.spec
- changed all BuildRoot definitons
[packages/ApacheJServ.git] / ApacheJServ.spec
CommitLineData
0464d88f 1#%define libexecdir `apxs -q LIBEXECDIR`
2%define libexecdir /usr/lib/apache
3
4#%define httpdconf `apxs -q SYSCONFDIR`
5%define httpdconf /etc/httpd/conf
6
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
12
0464d88f 13Summary: Servlet engine with support for the leading web server
14Name: ApacheJServ
15Version: 1.1
16Release: 3
20a63901 17Source0: http://java.apache.org/jserv/dist/%{name}-%{version}.tar.gz
18Source1: http://www.euronet.nl/~pauls/java/servlet/download/%{version}%{name}classpathx_servlet-%{jsdkversion}.tar.gz
19Patch0: ApacheJServ-enable-secret.patch
20Patch1: ApacheJServ-DESTDIR.patch
0464d88f 21URL: http://java.apache.org/
22Copyright: Freely distributable & usable
23Group: Networking/Daemons
20a63901 24Group(pl): Sieciowe/Serwery
25Docdir: %{prefix}/doc
0464d88f 26Requires: apache >= 1.3.6
27Provides: jserv jsdk20
450b5f3c 28BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
0464d88f 29
20a63901 30#BuildRequires: any-java-compiler
0464d88f 31
32BuildRequires: automake >= 1.4
33BuildRequires: autoconf >= 2.13
34BuildRequires: libtool >= 1.3.3
0464d88f 35BuildRequires: apache-devel >= 1.3.9-8
36
37%description
20a63901 38Apache JServ is a servlet engine, developed by the Java Apache Project
39<http://java.apache.org/>. The Apache JServ servlet engine is written in
40100pc Java application, and listens for servlet requests using the Apache
41Java protocol (AJp). Typically, these requests will originate from the
42mod_jserv Apache module (DSO included). This package contains a LGPL'ed
43implementation of sun's java servlet api version 2.0 by Paul Siegmann
44<http://www.euronet.nl/~pauls/java/servlet/>
0464d88f 45
46%prep
47rm -rf $RPM_BUILD_ROOT
20a63901 48%setup -q -a 1
0464d88f 49
0464d88f 50%patch0
51%patch1 -p1
52
53# final position of GNU JSDK-Classes
54sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
55 < conf/jserv.properties.in > conf/jserv.properties.in.new
56mv conf/jserv.properties.in.new conf/jserv.properties.in
57
58# do not load module in provided jserv.conf; we do this in httpd.conf
59sed 's|@LOAD_OR_NOT@|#|g' \
60 < conf/jserv.conf.in > conf/jserv.conf.in.new
61mv conf/jserv.conf.in.new conf/jserv.conf.in
62
63# prepare compilation
64aclocal
65autoconf
66automake
67
68%build
0464d88f 69make -C classpathx_servlet-%{jsdkversion} jar_2_0
70make -C classpathx_servlet-%{jsdkversion}/apidoc
71
72# copy API-doc
73mkdir jsdk-doc
74cp classpathx_servlet-%{jsdkversion}/README \
75 classpathx_servlet-%{jsdkversion}/AUTHORS \
76 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
77 jsdk-doc
78cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
79
0464d88f 80### JSERV
81
82# find apxs utility ..
83# .. in PATH
84APXS_UTIL=`type -p apxs || true`
85
86# .. from RPM
87if 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
93 APXS_UTIL=$f
94 break
95 fi
96 done
97fi
98
99# .. at usual places
100if test "x$APXS_UTIL" = x ; then
101 for loc in \
20a63901 102 %{_bindir} \
103 %{_sbindir} \
104 %{_prefix}/local/apache/bin \
105 %{_prefix}/local/apache/sbin \
106 %{_prefix}/local/httpd/bin \
107 %{_prefix}/local/httpd/sbin
0464d88f 108 do
109 if test -x "$loc/apxs" ; then
110 APXS_UTIL="$loc/apxs"
111 break
112 fi
113 done
114fi
115
116if test "x$APXS_UTIL" = x ; then
117 echo "Didn't find apxs .. exiting"
118 exit -1
119fi
120
121APXS_CFLAGS=`$APXS_UTIL -q CFLAGS`
122CFLAGS="$APXS_CFLAGS $RPM_OPT_FLAGS" ./configure \
20a63901 123 --prefix=%{_prefix} \
0464d88f 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
129make
130
131%install
20a63901 132rm -rf $RPM_BUILD_ROOT
133
0464d88f 134make DESTDIR=$RPM_BUILD_ROOT install
135
136echo "default - change on install `date`" > $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
137chmod 600 $RPM_BUILD_ROOT/%{jservconf}/jserv.secret.key
138
139# currently disabled
20a63901 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
0464d88f 146
147### GNU JSDK-classes
148install -d ${RPM_BUILD_ROOT}%{classesdir}
149install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ${RPM_BUILD_ROOT}%{classesdir}
150
151%clean
152rm -rf $RPM_BUILD_ROOT
153
154%post
155
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:
20a63901 158(%{_prefix}/games/fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
0464d88f 159 | (md5sum 2>/dev/null || cat) \
160 > %{jservconf}/jserv.secret.key
161chmod 600 %{jservconf}/jserv.secret.key
162
163#
164# determine apache-USER and chown the jserv.secrect.key - file
165#
166APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
167if test ! "x$APACHEUSER" = x ; then
168 USERCOMMENT="(which is '$APACHEUSER' ?)"
169else
20a63901 170 # assumption:
0464d88f 171 APACHEUSER=nobody
172fi
173chown $APACHEUSER %{jservconf}/jserv.secret.key
174
175#
176# determine apache-GROUP and allow this group to write to %{logdir}
177APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
178if test "x$APACHEGROUP" = x ; then
179 APACHEGROUP=nobody
180fi
181chgrp $APACHEGROUP %{logdir}
182chmod g+w %{logdir}
183
184#
185# Add 'jserv' as an independent service (manual mode)
186#/sbin/chkconfig --add jserv
187#/etc/rc.d/init.d/jserv start
188
189#
190# Find Include Statement or add it if necessary
191#
192cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
193grep '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf \
194 >/dev/null
195if 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
201else
202 # append it
203 (
204 echo "<IfModule mod_jserv.c>"
205 echo " Include %{jservconf}/jserv.conf"
206 echo "</IfModule>"
207 ) >> %{httpdconf}/httpd.conf
208fi
209
210#
211# LoadModule; uncomment or insert
212#
213grep '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf \
214 >/dev/null
215if 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
221else
222 # Insert LoadModule line before first valid LoadModule
223 ( echo "/^LoadModule"
224 echo "i"
225 echo "LoadModule jserv_module modules/mod_jserv.so"
226 echo "."
227 echo "wq"
228 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
229fi
230
231#
232# AddModule; uncomment or insert
233#
234grep '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf >/dev/null
235if 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
241else
242 ( echo "/^AddModule"
243 echo "i"
244 echo "AddModule mod_jserv.c"
245 echo "."
246 echo "wq"
247 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
248fi
249
250#
251# Search vor JAVA at possible locations and edit wrapper.bin
252#
253unset JAVABIN
254for lookfor in java jre ; do
255 for loc in \
256 $JAVA_HOME \
257 $JDK_HOME \
258 /usr/local/java \
259 /usr/local/jdk \
260 /usr/local/jdk117_v3 \
261 /usr/local/jdk117_v1a
262 do
263 if test -x "$loc/bin/$lookfor" ; then
264 JAVABIN="$loc/bin/$lookfor"
265 break
266 fi
267 done
268
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"
275 break
276 fi
277 done
278 if test ! -z "$JAVABIN" ; then break ; fi
279 done
280 if test ! -z "$JAVABIN" ; then break ; fi
281 done
282 fi
283 if test ! -z "$JAVABIN" ; then break ; fi
284done
285
286if 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
291fi
292
293#
294# Get Server Port to echo right URL below
295#
296SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
297 head -1 | awk '{print ":" $2}'`
298if test "$SERVERPORT" = ":80" ; then
299 SERVERPORT=""
300fi
301
20a63901 302#FIXME: make this i18n-aware
0464d88f 303
304if test ! "x$JAVABIN" = x ; then
305 echo "using java VM $JAVABIN"
306else
307 echo "## didn't find java or jre. Please install it and edit the"
308 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
309fi
310echo ""
311echo "In order to enable JServ, restart the webserver and try"
312echo " http://localhost$SERVERPORT/servlets/IsItWorking"
313echo " and"
314echo " http://localhost$SERVERPORT/jserv/"
315echo "-- ENJOY! --"
316echo ""
317
318## we hopefully may distribute SUN-jsdk.jar with jserv once ..
319echo " | NOTE that this distribution contains a fully functional"
320echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
321echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
322echo " | in the wrapper.classpath - line in the file"
323echo " | %{jservconf}/jserv.properties"
324echo " | with the SUN jsdk."
325echo " | Get it from <http://java.sun.com/products/servlet/>."
326echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
327echo " | is supported (_EXACTLY_ 2.0)."
328echo ""
329
330echo "Please send comments/suggestions regarding"
331echo "this RPM to <zeller@to.com>."
332
0464d88f 333%preun
334# do not remove the configured stuff if we upgrade.
335# the $1 argument contains the number of packages _after_ installation.
336if [ ! $1 -eq 0 ] ; then
337 exit 0
338fi
339
340# Remove 'jserv' service (manual mode)
341#/etc/rc.d/init.d/jserv stop
342#/sbin/chkconfig --del jserv
343
344#
345# Find jserv related configuration settings and comment
346# them out
347#
348cp %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
349sed '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
354# remove old logs
355/bin/rm -fr %{logdir}/mod_jserv.log
356/bin/rm -fr %{logdir}/jserv.log
357
358%files
20a63901 359%defattr(644,root,root,755)
360# mmh, we can't give %{_prefix}/docs to %doc ..
0464d88f 361%doc index.html README docs jsdk-doc
362
363%dir %{jservconf}
364%config %{jservconf}/jserv.properties
365%config %{jservconf}/zone.properties
366%config %{jservconf}/jserv.conf
367
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
374
375%attr(-,nobody,nobody) %{jservconf}/jserv.secret.key
20a63901 376#%config %{_sysconfdir}/rc.d/init.d/jserv
377#%config %{_sysconfdir}/logrotate.d/jserv
378#%config %{_sysconfdir}/profile.d/jserv.sh
0464d88f 379
380%{libexecdir}/mod_jserv.so
381%{libexecdir}/ApacheJServ.jar
382
383%dir %{classesdir}
384%{classesdir}/servlet-2.0.jar
385
386%dir %{servletdir}
387%{servletdir}/IsItWorking.java
388%{servletdir}/IsItWorking.class
389
390# we need to have write access here
391%attr(-,nobody,-) %dir %{logdir}
This page took 0.142899 seconds and 4 git commands to generate.