1 |
# Copyright (c) 2000-2007, JPackage Project |
2 |
# All rights reserved. |
3 |
# |
4 |
# Redistribution and use in source and binary forms, with or without |
5 |
# modification, are permitted provided that the following conditions |
6 |
# are met: |
7 |
# |
8 |
# 1. Redistributions of source code must retain the above copyright |
9 |
# notice, this list of conditions and the following disclaimer. |
10 |
# 2. Redistributions in binary form must reproduce the above copyright |
11 |
# notice, this list of conditions and the following disclaimer in the |
12 |
# documentation and/or other materials provided with the |
13 |
# distribution. |
14 |
# 3. Neither the name of the JPackage Project nor the names of its |
15 |
# contributors may be used to endorse or promote products derived |
16 |
# from this software without specific prior written permission. |
17 |
# |
18 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 |
# |
30 |
|
31 |
%global jettyname jetty |
32 |
%global jtuid 110 |
33 |
%global username %{name} |
34 |
%global confdir %{_sysconfdir}/%{name} |
35 |
%global logdir %{_localstatedir}/log/%{name} |
36 |
%global homedir %{_datadir}/%{name} |
37 |
%global jettycachedir %{_localstatedir}/cache/%{name} |
38 |
%global tempdir %{jettycachedir}/temp |
39 |
%global rundir %{_localstatedir}/run/%{name} |
40 |
%global jettylibdir %{_localstatedir}/lib/%{name} |
41 |
%global appdir %{jettylibdir}/webapps |
42 |
|
43 |
Name: jetty |
44 |
Version: 6.1.26 |
45 |
%define subrel 1 |
46 |
Release: %mkrel 8 |
47 |
Summary: The Jetty Webserver and Servlet Container |
48 |
|
49 |
Group: Development/Java |
50 |
License: ASL 2.0 |
51 |
URL: http://jetty.mortbay.org/jetty/ |
52 |
Source0: http://dist.codehaus.org/%{name}/%{name}-%{version}/%{name}-%{version}-src.zip |
53 |
Source1: djetty.script |
54 |
Source2: jetty.init |
55 |
Source3: jetty.logrotate |
56 |
Source4: %{name}-depmap.xml |
57 |
Patch0: disable-modules.patch |
58 |
Patch1: jetty-util-pom.patch |
59 |
Patch4: jetty-plugin-fix-site.patch |
60 |
Patch5: jetty-6.1.26-fix-build.patch |
61 |
Patch6: jetty-hashDOS.patch |
62 |
BuildArch: noarch |
63 |
#%{?FE_USERADD_REQ} |
64 |
BuildRequires: jpackage-utils >= 0:1.6 |
65 |
# build only |
66 |
BuildRequires: maven-antrun-plugin |
67 |
BuildRequires: apache-commons-parent |
68 |
BuildRequires: maven-compiler-plugin |
69 |
BuildRequires: maven-enforcer-plugin |
70 |
BuildRequires: maven-install-plugin |
71 |
BuildRequires: maven-jar-plugin |
72 |
BuildRequires: maven-plugin-plugin |
73 |
BuildRequires: maven-resources-plugin |
74 |
BuildRequires: maven-site-plugin |
75 |
BuildRequires: maven-source-plugin |
76 |
BuildRequires: maven-project-info-reports-plugin |
77 |
BuildRequires: maven-dependency-plugin |
78 |
BuildRequires: maven-assembly-plugin |
79 |
BuildRequires: maven-remote-resources-plugin |
80 |
BuildRequires: maven-war-plugin |
81 |
BuildRequires: maven-plugin-bundle |
82 |
BuildRequires: maven-release-plugin |
83 |
BuildRequires: maven-surefire-plugin |
84 |
BuildRequires: maven-shared-dependency-tree |
85 |
BuildRequires: servlet25 |
86 |
BuildRequires: jsp21 |
87 |
BuildRequires: slf4j |
88 |
BuildRequires: objectweb-asm |
89 |
BuildRequires: apache-commons-el |
90 |
BuildRequires: apache-commons-daemon |
91 |
BuildRequires: geronimo-jta |
92 |
BuildRequires: geronimo-parent-poms |
93 |
BuildRequires: apache-commons-parent |
94 |
BuildRequires: derby |
95 |
BuildRequires: tomcat5-jasper |
96 |
BuildRequires: tomcat6-lib |
97 |
BuildRequires: zip |
98 |
|
99 |
Requires: chkconfig |
100 |
Requires: jpackage-utils >= 0:1.6 |
101 |
Requires: ant >= 0:1.6 |
102 |
Requires: apache-commons-el |
103 |
Requires: apache-commons-logging |
104 |
Requires: mx4j |
105 |
Requires: servlet25 |
106 |
Requires: jsp21 |
107 |
Requires: slf4j |
108 |
Requires: javamail |
109 |
Requires: xerces-j2 >= 0:2.7 |
110 |
Requires: xml-commons-apis |
111 |
Requires(post): jpackage-utils >= 0:1.6 |
112 |
Requires(postun): jpackage-utils >= 0:1.6 |
113 |
#Provides: group(%username) = %jtuid |
114 |
#Provides: user(%username) = %jtuid |
115 |
|
116 |
Obsoletes: %name-eclipse |
117 |
Provides: %name-eclipse = %version-%release |
118 |
|
119 |
%description |
120 |
Jetty is a 100% Java HTTP Server and Servlet Container. |
121 |
This means that you do not need to configure and run a |
122 |
separate web server (like Apache) in order to use java, |
123 |
servlets and JSPs to generate dynamic content. Jetty is |
124 |
a fully featured web server for static and dynamic content. |
125 |
Unlike separate server/container solutions, this means |
126 |
that your web server and web application run in the same |
127 |
process, without interconnection overheads and complications. |
128 |
Furthermore, as a pure java component, Jetty can be simply |
129 |
included in your application for demonstration, distribution |
130 |
or deployment. Jetty is available on all Java supported |
131 |
platforms. |
132 |
|
133 |
%package javadoc |
134 |
Summary: Javadoc for %{name} |
135 |
Group: Documentation |
136 |
Requires: %{name} = %{version} |
137 |
|
138 |
%description javadoc |
139 |
%{summary}. |
140 |
|
141 |
%package manual |
142 |
Summary: Documents for %{name} |
143 |
Group: Documentation |
144 |
Requires: %{name} = %{version} |
145 |
|
146 |
%description manual |
147 |
%{summary}. |
148 |
|
149 |
%prep |
150 |
%setup -q -n %{jettyname}-%{version} |
151 |
for f in $(find . -name "*.?ar"); do rm $f; done |
152 |
find . -name "*.class" -exec rm {} \; |
153 |
|
154 |
%patch0 -b .sav |
155 |
%patch1 -b .sav |
156 |
%patch4 -b .sav |
157 |
%patch5 -p0 -b .over |
158 |
%patch6 -b .sav |
159 |
|
160 |
cp %{SOURCE1} djetty |
161 |
|
162 |
#remove glassfish specific file |
163 |
rm -fr modules/jsp-2.1/src/main/java/com/sun/org/apache/commons/logging/impl/JettyLog.java |
164 |
|
165 |
sed -i "s|<groupId>org.codehaus.mojo</groupId>||g" modules/management/pom.xml |
166 |
sed -i "s|dependency-maven-plugin|maven-dependency-plugin|g" modules/management/pom.xml |
167 |
sed -i "s|<groupId>org.codehaus.mojo</groupId>||g" modules/jsp-2.0/pom.xml |
168 |
sed -i "s|<groupId>ant</groupId>|<groupId>org.apache.ant</groupId>|g" modules/jsp-2.0/pom.xml |
169 |
sed -i "s|dependency-maven-plugin|maven-dependency-plugin|g" modules/jsp-2.0/pom.xml |
170 |
sed -i "s|<groupId>org.codehaus.mojo</groupId>||g" modules/naming/pom.xml |
171 |
sed -i "s|dependency-maven-plugin|maven-dependency-plugin|g" modules/naming/pom.xml |
172 |
sed -i "s|<groupId>org.codehaus.mojo</groupId>||g" modules/annotations/pom.xml |
173 |
sed -i "s|dependency-maven-plugin|maven-dependency-plugin|g" modules/annotations/pom.xml |
174 |
|
175 |
sed -i "s|mvn|mvn-jpp|g" distribution/jetty-assembly/pom.xml |
176 |
|
177 |
sed -i "s|zip \$D/\$N|zip \$D/\$N/\$N|g" bin/build_release_bundles.sh |
178 |
|
179 |
sed -i "s|# look for JETTY_HOME|export JETTY_HOME=/usr/share/jetty|g" bin/jetty-xinetd.sh |
180 |
|
181 |
%build |
182 |
sed -i -e "s|/usr/share|%{_datadir}|g" djetty |
183 |
|
184 |
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository |
185 |
|
186 |
mvn-jpp \ |
187 |
-e \ |
188 |
-Dmaven.repo.local=$MAVEN_REPO_LOCAL \ |
189 |
-Dmaven2.jpp.depmap.file=%{SOURCE4} \ |
190 |
-Dmaven.test.skip=true \ |
191 |
-DupdateReleaseInfo=true \ |
192 |
install |
193 |
|
194 |
#pushd distribution/jetty-assembly |
195 |
# mvn-jpp \ |
196 |
# -e \ |
197 |
# -s $(pwd)/settings.xml \ |
198 |
# -Dmaven.repo.local=$MAVEN_REPO_LOCAL \ |
199 |
# -Dmaven2.jpp.depmap.file=%{SOURCE4} \ |
200 |
# -Dmaven.test.skip=true \ |
201 |
# install |
202 |
#popd |
203 |
|
204 |
sh bin/build_release_bundles.sh . |
205 |
|
206 |
%install |
207 |
rm -rf $RPM_BUILD_ROOT |
208 |
# dirs |
209 |
install -dm 755 $RPM_BUILD_ROOT%{_bindir} |
210 |
install -dm 755 $RPM_BUILD_ROOT%{_initrddir} |
211 |
install -dm 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d |
212 |
install -dm 755 $RPM_BUILD_ROOT%{_javadir}/%{name} |
213 |
|
214 |
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms |
215 |
install -pm 644 pom.xml $RPM_BUILD_ROOT/%{_datadir}/maven2/poms/JPP.jetty-jetty.pom |
216 |
install -pm 644 modules/util/pom.xml $RPM_BUILD_ROOT/%{_datadir}/maven2/poms/JPP.jetty-jetty-util.pom |
217 |
|
218 |
%add_to_maven_depmap org.mortbay.jetty jetty %{version} JPP/jetty jetty |
219 |
%add_to_maven_depmap org.mortbay.jetty jetty-util %{version} JPP/jetty jetty-util |
220 |
|
221 |
install -dm 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version} |
222 |
install -dm 755 $RPM_BUILD_ROOT%{confdir} |
223 |
install -dm 755 $RPM_BUILD_ROOT%{homedir} |
224 |
install -dm 755 $RPM_BUILD_ROOT%{logdir} |
225 |
install -dm 755 $RPM_BUILD_ROOT%{rundir} |
226 |
install -dm 755 $RPM_BUILD_ROOT%{tempdir} |
227 |
install -dm 755 $RPM_BUILD_ROOT%{appdir} |
228 |
# main pkg |
229 |
unzip -q %{name}-%{version}.zip -d $RPM_BUILD_ROOT%{homedir} |
230 |
mv $RPM_BUILD_ROOT%{homedir}/%{name}-%{version}/* $RPM_BUILD_ROOT%{homedir}/ |
231 |
rm -fr $RPM_BUILD_ROOT%{homedir}/%{name}-%{version} |
232 |
|
233 |
chmod +x $RPM_BUILD_ROOT%{homedir}/bin/jetty-xinetd.sh |
234 |
chmod +x djetty |
235 |
mv djetty $RPM_BUILD_ROOT%{_bindir}/djetty |
236 |
ln -s %{homedir}/bin/jetty.sh $RPM_BUILD_ROOT%{_bindir}/%{name} |
237 |
install -pm 755 %{SOURCE2} $RPM_BUILD_ROOT%{_initrddir}/%{name} |
238 |
install -pm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name} |
239 |
echo '# Placeholder configuration file. No default is provided.' > $RPM_BUILD_ROOT%{confdir}/jetty.conf |
240 |
ln -s %{homedir}/lib/%{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-%{version}.jar |
241 |
ln -s %{homedir}/lib/%{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}.jar |
242 |
ln -s %{homedir}/lib/%{name}-util-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-util-%{version}.jar |
243 |
ln -s %{homedir}/lib/%{name}-util-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-util.jar |
244 |
( cat << EO_RC |
245 |
JAVA_HOME=/usr/lib/jvm/java |
246 |
JAVA_OPTIONS= |
247 |
JETTY_HOME=%{homedir} |
248 |
JETTY_CONSOLE=%{logdir}/jetty-console.log |
249 |
JETTY_PORT=8080 |
250 |
JETTY_RUN=%{_localstatedir}/run/%{name} |
251 |
JETTY_PID=\$JETTY_RUN/jetty.pid |
252 |
EO_RC |
253 |
) > $RPM_BUILD_ROOT%{homedir}/.jettyrc |
254 |
|
255 |
# javadoc |
256 |
mv $RPM_BUILD_ROOT%{homedir}/jxr/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version} |
257 |
|
258 |
# manual |
259 |
install -dm 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} |
260 |
|
261 |
rm -fr $RPM_BUILD_ROOT%{homedir}/logs |
262 |
ln -s %{logdir} $RPM_BUILD_ROOT%{homedir}/logs |
263 |
|
264 |
mv $RPM_BUILD_ROOT%{homedir}/etc/* $RPM_BUILD_ROOT/%{confdir} |
265 |
rm -fr $RPM_BUILD_ROOT%{homedir}/etc |
266 |
ln -s %{confdir} $RPM_BUILD_ROOT%{homedir}/etc |
267 |
|
268 |
mv $RPM_BUILD_ROOT%{homedir}/webapps/* $RPM_BUILD_ROOT/%{appdir} |
269 |
rm -fr $RPM_BUILD_ROOT%{homedir}/webapps |
270 |
ln -s %{appdir} $RPM_BUILD_ROOT%{homedir}/webapps |
271 |
|
272 |
rm -fr $RPM_BUILD_ROOT%{homedir}/contrib |
273 |
rm -fr $RPM_BUILD_ROOT%{homedir}/distribution |
274 |
rm -fr $RPM_BUILD_ROOT%{homedir}/examples |
275 |
rm -fr $RPM_BUILD_ROOT%{homedir}/extras |
276 |
rm -fr $RPM_BUILD_ROOT%{homedir}/modules |
277 |
rm -fr $RPM_BUILD_ROOT%{homedir}/patches |
278 |
rm -fr $RPM_BUILD_ROOT%{homedir}/jxr |
279 |
rm -fr $RPM_BUILD_ROOT%{homedir}/project-website |
280 |
rm -fr $RPM_BUILD_ROOT%{homedir}/LICENSES |
281 |
rm -fr $RPM_BUILD_ROOT%{homedir}/bin/jetty-service.conf |
282 |
rm -fr $RPM_BUILD_ROOT%{homedir}/bin/Jetty-Service.exe |
283 |
rm -fr $RPM_BUILD_ROOT%{homedir}/bin/README.jetty-cygwin.txt.txt |
284 |
rm -fr $RPM_BUILD_ROOT%{homedir}/bin/build_release_bundles.sh |
285 |
rm -fr $RPM_BUILD_ROOT%{homedir}/bin/jetty-cygwin.sh |
286 |
rm -fr $RPM_BUILD_ROOT%{homedir}/*.txt |
287 |
rm -fr $RPM_BUILD_ROOT%{homedir}/pom.* |
288 |
rm -fr $RPM_BUILD_ROOT%{homedir}/*.zip |
289 |
|
290 |
#use system jars |
291 |
pushd $RPM_BUILD_ROOT%{homedir}/lib/jsp-2.0 |
292 |
rm -fr *.jar |
293 |
build-jar-repository . ant |
294 |
build-jar-repository . commons-el |
295 |
build-jar-repository . tomcat6/jasper |
296 |
build-jar-repository . slf4j/jcl-over-slf4j |
297 |
build-jar-repository . slf4j/api |
298 |
build-jar-repository . slf4j/simple |
299 |
build-jar-repository . xerces-j2 |
300 |
build-jar-repository . xml-commons-apis |
301 |
build-jar-repository . tomcat6-jsp-2.1-api |
302 |
popd |
303 |
|
304 |
pushd $RPM_BUILD_ROOT%{homedir}/lib/management/mx4j |
305 |
rm -fr *.jar |
306 |
build-jar-repository . mx4j/mx4j |
307 |
build-jar-repository . mx4j/mx4j-tools |
308 |
popd |
309 |
|
310 |
pushd $RPM_BUILD_ROOT%{homedir}/lib/naming |
311 |
build-jar-repository . javamail |
312 |
rm -fr mail-*.jar |
313 |
popd |
314 |
|
315 |
pushd $RPM_BUILD_ROOT%{homedir}/lib |
316 |
build-jar-repository . tomcat6-servlet-2.5-api |
317 |
rm -fr servlet-api-*.jar |
318 |
popd |
319 |
|
320 |
%clean |
321 |
rm -rf $RPM_BUILD_ROOT |
322 |
|
323 |
%pre |
324 |
# Use /bin/sh so init script will start properly. |
325 |
%_pre_useradd %username %homedir /bin/sh || : |
326 |
|
327 |
# Add the "jetty" user and group |
328 |
%_pre_groupadd %username %username &>/dev/null || : |
329 |
|
330 |
%post |
331 |
[ -x /sbin/chkconfig ] && /sbin/chkconfig --add %{name} |
332 |
%update_maven_depmap |
333 |
|
334 |
%postun |
335 |
%_postun_userdel %username |
336 |
%_postun_groupdel %username |
337 |
%update_maven_depmap |
338 |
|
339 |
|
340 |
%preun |
341 |
if [ $1 = 0 ]; then |
342 |
[ -f /var/lock/subsys/%{name} ] && %{_initrddir}/%{name} stop |
343 |
[ -f %{_initrddir}/%{name} -a -x /sbin/chkconfig ] && /sbin/chkconfig --del %{name} |
344 |
fi |
345 |
|
346 |
%files |
347 |
%defattr(-,root,root,-) |
348 |
%{_bindir}/* |
349 |
%dir %{_javadir}/%{name} |
350 |
%{_javadir}/%{name}/%{name}.jar |
351 |
%{_javadir}/%{name}/%{name}-%{version}.jar |
352 |
%{_javadir}/%{name}/%{name}-util.jar |
353 |
%{_javadir}/%{name}/%{name}-util-%{version}.jar |
354 |
%{_datadir}/maven2 |
355 |
%{_mavendepmapfragdir} |
356 |
%config(noreplace) %{confdir} |
357 |
%dir %{jettylibdir} |
358 |
%dir %{jettycachedir} |
359 |
%{homedir} |
360 |
%{appdir} |
361 |
%attr(755, jetty, jetty) %{logdir} |
362 |
%attr(755, jetty, jetty) %{tempdir} |
363 |
%attr(755, jetty, jetty) %{rundir} |
364 |
%dir %{appdir} |
365 |
%doc NOTICE.txt |
366 |
%doc README.txt |
367 |
%doc VERSION.txt |
368 |
%{_initrddir}/%{name} |
369 |
%{_sysconfdir}/logrotate.d/%{name} |
370 |
|
371 |
%files javadoc |
372 |
%defattr(-,root,root,-) |
373 |
%doc %{_javadocdir}/%{name}-%{version} |
374 |
|
375 |
%files manual |
376 |
%defattr(-,root,root,-) |
377 |
%doc %{_docdir}/%{name}-%{version} |
378 |
|