]> git.pld-linux.org Git - packages/ApacheJServ.git/blob - ApacheJServ.spec
- user/groupadd to init package
[packages/ApacheJServ.git] / ApacheJServ.spec
1 # TODO
2 # - separate package for jsdk?
3 #
4 # Conditional build:
5 %bcond_with     gcj     # use javac instead of GCJ
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.27
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 Requires:       /usr/bin/gij
33 %else
34 BuildRequires:  jdk
35 %endif
36 Requires(post,preun):   rc-scripts
37 Requires:       apache1 >= 1.3.33-2
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 sunowsk± implementacjê api serletów w javie w wersji 2.0
65 (na licencji LGPL) napisana przez Paula Siegmanna
66 <http://www.euronet.nl/~pauls/java/servlet/>
67
68 %package init
69 Summary:        ApacheJServ initscript
70 Group:          Development/Languages/Java
71 Requires:       %{name} = %{version}-%{release}
72 BuildRequires:  rpmbuild(macros) >= 1.202
73 Requires(pre):  /bin/id
74 Requires(pre):  /usr/bin/getgid
75 Requires(pre):  /usr/sbin/useradd
76 Requires(pre):  /usr/sbin/groupadd
77
78 %description init
79 JServ initscript for standalone mode.
80
81 %package doc
82 Summary:        ApacheJServ documentation
83 Group:          Development/Languages/Java
84
85 %description doc
86 ApacheJserv documentation.
87
88 %prep
89 %setup -q -a1
90 %patch0 -p0
91 %patch1 -p0
92 %patch2 -p1
93
94 sed -i -e '
95         s|@JSDK_CLASSES@|%{_javadir}/servlet-2.0.jar|g
96 ' conf/jserv.properties.in
97
98 # do not load module in provided jserv.conf; we do this in httpd.conf
99 sed -i -e 's|@LOAD_OR_NOT@|#|g' conf/jserv.conf.in
100
101 # we don't want gcj related deps
102 sed -i -e '/^SUBDIRS/s,java,,' src/Makefile.am
103 sed -i -e '/^SUBDIRS/s,example,,' Makefile.am
104
105 %build
106 if [ ! -f _autotools.done.1 ]; then
107         %{__gettextize}
108         %{__libtoolize}
109         %{__aclocal}
110         %{__autoconf}
111         %{__automake}
112         touch _autotools.done.1
113 fi
114
115 # prepare compilation
116 if [ ! -f classpathx_servlet-%{jsdkversion}/servlet-2.0.jar ]; then
117         %{__make} -C classpathx_servlet-%{jsdkversion} jar_2_0
118 fi
119
120 if [ ! -d jsdk-doc ]; then
121         %{__make} -C classpathx_servlet-%{jsdkversion}/apidoc
122
123         # copy API-doc
124         mkdir jsdk-doc
125         cp classpathx_servlet-%{jsdkversion}/{README,AUTHORS,COPYING.LIB} jsdk-doc
126         cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
127 fi
128
129 ### JSERV
130 CFLAGS="$(%{apxs} -q CFLAGS) %{rpmcflags}"
131 %configure \
132         %{!?debug:--disable-debugging} \
133         --with-apxs=%{apxs} \
134         --with-logdir=%{logdir} \
135         --with-servlets=%{servletdir} \
136         %{!?with_gcj:GCJ=javac GCJFLAGS= CLASSPATH=`pwd` JAVAC_OPT="-source 1.4"} \
137     %{!?with_gcj:--with-javac=%{_bindir}/javac --with-java=%{_bindir}/java --with-jdk-home=%{_libdir}/java} \
138     %{?with_gcj:--with-javac=%{_bindir}/gcj --with-jar=%{_bindir}/fastjar} \
139         --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar
140
141 %{__make} %{!?with_gcj:OBJEXT=class JAVAC_OPT='-source 1.4'} \
142         -C src/java
143 %{__make}
144
145 %install
146 rm -rf $RPM_BUILD_ROOT
147 install -d $RPM_BUILD_ROOT%{_javadir}
148 install -d $RPM_BUILD_ROOT/etc/apache/conf.d
149 install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,profile.d,logrotate.d}
150 install %{SOURCE2} $RPM_BUILD_ROOT/etc/apache/conf.d/81_mod_jserv.conf
151 install %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/jserv
152
153 %{__make} install \
154         DESTDIR=$RPM_BUILD_ROOT
155
156 # we removed java, so do it manually
157 %{__make} install \
158         %{!?with_gcj:OBJEXT=class JAVAC_OPT='-source 1.4'} \
159         -C src/java \
160         DESTDIR=$RPM_BUILD_ROOT
161
162 echo "default - change on install `date`" > $RPM_BUILD_ROOT%{_sysconfdir}/jserv.secret.key
163
164 # currently disabled
165 #install src/scripts/package/rpm/jserv.init      $RPM_BUILD_ROOT/etc/rc.d/init.d/jserv
166 #install src/scripts/package/rpm/jserv.sh        $RPM_BUILD_ROOT/etc/profile.d
167 #install src/scripts/package/rpm/jserv.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/jserv
168
169 ### GNU JSDK-classes
170 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar $RPM_BUILD_ROOT%{_javadir}
171
172 find jsdk-doc -name 'Makefile*' | xargs rm -f
173 rm -rf jsdk-doc/{COPYING.LIB,CVS} jsdk-doc/apidoc/CVS
174
175 # duplicate
176 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/jserv.conf
177
178 %clean
179 rm -rf $RPM_BUILD_ROOT
180
181 %post
182 if [ "$1" = 1 ]; then
183         dd if=/dev/urandom bs=1 count=42 2>/dev/null \
184                 | (md5sum 2>/dev/null || cat) > %{_sysconfdir}/jserv.secret.key
185 fi
186 %service apache restart
187
188 %postun
189 if [ "$1" = "0" ]; then
190         %service -q apache restart
191 fi
192
193
194 %pre init
195 %groupadd -P %{name}-init -g 154 jserv
196 %useradd -P %{name}-init -u 154 -g jserv -d /etc/jserv -c "JServ User" jserv
197
198 %post init
199 /sbin/chkconfig --add jserv
200
201 %preun init
202 if [ "$1" = 0 ]; then
203         if [ -f /var/lock/subsys/jserv ]; then
204                 /etc/rc.d/init.d/jserv stop 1>&2
205         fi
206         /sbin/chkconfig --del jserv
207 fi
208
209 %postun init
210 if [ "$1" = "0" ]; then
211         %userremove jserv
212         %groupremove jserv
213 fi
214
215 %files
216 %defattr(644,root,root,755)
217 %doc LICENSE README
218 %dir %{_sysconfdir}
219 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{httpdconf}/conf.d/*_mod_jserv.conf
220 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jserv.properties
221 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zone.properties
222 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/jserv.secret.key
223 #%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/jserv
224 #%config /etc/profile.d/jserv.sh
225
226 %attr(755,root,root) %{_pkglibdir}/mod_jserv.so
227
228 %{_javadir}/ApacheJServ.jar
229 %{_javadir}/servlet-2.0.jar
230
231 %if 0
232 %dir %{servletdir}
233 %{servletdir}/Hello.java
234 %{servletdir}/Hello.class
235 %{servletdir}/IsItWorking.java
236 %{servletdir}/IsItWorking.class
237 %endif
238
239 %attr(770,root,http) %dir %{logdir}
240
241 %files init
242 %defattr(644,root,root,755)
243 %attr(754,root,root) /etc/rc.d/init.d/jserv
244
245 %files doc
246 %defattr(644,root,root,755)
247 %doc index.html docs
248 %doc jsdk-doc
This page took 0.045877 seconds and 3 git commands to generate.