Blob Blame History Raw
# This is a version of BCEL that has been modified by the findbugs team.  They
# added some new functionality and also did some performance optimizations of
# the base code.  I am not producing a new manual, since we already have a
# bcel-manual package and the findbugs team did not patch the manual.  However,
# the javadoc package is necessary to show the changes in the API created by
# the findbug team's work.

%define findbugsver 1.3.7
%define with_gcj %{!?_without_gcj:1}%{?_without_gcj:0}

Name:           findbugs-bcel
Version:        5.2
Release:        %{findbugsver}%{?dist}.1
Summary:        Byte Code Engineering Library with findbugs extensions

Group:          Development/Libraries/Java
License:        ASL 2.0
URL:            http://jakarta.apache.org/bcel/
Source0:        http://www.apache.org/dist/jakarta/bcel/source/bcel-%{version}-src.tar.gz
# This patch is available in the findbugs release, in src/patches/bcel.diff.
Source1:        bcel.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  java-devel, jpackage-utils
Requires:       java, jpackage-utils

%if %{with_gcj}
BuildRequires:  java-gcj-compat-devel >= 1.0.31
Requires(post): java-gcj-compat >= 1.0.31
Requires(postun): java-gcj-compat >= 1.0.31
%else
BuildArch:      noarch
%endif

%description
This is a version of Apache's Byte Code Engineering Library (BCEL) that has
been modified by the findbugs developers.  The modifications add some new
functionality, and also introduce a number of performance optimizations to
address findbugs performance problems.  Some of the performance optimizations
induce API changes, so this version of BCEL is not compatible with the vanilla
upstream version.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation

%description javadoc
%{summary}.

%prep
%setup -q -n bcel-%{version}

# The -f option is necessary because the findbugs patch applies to two files
# that are present only in the bcel binary distribution, not in the source
# distribution.  The 'true' invocation is to mask the exit value of 1 that
# patch gives when it skips those two files.
%{__patch} -f -p7 -s < %{SOURCE1} || true

# The findbugs patch introduces a gratuitous import of a com.sun package.
%{__sed} -i \
  -e '/import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader/D' \
  src/java/org/apache/bcel/classfile/ConstantUtf8.java

%build
# The ant and maven builds both try to download unneeded jars
mkdir classes
find src/java -type f -name '*.java' | \
xargs javac -g -d classes -source 1.5 -encoding ISO8859-1
cd classes
jar cf findbugs-bcel-%{findbugsver}.jar org
cd ..

mkdir javadoc
find src/java -type f -name '*.java' | xargs javadoc -sourcepath src/java \
  -classpath classes -source 1.5 -encoding ISO8859-1 -d javadoc 

%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p classes/findbugs-bcel-%{findbugsver}.jar $RPM_BUILD_ROOT%{_javadir}
ln -s findbugs-bcel-%{findbugsver}.jar $RPM_BUILD_ROOT%{_javadir}/findbugs-bcel.jar

mkdir -p $RPM_BUILD_ROOT%{_javadocdir}
cp -a javadoc $RPM_BUILD_ROOT%{_javadocdir}/findbugs-bcel-%{findbugsver}
ln -s findbugs-bcel-%{findbugsver} $RPM_BUILD_ROOT%{_javadocdir}/findbugs-bcel

%if %{with_gcj}
%{_bindir}/aot-compile-rpm
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%post
%if %{with_gcj}
if [ -x %{_bindir}/rebuild-gcj-db ]; then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%postun
%if %{with_gcj}
if [ -x %{_bindir}/rebuild-gcj-db ]; then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%files
%defattr(-,root,root,-)
%doc LICENSE.txt NOTICE.txt README.txt
%{_javadir}/findbugs-bcel*
%if %{with_gcj}
%{_libdir}/gcj/%{name}
%endif

%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/findbugs-bcel*

%changelog
* Tue Jan 13 2009 Jerry James <loganjerry@gmail.com> - 5.2-1.3.7.1
- Add '-source 1.5' to the javac and javadoc invocations

* Fri Jan  2 2009 Jerry James <loganjerry@gmail.com> - 5.2-1.3.7
- Update to the findbugs 1.3.7 version of the BCEL patch

* Mon Dec  8 2008 Jerry James <loganjerry@gmail.com> - 5.2-1.3.6
- Update to the findbugs 1.3.6 version of the BCEL patch

* Thu Sep 18 2008 Jerry James <loganjerry@gmail.com> - 5.2-1.3.5
- Initial RPM