]> git.pld-linux.org Git - packages/ApacheJServ.git/blob - ApacheJServ.spec
c323e9dd038eb03f93b02b0f7d58502018c831d7
[packages/ApacheJServ.git] / ApacheJServ.spec
1 # TODO
2 # - separate package for jsdk?
3 #
4 # Conditional build:
5 %bcond_with     gcj     # use GCJ instead of javac
6 #
7 %define         apxs            /usr/sbin/apxs1
8 %define         jsdkversion     20000924
9 Summary:        Servlet engine with support for the leading web server
10 Summary(pl):    Silnik serwletów ze wsparciem dla wiod±cego serwera WWW
11 Name:           ApacheJServ
12 Version:        1.1.2
13 Release:        0.52
14 License:        freely distributable & usable (JServ), LGPL (JSDK)
15 Group:          Networking/Daemons
16 Source0:        http://java.apache.org/jserv/dist/%{name}-%{version}.tar.gz
17 # Source0-md5:  6d48a1b9fcc5eea4dfebaae29ba5a485
18 Source1:        http://www.euronet.nl/~pauls/java/servlet/download/classpathx_servlet-%{jsdkversion}.tar.gz
19 # Source1-md5:  a81feddb91b1358f9aaed94e83eddb54
20 Source2:        %{name}.conf
21 Source3:        %{name}.init
22 Patch0:         %{name}-enable-secret.patch
23 Patch1:         %{name}-ac.patch
24 Patch2:         %{name}-jre-env.patch
25 URL:            http://java.apache.org/
26 BuildRequires:  apache1-devel >= 1.3.9-8
27 BuildRequires:  rpmbuild(macros) >= 1.228
28 BuildRequires:  sed >= 4.0
29 %if %{with gcj}
30 BuildRequires:  gcc-java
31 BuildRequires:  fastjar
32 BuildRequires:  jdkgcj
33 Requires:       /usr/bin/gij
34 %else
35 BuildRequires:  java-sun
36 Requires:       java-sun-jre
37 %endif
38 Provides:       jserv
39 Provides:       jsdk20
40 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41
42 %define         _pkglibdir      %(%{apxs} -q LIBEXECDIR 2>/dev/null)
43 %define         httpdconf       %(%{apxs} -q SYSCONFDIR 2>/dev/null)
44 %define         _sysconfdir     /etc/jserv
45 %define         logdir          /var/log/jserv
46 %define         servletdir      %{_datadir}/jserv/servlets
47 %define         _noautocompressdoc  package-list
48
49 %description
50 Apache JServ is a servlet engine, developed by the Java Apache Project
51 <http://java.apache.org/>. The Apache JServ servlet engine is written
52 in 100pc Java application, and listens for servlet requests using the
53 Apache Java protocol (AJp). Typically, these requests will originate
54 from the mod_jserv Apache module (DSO included). This package contains
55 a LGPL'ed implementation of Sun's Java Servlet API version 2.0 by Paul
56 Siegmann <http://www.euronet.nl/~pauls/java/servlet/>.
57
58 %description -l pl
59 Apache JServ jest silnikiem serwletowym, rozwijanym przez Java Apache
60 Project <http://java.apache.org/>. Silnik serwletowy Apache JServ
61 zosta³ napisany od pocz±tku do koñca w Javie; nas³uchuje wywo³añ
62 serwletu wykorzystuj±c protokó³ Apache Java (AJp). Zazwyczaj wywo³ania
63 te pochodz± z modu³u Apache mod_jservmodule (³±cznie z DSO). Pakiet
64 ten zawiera implementacjê Java Servlet API Suna w wersji 2.0 napisan±
65 przez Paula Siegmanna (na licencji LGPL)
66 <http://www.euronet.nl/~pauls/java/servlet/>.
67
68 %package -n apache1-mod_jserv
69 Summary:        JServ module for Apache
70 Summary(pl):    Modu³ JServ dla Apache'a
71 Group:          Networking/Daemons
72 Requires:       %{name} = %{version}-%{release}
73 Requires:       apache1 >= 1.3.33-2
74
75 %description -n apache1-mod_jserv
76 JServ module for Apache.
77
78 %description -n apache1-mod_jserv -l pl
79 Modu³ JServ dla Apache'a.
80
81 %package init
82 Summary:        ApacheJServ initscript
83 Summary(pl):    Skrypt startowy ApacheJServ
84 Group:          Development/Languages/Java
85 Requires:       %{name} = %{version}-%{release}
86 Requires(pre):  /bin/id
87 Requires(pre):  /usr/bin/getgid
88 Requires(pre):  /usr/sbin/useradd
89 Requires(pre):  /usr/sbin/groupadd
90 Requires(post,preun):   rc-scripts
91 Requires(triggerin):    sed >= 4.0
92 Requires:       rc-scripts
93
94 %description init
95 JServ initscript for standalone mode.
96
97 %description init -l pl
98 Skrypt startowy JServ dla trybu samodzielnego.
99
100 %package doc
101 Summary:        ApacheJServ documentation
102 Summary(pl):    Dokumentacja do ApacheJServ
103 Group:          Development/Languages/Java
104
105 %description doc
106 ApacheJserv documentation.
107
108 %description doc -l pl
109 Dokumentacja do ApacheJServ.
110
111 %prep
112 %setup -q -a1
113 %patch0 -p0
114 %patch1 -p0
115 %patch2 -p1
116
117 sed -i -e '
118         s|@JSDK_CLASSES@|%{_javadir}/servlet-2.0.jar|g
119 ' conf/jserv.properties.in
120
121 # do not load module in provided jserv.conf; we do this in httpd.conf
122 sed -i -e 's|@LOAD_OR_NOT@|#|g' conf/jserv.conf.in
123
124 # we don't want gcj related deps
125 sed -i -e '/^SUBDIRS/s,java,,' src/Makefile.am
126 sed -i -e '/^SUBDIRS/s,example,,' Makefile.am
127
128 %build
129 if [ ! -f _autotools.done.1 ]; then
130         %{__gettextize}
131         %{__libtoolize}
132         %{__aclocal}
133         %{__autoconf}
134         %{__automake}
135         touch _autotools.done.1
136 fi
137
138 # prepare compilation
139 if [ ! -f classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ]; then
140         %{__make} -C classpathx_servlet-%{jsdkversion} jar_2_0
141 fi
142
143 if [ ! -d jsdk-doc ]; then
144         %{__make} -C classpathx_servlet-%{jsdkversion}/apidoc
145
146         # copy API-doc
147         mkdir jsdk-doc
148         cp classpathx_servlet-%{jsdkversion}/{README,AUTHORS,COPYING.LIB} jsdk-doc
149         cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
150 fi
151
152 ### JSERV
153 CFLAGS="$(%{apxs} -q CFLAGS) %{rpmcflags}"
154 %configure \
155         %{!?debug:--disable-debugging} \
156         --with-apxs=%{apxs} \
157         --with-logdir=%{logdir} \
158         --with-servlets=%{servletdir} \
159         %{!?with_gcj:GCJ=javac GCJFLAGS= CLASSPATH=`pwd` JAVAC_OPT="-source 1.4"} \
160     %{!?with_gcj:--with-javac=%{_bindir}/javac --with-java=%{_bindir}/java --with-jdk-home=%{_libdir}/java} \
161     %{?with_gcj:--with-javac=%{_bindir}/gcj --with-jar=%{_bindir}/fastjar} \
162         --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar
163
164 %{__make} %{!?with_gcj:OBJEXT=class JAVAC_OPT='-source 1.4'} \
165         -C src/java
166 %{__make}
167
168 %install
169 rm -rf $RPM_BUILD_ROOT
170 install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{httpdconf}/conf.d,%{_javadir}}
171
172 install %{SOURCE2} $RPM_BUILD_ROOT%{httpdconf}/conf.d/81_mod_jserv.conf
173 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/jserv
174
175 %{__make} install \
176         DESTDIR=$RPM_BUILD_ROOT
177
178 # we removed java from SUBDIRS, so do it manually
179 %{__make} install \
180         %{!?with_gcj:OBJEXT=class JAVAC_OPT='-source 1.4'} \
181         -C src/java \
182         DESTDIR=$RPM_BUILD_ROOT
183
184 echo "default - change on install" > $RPM_BUILD_ROOT%{_sysconfdir}/jserv.secret.key
185
186 ### GNU JSDK-classes
187 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar $RPM_BUILD_ROOT%{_javadir}
188
189 find jsdk-doc -name 'Makefile*' | xargs rm -f
190 rm -rf jsdk-doc/{COPYING.LIB,CVS} jsdk-doc/apidoc/CVS
191
192 # duplicate
193 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/jserv.conf
194 rm -rf $RPM_BUILD_ROOT/usr/docs
195
196 %clean
197 rm -rf $RPM_BUILD_ROOT
198
199 %post
200 if [ "$1" = 1 ]; then
201         dd if=/dev/urandom bs=1 count=42 2>/dev/null \
202                 | (md5sum 2>/dev/null || cat) > %{_sysconfdir}/jserv.secret.key
203 fi
204
205 %post -n apache1-mod_jserv
206 %service apache restart
207
208 %postun -n apache1-mod_jserv
209 if [ "$1" = "0" ]; then
210         %service -q apache restart
211 fi
212
213 %pre init
214 %groupadd -P %{name}-init -g 154 jserv
215 %useradd -P %{name}-init -u 154 -g jserv -d /etc/jserv -c "JServ User" jserv
216
217 %post init
218 /sbin/chkconfig --add jserv
219
220 %preun init
221 if [ "$1" = 0 ]; then
222         if [ -f /var/lock/subsys/jserv ]; then
223                 /etc/rc.d/init.d/jserv stop 1>&2
224         fi
225         /sbin/chkconfig --del jserv
226 fi
227
228 %postun init
229 if [ "$1" = "0" ]; then
230         %userremove jserv
231         %groupremove jserv
232 fi
233
234 %triggerin init -- apache1-mod_jserv
235 if [ "$2" != 1 ]; then
236         exit 0
237 fi
238 # so, we have initscript and apache module, it means we turn off
239 # automatic mode and switch to manual mode, and change jserv config
240 # groups to jserv user
241 MODE=$(awk '/^[\t ]*ApJServManual (on|off)/{print $2}' %{httpdconf}/conf.d/??_mod_jserv.conf)
242 if [ "$MODE" = off ]; then
243         chgrp jserv %{_sysconfdir}/{{jserv,zone}.properties,jserv.secret.key}
244         sed -i -e '/^[   ]*ApJServManual[        ]\+/s/off/on/i' %{httpdconf}/conf.d/??_mod_jserv.conf
245 fi
246
247 %files
248 %defattr(644,root,root,755)
249 %doc LICENSE README
250 %dir %{_sysconfdir}
251 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jserv.properties
252 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zone.properties
253 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jserv.secret.key
254 %{_javadir}/ApacheJServ.jar
255 %{_javadir}/servlet-2.0.jar
256
257 %if 0
258 %dir %{servletdir}
259 %{servletdir}/Hello.java
260 %{servletdir}/Hello.class
261 %{servletdir}/IsItWorking.java
262 %{servletdir}/IsItWorking.class
263 %endif
264
265 %files -n apache1-mod_jserv
266 %defattr(644,root,root,755)
267 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{httpdconf}/conf.d/*_mod_jserv.conf
268 %attr(755,root,root) %{_pkglibdir}/mod_jserv.so
269 %attr(770,root,http) %dir %{logdir}
270
271 %files init
272 %defattr(644,root,root,755)
273 %attr(754,root,root) /etc/rc.d/init.d/jserv
274
275 %files doc
276 %defattr(644,root,root,755)
277 %doc index.html docs
278 %doc jsdk-doc
This page took 1.568636 seconds and 2 git commands to generate.