File findbugs.spec of Package findbugs
#
# spec file for package findbugs
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%bcond_with bundled_jformatstring
%global _iconsdir %{_datadir}/icons/
Name: findbugs
Version: 1.3.9
Release: 0
Summary: Bug Pattern Detector for Java
License: LGPL-2.1+
Group: Development/Languages/Java
Url: http://findbugs.sourceforge.net/
Source0: http://download.sourceforge.net/findbugs/findbugs-%{version}-source-suse.tar.bz2
Source1: findbugs-ant
Source2: findbugs-tools-README
# Versions will be fixed in a patch
Source3: http://repo1.maven.org/maven2/net/sourceforge/findbugs/findbugs/1.3.7/findbugs-1.3.7.pom
Source4: http://repo1.maven.org/maven2/net/sourceforge/findbugs/annotations/1.3.2/annotations-1.3.2.pom
Source10: findbugs-16x16.png
Source11: findbugs-32x32.png
Source12: findbugs-48x48.png
Source13: findbugs.desktop
Source1000: README.manual
# This patch has not been submitted upstream, as it contains Fedora-specific
# changes. It looks in /usr/share/java for jar files at both compile time and
# run time, instead of in findbugs' lib directory.
Patch0: findbugs-1.3.9-build.patch
# Build against ASM 3.3 instead of 3.1. Already changed upstream; see:
# http://code.google.com/p/findbugs/source/detail?r=12605
# http://code.google.com/p/findbugs/source/detail?r=12606
Patch1: findbugs-asm-version.patch
%define asm_version 3.3
# Updates the version information in POMs, as we don't have up to date POM's :(
Patch2: findbugs-1.3.9-pom.patch
# Fedora-specific patch: use Fedora JAR filenames
Patch3: findbugs-jar-filenames.patch
# Fedora-specific patch to cope with removal of Class-Path & Main-Class entries
# from findbugs.jar manifest
Patch4: findbugs-remove-classpath.patch
# Fedora-specific patch to allow FindBugs launcher scripts to be run from
# /bin or /usr/bin (#848612)
Patch5: findbugs-home.patch
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
Requires: dom4j
Requires: findbugs-bcel
Requires: jakarta-commons-lang >= 2.4
Requires: java >= 1.6.0
Requires: jaxen
Requires: jcip-annotations
Requires: objectweb-asm >= 3.0
%if %without bundled_jformatstring
Requires: jformatstring
%endif
Requires: javapackages-tools
Requires: jsr-305
BuildRequires: ant >= 1.6.5
BuildRequires: ant-junit
BuildRequires: ant-nodeps
BuildRequires: desktop-file-utils
BuildRequires: dom4j
BuildRequires: findbugs-bcel
BuildRequires: jakarta-commons-lang >= 2.4
BuildRequires: java-devel >= 1.6.0
BuildRequires: jaxen
BuildRequires: jcip-annotations
BuildRequires: jdepend
%if %without bundled_jformatstring
BuildRequires: jformatstring
%endif
BuildRequires: fdupes
BuildRequires: javapackages-tools
BuildRequires: jsr-305
BuildRequires: junit4
BuildRequires: objectweb-asm >= 3.0
#FIXME: can't install buildroot with texlive-latex
#BuildRequires: texlive-latex
BuildRequires: update-desktop-files
# owns /usr/share/icons/hicolor
BuildRequires: hicolor-icon-theme
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
FindBugs is a program to find bugs in Java programs. It looks for
instances of ``bug patterns''---code instances that are likely to be
errors.
%package -n ant-findbugs
Summary: Ant task for findbugs
Group: Development/Languages/Java
Requires: %{name} = %{version}-%{release}
Requires: ant
Provides: %{name}:%{_sysconfdir}/ant.d/%{name}
%description -n ant-findbugs
This package defines an ant task for findbugs for easy integration of findbugs
into your ant-controlled project.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
%description javadoc
%{summary}.
%package tools
Summary: Addon tools for findbugs
Group: Development/Languages/Java
Requires: %{name} = %{version}-%{release}
Requires: junit4
%description tools
This package contains additional tools for use with findbugs. See
README.tools for more information.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
cp -p %{SOURCE2} README.tools
cp -p %{SOURCE3} findbugs.pom
cp -p %{SOURCE4} annotations.pom
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%{_bindir}/find . -name "*.bat" | %{_bindir}/xargs -t %{__rm}
%if %with bundled_jformatstring
# FIXME: (dwalluck): standalone source code is at
# <https://jformatstring.dev.java.net/>, but using bundled source
# for now
%{__unzip} -qq -d jFormatString lib/jFormatString.jar
pushd jFormatString/
%{_bindir}/find -name "*.class" | %{_bindir}/xargs -t %{__rm}
%{javac} `%{_bindir}/find -name "*.java"`
%{jar} cfm ../lib/jFormatString.jar.no META-INF/MANIFEST.MF .
popd
%{__rm} -r jFormatString/
%endif
find -name "*.jar" \
%if %with bundled_jformatstring
-and -not -name jFormatString.jar \
%endif
| %{_bindir}/xargs -t %{__rm}
# Use the system jcip-annotations instead of building it in
rm -fr src/java5/net
# Get rid of code for Mac OS X that depends on a jar from Apple
rm -f src/java/edu/umd/cs/findbugs/gui/OSXAdapter.java
rm -f src/java5/edu/umd/cs/findbugs/gui2/OSXAdapter.java
# Turn on the executable bits for some auxiliary scripts
chmod a+x etc/summarizeBugs etc/diffBugSummaries design/architecture/mkdep.pl
# Remove Class-Path & Main-Class entries from findbugs.jar manifest
sed -i '/class-path/I d' etc/MANIFEST-findbugs.MF
sed -i '/Main-Class/ d' etc/MANIFEST-findbugs.MF
cp %{SOURCE1000} .
%build
if [ `uname -m` = "ppc64" ];then
export ANT_OPTS="-Xss2m"
else
export ANT_OPTS="-Xss1m"
fi
# Build the class files
ant
# Build the javadocs
ant apiJavadoc
# Build the architecture PDF
#pushd design/architecture
#make depend
#make
#popd
# Package up the tools
cd build/classes
jar cf ../../lib/findbugs-tools.jar edu/umd/cs/findbugs/tools
%install
# Install jars
mkdir -p %{buildroot}%{_javadir}/
cp lib/annotations.jar lib/%{name}-annotations.jar
cp -p \
lib/%{name}.jar \
lib/%{name}-ant.jar \
lib/%{name}-annotations.jar \
lib/%{name}-tools.jar \
%if %with bundled_jformatstring
lib/jFormatString.jar \
%endif
%{buildroot}%{_javadir}/
# Install the ant task
mkdir -p %{buildroot}%{_javadir}/ant
cp -p lib/%{name}-ant.jar $RPM_BUILD_ROOT%{_javadir}/ant/ant-%{name}-%{version}.jar
ln -s ant-%{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/ant/ant-%{name}.jar
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ant.d
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/ant.d/%{name}
# Install the javadocs
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}
cp -a apiJavaDoc $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# Install the scripts
mkdir -p $RPM_BUILD_ROOT%{_bindir}
for f in $(find bin -maxdepth 1 -type f \! -name '*.bat'); do
cp -p $f $RPM_BUILD_ROOT%{_bindir}
done
# Install the shared files
mkdir -p $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -a etc plugin $RPM_BUILD_ROOT%{_datadir}/%{name}
# Install poms
mkdir -p $RPM_BUILD_ROOT%{_mavenpomdir}
cp findbugs.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
cp annotations.pom $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}-annotations.pom
# Add depmaps
echo add_maven_depmap JPP-%{name}.pom %{name}.jar
%add_maven_depmap JPP-%{name}.pom %{name}.jar
echo add_maven_depmap JPP-%{name}-annotations.pom %{name}-annotations.jar
%add_maven_depmap JPP-%{name}-annotations.pom %{name}-annotations.jar
mkdir -p %{buildroot}%{_datadir}/applications
install -D -p -m 644 %{SOURCE10} %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
install -D -p -m 644 %{SOURCE11} %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
install -D -p -m 644 %{SOURCE12} %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
install -D -p -m 644 %{SOURCE13} %{buildroot}%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file -i %{name}
%fdupes -s %{buildroot}
%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt README.txt design
%attr(0755,root,root) %{_bindir}/*
%{_datadir}/%{name}
%dir %{_iconsdir}/hicolor/
%{_iconsdir}/hicolor/16x16/apps/findbugs.png
%{_iconsdir}/hicolor/32x32/apps/findbugs.png
%{_iconsdir}/hicolor/48x48/apps/findbugs.png
%{_mavenpomdir}/*
%config %{_mavendepmapfragdir}/%{name}
%{_datadir}/applications/*%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-annotations.jar
%files -n ant-findbugs
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/ant/*
%config(noreplace) %{_sysconfdir}/ant.d/%{name}
%{_javadir}/%{name}-ant.jar
%files javadoc
%defattr(0644,root,root,0755)
%doc README.manual
%{_javadocdir}/%{name}
%files tools
%doc LICENSE.txt README.tools
%{_javadir}/findbugs-tools*
%changelog