File jakarta-commons-discovery.spec of Package jakarta-commons-discovery

#
# spec file for package jakarta-commons-discovery (Version 0.4)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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/
#

# norootforbuild
# icecream 0

%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}
%define short_name commons-discovery
%define section    free
Summary:        Jakarta Commons Discovery

Name:           jakarta-commons-discovery
Version:        0.4
Release:        106
Group:          Development/Libraries/Java
License:        The Apache Software License
Url:            http://jakarta.apache.org/commons/discovery.html
%if ! %{gcj_support}
BuildArch:      noarch
%endif
Source0:        http://www.apache.org/dist/jakarta/commons/discovery/source/commons-discovery-0.4-src.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  jpackage-utils >= 1.6
BuildRequires:  ant
BuildRequires:  junit >= 3.7
BuildRequires:  jakarta-commons-logging >= 1.0.4
Requires:       jakarta-commons-logging >= 1.0.4
%if %{gcj_support}
BuildRequires:  java-gcj-compat-devel
Requires(post):         java-gcj-compat
Requires(postun):       java-gcj-compat
%endif
%if %defined suse_version
BuildRequires:  java-devel
%endif

%description
The Discovery component is about discovering, or finding,
implementations for pluggable interfaces.  Pluggable interfaces are
specified with the intent that multiple implementations are, or will
be, available to provide the service described by the interface. 
Discovery provides facilities for finding and instantiating classes and
for lifecycle management of singleton (factory) classes.



%package javadoc
License:        The Apache Software License
PreReq:         coreutils
Group:          Development/Libraries/Java
Summary:        Javadoc for jakarta-commons-discovery
Requires(post): /bin/rm /bin/ln
Requires(postun): /bin/rm

%description javadoc
The Discovery component is about discovering, or finding,
implementations for pluggable interfaces.  Pluggable interfaces are
specified with the intent that multiple implementations are, or will
be, available to provide the service described by the interface. 
Discovery provides facilities for finding and instantiating classes,
and for lifecycle management of singleton (factory) classes.

This package contains the javadoc documentation for the Jakarta Commons
Discovery Package.



%prep
%setup -q -n commons-discovery-%{version}-src
chmod u+w .
# -----------------------------------------------------------------------------

%build
ant \
  -Djunit.jar=%(find-jar junit) \
  -Dlogger.jar=%(find-jar jakarta-commons-logging) \
  -Dant.build.javac.target=1.4 \
  -Dant.build.javac.source=1.4 \
  test.discovery dist
# -----------------------------------------------------------------------------

%install
# jar
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p dist/%{short_name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && ln -s %{name}-%{version}.jar %{short_name}-%{version}.jar && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed  "s|-%{version}||g"`; done)
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink
# -----------------------------------------------------------------------------
%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

%clean
rm -rf $RPM_BUILD_ROOT
# -----------------------------------------------------------------------------

%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ "$1" = "0" ]; then
  rm -f %{_javadocdir}/%{name}
fi
%if %{gcj_support}

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

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

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/*

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

%changelog
* Thu Mar 13 2008 mvyskocil@suse.cz
- merged with jpackage 1.7
- update to 0.4
* Mon Sep 25 2006 skh@suse.de
- don't use icecream
- use source="1.4" and target="1.4" for build with java 1.5
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Jul 27 2005 jsmeix@suse.de
- Adjustments in the spec file.
* Mon Jul 18 2005 jsmeix@suse.de
- Current version 0.3 from JPackage.org
* Mon Sep 06 2004 skh@suse.de
- Initial package created with version 0.2 (JPackage 1.5)