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

#
# spec file for package jakarta-commons-fileupload (Version 1.1.1)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# 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 base_name fileupload
%define short_name commons-%{base_name}
%define section free

Name:           jakarta-commons-fileupload
Version:        1.1.1
Release:        1
Summary:        Jakarta Commons FileUpload Package
Group:          Development/Libraries/Java
License:        The Apache Software License
Url:            http://jakarta.apache.org/commons/fileupload/
Source0:        http://www.apache.org/dist/jakarta/commons/fileupload/source/commons-fileupload-1.1.1-src.tar.gz
Patch0:         %{name}-build_xml.patch
Patch1:         %{name}-%{version}-servletapi5.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if ! %{gcj_support}
BuildArch:      noarch
%endif
BuildRequires:  ant
BuildRequires:  ant-junit
BuildRequires:  jakarta-commons-io
BuildRequires:  jpackage-utils >= 1.6
BuildRequires:  junit >= 3.8.1
BuildRequires:  portlet-1.0-api
BuildRequires:  servletapi5
%if %defined suse_version
BuildRequires:  unzip
BuildRequires:  java-devel
%endif
%if %{gcj_support}
BuildRequires:  java-gcj-compat-devel
Requires(post):         java-gcj-compat
Requires(postun):       java-gcj-compat
%endif
Requires:       servletapi5
Requires:       jpackage-utils >= 1.6
Provides:       %{short_name}
Obsoletes:      %{short_name}

%description
The javax.servlet package lacks support for RFC 1867, HTML file upload.
 This package provides a simple-to-use API for working with such data. 
The scope of this package is to create a package of Java utility
classes to read multipart/form-data within a
javax.servlet.http.HttpServletRequest.



%package        javadoc
PreReq:         coreutils
Summary:        Javadoc for jakarta-commons-fileupload
Group:          Development/Libraries/Java

%description    javadoc
The javax.servlet package lacks support for rfc 1867, html file upload.
 This package provides a simple to use api for working with such data. 
The scope of this package is to create a package of Java utility
classes to read multipart/form-data within a
javax.servlet.http.HttpServletRequest.

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



%prep
%setup -q -n %{short_name}-%{version}
%patch0 -b .build.xml
%patch1 -p0 -b .servletapi5
# -----------------------------------------------------------------------------

%build
export CLASSPATH="$(build-classpath commons-io junit portlet-1.0-api \
    servletapi5):${PWD}/target/classes:${PWD}/target/test-classes"
ant \
    -Dbuild.sysclasspath=only \
    -Dfinal.name=%{name}-%{version} \
    -Dservletapi.javadoc=%{_javadocdir}/servletapi5 \
    -Dant.build.javac.source=1.4 -Dant.build.javac.target=1.4 \
    dist
# -----------------------------------------------------------------------------

%install
%{__rm} -rf $RPM_BUILD_ROOT
# jars
%{__mkdir} -p $RPM_BUILD_ROOT%{_javadir}
%{__cp} -p dist/%{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}
(
    cd $RPM_BUILD_ROOT%{_javadir} && \
    for jar in *-%{version}*; do
        %{__ln_s} -f ${jar} `echo $jar | %{__sed} "s|jakarta-||g"`
    done
)
(
    cd $RPM_BUILD_ROOT%{_javadir} && \
    for jar in *-%{version}*; do
        %{__ln_s} -f ${jar} `echo $jar | %{__sed} "s|-%{version}||g"`
    done
)
# javadoc
%{__mkdir} -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%{__cp} -pr dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

%clean
%{__rm} -rf $RPM_BUILD_ROOT
# -----------------------------------------------------------------------------
%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 NOTICE.txt RELEASE-NOTES.txt
%{_javadir}/*
%if %{gcj_support}
%attr(-,root,root) %dir %{_libdir}/gcj/%{name}
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{name}-%{version}.jar.*
%endif

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

%changelog
* Thu Mar 13 2008 mvyskocil@suse.cz
- merged with jpackage 1.7
- update to 1.1.1
* Fri Sep 22 2006 skh@suse.de
- don't use icecream
- use target="1.4" for build with java 1.5
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Oct 18 2005 jsmeix@suse.de
- Current version 1.0 from JPackage.org
* Thu Sep 29 2005 dmueller@suse.de
- add norootforbuild
* Fri Sep 17 2004 skh@suse.de
- Fix prerequires of javadoc subpackage
* Sun Sep 05 2004 skh@suse.de
- Initial package created with version 1.0 (JPackage 1.5)
openSUSE Build Service is sponsored by