File jformatstring.spec of Package jformatstring

#
# spec file for package jformatstring (Version 0)
#
# Copyright (c) 2010 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/
#


%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}

%bcond_with gcj_support

%if %with gcj_support
%define gcj_support 1
%else
%define gcj_support 0
%endif

Name:           jformatstring
Version:        0
Release:        1
Summary:        Java library for format string checks
Group:          Development/Libraries/Java
License:        GPLv2
Url:            https://jformatstring.dev.java.net/
# svn -q export -r 8 https://jformatstring.dev.java.net/svn/jformatstring/trunk/jFormatString jformatstring-0 --username guest --password guest && tar cjf jformatstring-0.tar.bz2 jformatstring-0
Source0:        jformatstring-0.tar.bz2
Provides:       jFormatString = %{version}-%{release}
Obsoletes:      jFormatString < %{version}-%{release}
BuildRequires:  ant
BuildRequires:  java-devel
BuildRequires:  java-javadoc
BuildRequires:  jpackage-utils
BuildRequires:  junit4
%if %{gcj_support}
BuildRequires:  java-gcj-compat-devel
%else
BuildArch:      noarch
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This project is derived from Sun's implementation of java.util.Formatter. It 
is designed to allow compile time checks as to whether or not a use of format 
string will be erronous when executed at runtime.

This code is derived from the OpenJDK implementation, jdk1.7.0-b35. As such, 
it is licensed under the same license as OpenJDK, GPL v2 + the Classpath 
exception.

This project is preliminary, and the API is subject to change. The library 
produced by compiling this project is used by the FindBugs project. To avoid 
any licensing questions due to incompatible licenses (FindBugs is licensed 
under the LGPL), it is broken out as a separate project. While there may be 
some confusion/discussion about the licenses, the FindBugs project does not 
interpret the FindBugs LGPL license to be any stronger than GPL v2 + the 
Classpath exception.

%package javadoc
License:        GPLv2
Summary:        Javadoc for %{name}
Group:          Development/Documentation
Requires:       java-javadoc

%description javadoc
Javadoc for %{name}.

%prep
%setup -q

mkdir lib
pushd lib
%{__ln_s} $(build-classpath junit4)
popd

%build
export CLASSPATH=
export OPT_JAR_LIST=:
%{ant}
%{javadoc} -d javadoc \
           -source 1.5 \
           -sourcepath src/java \
           -classpath build/classes:$(build-classpath junit4) \
           -link %{_javadocdir}/java \
           edu.umd.cs.findbugs.formatStringChecker

%install
%{__rm} -rf %{buildroot}

%{__mkdir_p} %{buildroot}%{_javadir}
%{__cp} -p build/jFormatString.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
%{__ln_s} %{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
%{__ln_s} %{name}-%{version}.jar %{buildroot}%{_javadir}/jFormatString-%{version}.jar
%{__ln_s} jFormatString-%{version}.jar %{buildroot}%{_javadir}/jFormatString.jar

%{__mkdir_p} %{buildroot}%{_javadocdir}/%{name}-%{version}
%{__cp} -pr javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version}
%{__ln_s} %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}
%{__ln_s} %{name}-%{version} %{buildroot}%{_javadocdir}/jFormatString-%{version}
%{__ln_s} jFormatString-%{version} %{buildroot}%{_javadocdir}/jFormatString

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

%clean
%{__rm} -rf %{buildroot}

%if %{gcj_support}

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

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

%files
%defattr(0644,root,root,0755)
%doc LICENSE
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar
%{_javadir}/jFormatString-%{version}.jar
%{_javadir}/jFormatString.jar
%if %{gcj_support}
%dir %{_libdir}/gcj/%{name}
%attr(-,root,root) %{_libdir}/gcj/%{name}/*
%endif

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}
%{_javadocdir}/jFormatString-%{version}
%{_javadocdir}/jFormatString

%changelog