2877c9c
# This is a version of BCEL that has been modified by the findbugs team.  They
2877c9c
# added some new functionality and also did some performance optimizations of
2877c9c
# the base code.  I am not producing a new manual, since we already have a
2877c9c
# bcel-manual package and the findbugs team did not patch the manual.  However,
2877c9c
# the javadoc package is necessary to show the changes in the API created by
2877c9c
# the findbug team's work.
2877c9c
2877c9c
%define findbugsver 1.3.7
2877c9c
%define with_gcj %{!?_without_gcj:1}%{?_without_gcj:0}
2877c9c
2877c9c
Name:           findbugs-bcel
2877c9c
Version:        5.2
2877c9c
Release:        %{findbugsver}%{?dist}.1
2877c9c
Summary:        Byte Code Engineering Library with findbugs extensions
2877c9c
2877c9c
Group:          Development/Libraries/Java
2877c9c
License:        ASL 2.0
2877c9c
URL:            http://jakarta.apache.org/bcel/
2877c9c
Source0:        http://www.apache.org/dist/jakarta/bcel/source/bcel-%{version}-src.tar.gz
2877c9c
# This patch is available in the findbugs release, in src/patches/bcel.diff.
2877c9c
Source1:        bcel.diff
2877c9c
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
2877c9c
2877c9c
BuildRequires:  java-devel, jpackage-utils
2877c9c
Requires:       java, jpackage-utils
2877c9c
2877c9c
%if %{with_gcj}
2877c9c
BuildRequires:  java-gcj-compat-devel >= 1.0.31
2877c9c
Requires(post): java-gcj-compat >= 1.0.31
2877c9c
Requires(postun): java-gcj-compat >= 1.0.31
2877c9c
%else
2877c9c
BuildArch:      noarch
2877c9c
%endif
2877c9c
2877c9c
%description
2877c9c
This is a version of Apache's Byte Code Engineering Library (BCEL) that has
2877c9c
been modified by the findbugs developers.  The modifications add some new
2877c9c
functionality, and also introduce a number of performance optimizations to
2877c9c
address findbugs performance problems.  Some of the performance optimizations
2877c9c
induce API changes, so this version of BCEL is not compatible with the vanilla
2877c9c
upstream version.
2877c9c
2877c9c
%package javadoc
2877c9c
Summary:        Javadoc for %{name}
2877c9c
Group:          Development/Documentation
2877c9c
2877c9c
%description javadoc
2877c9c
%{summary}.
2877c9c
2877c9c
%prep
2877c9c
%setup -q -n bcel-%{version}
2877c9c
2877c9c
# The -f option is necessary because the findbugs patch applies to two files
2877c9c
# that are present only in the bcel binary distribution, not in the source
2877c9c
# distribution.  The 'true' invocation is to mask the exit value of 1 that
2877c9c
# patch gives when it skips those two files.
2877c9c
%{__patch} -f -p7 -s < %{SOURCE1} || true
2877c9c
2877c9c
# The findbugs patch introduces a gratuitous import of a com.sun package.
2877c9c
%{__sed} -i \
2877c9c
  -e '/import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader/D' \
2877c9c
  src/java/org/apache/bcel/classfile/ConstantUtf8.java
2877c9c
2877c9c
%build
2877c9c
# The ant and maven builds both try to download unneeded jars
2877c9c
mkdir classes
2877c9c
find src/java -type f -name '*.java' | \
2877c9c
xargs javac -g -d classes -source 1.5 -encoding ISO8859-1
2877c9c
cd classes
2877c9c
jar cf findbugs-bcel-%{findbugsver}.jar org
2877c9c
cd ..
2877c9c
2877c9c
mkdir javadoc
2877c9c
find src/java -type f -name '*.java' | xargs javadoc -sourcepath src/java \
2877c9c
  -classpath classes -source 1.5 -encoding ISO8859-1 -d javadoc 
2877c9c
2877c9c
%install
2877c9c
rm -rf $RPM_BUILD_ROOT
2877c9c
2877c9c
mkdir -p $RPM_BUILD_ROOT%{_javadir}
2877c9c
cp -p classes/findbugs-bcel-%{findbugsver}.jar $RPM_BUILD_ROOT%{_javadir}
2877c9c
ln -s findbugs-bcel-%{findbugsver}.jar $RPM_BUILD_ROOT%{_javadir}/findbugs-bcel.jar
2877c9c
2877c9c
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}
2877c9c
cp -a javadoc $RPM_BUILD_ROOT%{_javadocdir}/findbugs-bcel-%{findbugsver}
2877c9c
ln -s findbugs-bcel-%{findbugsver} $RPM_BUILD_ROOT%{_javadocdir}/findbugs-bcel
2877c9c
2877c9c
%if %{with_gcj}
2877c9c
%{_bindir}/aot-compile-rpm
2877c9c
%endif
2877c9c
2877c9c
%clean
2877c9c
rm -rf $RPM_BUILD_ROOT
2877c9c
2877c9c
%post
2877c9c
%if %{with_gcj}
2877c9c
if [ -x %{_bindir}/rebuild-gcj-db ]; then
2877c9c
  %{_bindir}/rebuild-gcj-db
2877c9c
fi
2877c9c
%endif
2877c9c
2877c9c
%postun
2877c9c
%if %{with_gcj}
2877c9c
if [ -x %{_bindir}/rebuild-gcj-db ]; then
2877c9c
  %{_bindir}/rebuild-gcj-db
2877c9c
fi
2877c9c
%endif
2877c9c
2877c9c
%files
2877c9c
%defattr(-,root,root,-)
2877c9c
%doc LICENSE.txt NOTICE.txt README.txt
2877c9c
%{_javadir}/findbugs-bcel*
2877c9c
%if %{with_gcj}
2877c9c
%{_libdir}/gcj/%{name}
2877c9c
%endif
2877c9c
2877c9c
%files javadoc
2877c9c
%defattr(-,root,root,-)
2877c9c
%{_javadocdir}/findbugs-bcel*
2877c9c
2877c9c
%changelog
2877c9c
* Tue Jan 13 2009 Jerry James <loganjerry@gmail.com> - 5.2-1.3.7.1
2877c9c
- Add '-source 1.5' to the javac and javadoc invocations
2877c9c
2877c9c
* Fri Jan  2 2009 Jerry James <loganjerry@gmail.com> - 5.2-1.3.7
2877c9c
- Update to the findbugs 1.3.7 version of the BCEL patch
2877c9c
2877c9c
* Mon Dec  8 2008 Jerry James <loganjerry@gmail.com> - 5.2-1.3.6
2877c9c
- Update to the findbugs 1.3.6 version of the BCEL patch
2877c9c
2877c9c
* Thu Sep 18 2008 Jerry James <loganjerry@gmail.com> - 5.2-1.3.5
2877c9c
- Initial RPM