1 |
%define bootstrap 1 |
2 |
%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}} |
3 |
|
4 |
Name: log4j |
5 |
Version: 1.2.16 |
6 |
Release: %mkrel 1 |
7 |
Epoch: 0 |
8 |
Summary: Java logging package |
9 |
BuildArch: noarch |
10 |
License: ASL 2.0 |
11 |
Group: Development/Java |
12 |
URL: http://logging.apache.org/%{name} |
13 |
Source0: http://www.apache.org/dist/logging/%{name}/%{version}/apache-%{name}-%{version}.tar.gz |
14 |
# Converted from src/java/org/apache/log4j/lf5/viewer/images/lf5_small_icon.gif |
15 |
Source1: %{name}-logfactor5.png |
16 |
Source2: %{name}-logfactor5.sh |
17 |
Source3: %{name}-logfactor5.desktop |
18 |
# Converted from docs/images/logo.jpg |
19 |
Source4: %{name}-chainsaw.png |
20 |
Source5: %{name}-chainsaw.sh |
21 |
Source6: %{name}-chainsaw.desktop |
22 |
Source7: %{name}.catalog |
23 |
Patch0: 0001-logfactor5-changed-userdir.patch |
24 |
Patch1: 0002-Remove-version-dependencies.patch |
25 |
Patch2: 0003-Removed-example-in-wrong-place.patch |
26 |
Patch3: 0004-Remove-mvn-release-plugin.patch |
27 |
Patch4: 0005-Remove-mvn-source-plugin.patch |
28 |
Patch5: 0006-Remove-mvn-clirr-plugin.patch |
29 |
Patch6: 0007-Remove-mvn-rat-plugin.patch |
30 |
Patch7: 0008-Remove-ant-contrib-from-dependencies.patch |
31 |
Patch8: 0009-Remove-ant-run-of-tests.patch |
32 |
Patch9: 0010-Fix-javadoc-link.patch |
33 |
Patch10: 0011-Fix-ant-groupId.patch |
34 |
|
35 |
BuildRequires: perl |
36 |
BuildRequires: jpackage-utils >= 1.6 |
37 |
BuildRequires: ant |
38 |
BuildRequires: java-rpmbuild |
39 |
%if ! %{bootstrap} |
40 |
BuildRequires: geronimo-jaf-1_0_2-api |
41 |
BuildRequires: classpathx-mail |
42 |
BuildRequires: geronimo-jms-1_1-api |
43 |
BuildRequires: mx4j |
44 |
#!BuildIgnore: axis |
45 |
#!BuildIgnore: jakarta-commons-logging |
46 |
#!BuildIgnore: jakarta-commons-discovery |
47 |
%endif |
48 |
BuildRequires: jndi |
49 |
%if %defined suse_version |
50 |
BuildRequires: perl |
51 |
BuildRequires: java-devel |
52 |
BuildRequires: update-desktop-files |
53 |
PreReq: coreutils |
54 |
%else |
55 |
BuildRequires: java-javadoc |
56 |
%endif |
57 |
Requires: jpackage-utils >= 1.6 |
58 |
Requires: xml-commons-apis |
59 |
Requires: jaxp_parser_impl |
60 |
Group: Development/Java |
61 |
%if ! %{gcj_support} |
62 |
BuildArch: noarch |
63 |
%endif |
64 |
BuildRoot: %{_tmppath}/%{name}-%{version}-build |
65 |
%if %{gcj_support} |
66 |
#BuildRequires: java-gcj |
67 |
Requires(post): java-gcj-compat |
68 |
Requires(postun): java-gcj-compat |
69 |
%endif |
70 |
Requires: xml-commons-apis |
71 |
|
72 |
%description |
73 |
Log4j is a tool to help the programmer output log statements to a |
74 |
variety of output targets. |
75 |
|
76 |
%if ! %{bootstrap} |
77 |
%package manual |
78 |
Summary: Developer manual for %{name} |
79 |
Group: Books/Computer books |
80 |
Requires: %{name}-javadoc = %{version}-%{release} |
81 |
|
82 |
%description manual |
83 |
%{summary}. |
84 |
|
85 |
%package javadoc |
86 |
Summary: API documentation for %{name} |
87 |
Group: Books/Computer books |
88 |
Requires: jpackage-utils |
89 |
|
90 |
%description javadoc |
91 |
%{summary}. |
92 |
%endif |
93 |
|
94 |
%prep |
95 |
%setup -q -n apache-%{name}-%{version} |
96 |
# see patch files themselves for reasons for applying |
97 |
%patch0 -p1 -b .logfactor-home |
98 |
%patch1 -p1 -b .remove-dep-version |
99 |
%patch2 -p1 -b .remove-example |
100 |
%patch3 -p1 -b .remove-mvn-release |
101 |
%patch4 -p1 -b .remove-mvn-source |
102 |
%patch5 -p1 -b .remove-mvn-clirr |
103 |
%patch6 -p1 -b .remove-mvn-rat |
104 |
%patch7 -p1 -b .remove-and-contrib |
105 |
%patch8 -p1 -b .remove-tests |
106 |
%patch9 -p1 -b .xlink-javadoc |
107 |
%patch10 -p1 -b .ant-groupid |
108 |
|
109 |
sed -i 's/\r//g' LICENSE NOTICE site/css/*.css site/xref/*.css \ |
110 |
site/xref-test/*.css |
111 |
|
112 |
# fix encoding of mailbox files |
113 |
for i in contribs/JimMoore/mail*;do |
114 |
iconv --from=ISO-8859-1 --to=UTF-8 "$i" > new |
115 |
mv new "$i" |
116 |
done |
117 |
|
118 |
# remove all the stuff we'll build ourselves |
119 |
find . \( -name "*.jar" -o -name "*.class" \) -exec %__rm -f {} \; |
120 |
%__rm -rf docs/api |
121 |
|
122 |
|
123 |
%build |
124 |
# javac.source=1.1 doesn't work with Sun's 1.4.2_09/1.5.0_05 |
125 |
%ant \ |
126 |
-Djavamail.jar=$(build-classpath javamail/mailapi) \ |
127 |
-Dactivation.jar=$(build-classpath jaf) \ |
128 |
-Djaxp.jaxp.jar.jar=$(build-classpath jaxp_parser_impl) \ |
129 |
-Djms.jar=$(build-classpath jms) \ |
130 |
-Djmx.jar=$(build-classpath mx4j/mx4j) \ |
131 |
-Djmx-extra.jar=$(build-classpath mx4j/mx4j-tools) \ |
132 |
-Djndi.jar=$(build-classpath jndi) \ |
133 |
-Djavac.source=1.2 \ |
134 |
-Djdk.javadoc=%{_javadocdir}/java \ |
135 |
jar \ |
136 |
%if ! %{bootstrap} |
137 |
javadoc |
138 |
%endif |
139 |
|
140 |
%install |
141 |
%__rm -rf %{buildroot} |
142 |
# jars |
143 |
%__mkdir_p %{buildroot}%{_javadir} |
144 |
%__cp -a dist/lib/log4j-%{version}.jar %{buildroot}%{_javadir} |
145 |
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done) |
146 |
%if ! %{bootstrap} |
147 |
# javadoc |
148 |
%__mkdir_p %{buildroot}%{_javadocdir}/%{name}-%{version} |
149 |
%__cp -a docs/api/* %{buildroot}%{_javadocdir}/%{name}-%{version} |
150 |
(cd %{buildroot}%{_javadocdir} && %__ln_s %{name}-%{version} %{name}) |
151 |
%__rm -rf docs/api |
152 |
ln -s %{_javadocdir}/log4j docs/api |
153 |
%endif |
154 |
# scripts |
155 |
%__mkdir_p %{buildroot}%{_bindir} |
156 |
%__install -p -m 755 %{SOURCE2} %{buildroot}%{_bindir}/logfactor5 |
157 |
%__install -p -m 755 %{SOURCE5} %{buildroot}%{_bindir}/chainsaw |
158 |
# freedesktop.org menu entries and icons |
159 |
%__mkdir_p %{buildroot}%{_datadir}/{applications,pixmaps} |
160 |
%__cp -a %{SOURCE3} \ |
161 |
%{buildroot}%{_datadir}/applications/jpackage-logfactor5.desktop |
162 |
%__cp -a %{SOURCE6} \ |
163 |
%{buildroot}%{_datadir}/applications/jpackage-chainsaw.desktop |
164 |
# freedesktop.org menu entries and icons |
165 |
install -pD -T -m 755 %{SOURCE1} \ |
166 |
%{buildroot}%{_datadir}/pixmaps/logfactor5.png |
167 |
desktop-file-install \ |
168 |
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications \ |
169 |
%{SOURCE3} |
170 |
|
171 |
install -pD -T -m 755 %{SOURCE4} \ |
172 |
%{buildroot}%{_datadir}/pixmaps/chainsaw.png |
173 |
desktop-file-install \ |
174 |
--dir=${RPM_BUILD_ROOT}%{_datadir}/applications \ |
175 |
%{SOURCE6} |
176 |
|
177 |
|
178 |
# DTD and the SGML catalog (XML catalog handled in scriptlets) |
179 |
install -pD -T -m 644 src/main/javadoc/org/apache/log4j/xml/doc-files/log4j.dtd \ |
180 |
%{buildroot}%{_datadir}/sgml/%{name}/log4j.dtd |
181 |
install -pD -T -m 644 %{SOURCE7} \ |
182 |
%{buildroot}%{_datadir}/sgml/%{name}/catalog |
183 |
|
184 |
# fix perl location |
185 |
%__perl -p -i -e 's|/opt/perl5/bin/perl|%{__perl}|' \ |
186 |
contribs/KitchingSimon/udpserver.pl |
187 |
|
188 |
|
189 |
%post |
190 |
%update_maven_depmap |
191 |
# Note that we're using versioned catalog, so this is always ok. |
192 |
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then |
193 |
%{_bindir}/install-catalog --add \ |
194 |
%{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \ |
195 |
%{_datadir}/sgml/%{name}/catalog > /dev/null || : |
196 |
fi |
197 |
if [ -x %{_bindir}/xmlcatalog -a -w %{_sysconfdir}/xml/catalog ]; then |
198 |
%{_bindir}/xmlcatalog --noout --add system log4j.dtd \ |
199 |
file://%{_datadir}/sgml/%{name}/log4j.dtd %{_sysconfdir}/xml/catalog \ |
200 |
> /dev/null || : |
201 |
fi |
202 |
|
203 |
|
204 |
%preun |
205 |
if [ $1 -eq 0 ]; then |
206 |
if [ -x %{_bindir}/xmlcatalog -a -w %{_sysconfdir}/xml/catalog ]; then |
207 |
%{_bindir}/xmlcatalog --noout --del log4j.dtd \ |
208 |
%{_sysconfdir}/xml/catalog > /dev/null || : |
209 |
fi |
210 |
fi |
211 |
|
212 |
|
213 |
%postun |
214 |
%update_maven_depmap |
215 |
# Note that we're using versioned catalog, so this is always ok. |
216 |
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then |
217 |
%{_bindir}/install-catalog --remove \ |
218 |
%{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \ |
219 |
%{_datadir}/sgml/%{name}/catalog > /dev/null || : |
220 |
fi |
221 |
|
222 |
%pre javadoc |
223 |
# workaround rpm bug, can be removed in F-17 |
224 |
[ $1 -gt 1 ] && [ -L %{_javadocdir}/%{name} ] && \ |
225 |
rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || : |
226 |
|
227 |
%files |
228 |
%defattr(-,root,root,-) |
229 |
%doc LICENSE |
230 |
%doc NOTICE |
231 |
%{_bindir}/* |
232 |
%{_javadir}/* |
233 |
%{_datadir}/applications/* |
234 |
%{_datadir}/pixmaps/* |
235 |
%{_datadir}/sgml/%{name} |
236 |
%if %{gcj_support} |
237 |
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{name}-%{version}.jar.* |
238 |
%endif |
239 |
%if ! %{bootstrap} |
240 |
|
241 |
%files manual |
242 |
%defattr(0644,root,root,0755) |
243 |
%doc docs/* contribs |
244 |
|
245 |
%files javadoc |
246 |
%defattr(0644,root,root,0755) |
247 |
%dir %{_javadocdir}/%{name}-%{version} |
248 |
%{_javadocdir}/%{name}-%{version}/* |
249 |
%ghost %dir %{_javadocdir}/%{name} |
250 |
%endif |