%global with_gcj %{!?_without_gcj:1}%{?_without_gcj:0}
%global cvs_ver 20100217
Name: jai-imageio-core
Version: 1.2
Release: 0.4.%{cvs_ver}cvs%{?dist}
Summary: Core Java Advanced Imaging Image I/O Tools API
Group: System Environment/Libraries
License: BSD
URL: https://jai-imageio.dev.java.net/
Source0: jai-imageio-core-cvs%{cvs_ver}-CLEANED.tar.xz
Source1: README-fedora-epel.txt
# jai-imageio-core contains code under a restrictive licence that we
# cannot ship. This script will download and generate a tarball from
# CVS. Unfortunately, a login is required to download from CVS and
# there are no source tarballs.
#
# Register at:
# https://www.dev.java.net/servlets/Join
#
# Then, run:
# ./generate-tarball.sh USERNAME DATE
Source2: generate-tarball.sh
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: java-devel libgcj-devel ant jpackage-utils
BuildRequires: recode
Requires: java jpackage-utils
Patch0: jai-imageio-core-remove-imageio-services.patch
Patch1: jai-imageio-core-remove-codeclib-plugins.patch
Patch2: jai-imageio-core-remove-jai-operations.patch
Patch3: jai-imageio-core-remove-jpeg2000-plugin.patch
Patch4: jai-imageio-core-no-sun-classes.patch
%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 package contains the core Java Advanced Imaging Image I/O Tools API,
minus JPEG 2000, JAI Image I/O operations, and the C-based codecLib.
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
Requires: jpackage-utils
BuildArch: noarch
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n jai-imageio-core-cvs%{cvs_ver}-CLEANED
find -name '*.class' -exec rm -f '{}' \;
find -name '*.jar' -exec rm -f '{}' \;
# remove unbuildable items
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
# remove use of sun.*
# https://jai-imageio-core.dev.java.net/issues/show_bug.cgi?id=186
%patch4 -p0
# fix latin-1 documentation
recode latin1..utf-8 COPYRIGHT.txt
# install our documentation
cp -av %{SOURCE1} .
%build
# note: BUILD_TARGET is pretty much ignored, but we need it
# to know where the built files will be located
ant -DBUILD_TARGET=linux-i586 jar-opt docs-jcp
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_javadir}
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -av build/linux-i586/opt/lib/ext/jai_imageio.jar $RPM_BUILD_ROOT%{_javadir}/jai_imageio-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
cp -av build/linux-i586/javadocs/docs-jcp/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%if %{with_gcj}
%{_bindir}/aot-compile-rpm
%endif
%if %{with_gcj}
%post
if [ -x %{_bindir}/rebuild-gcj-db ]
then
%{_bindir}/rebuild-gcj-db
fi
%endif
%if %{with_gcj}
%postun
if [ -x %{_bindir}/rebuild-gcj-db ]
then
%{_bindir}/rebuild-gcj-db
fi
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc LICENSE.txt COPYRIGHT.txt README-fedora-epel.txt
%{_javadir}/*.jar
%if %{with_gcj}
%{_libdir}/gcj/%{name}
%endif
%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}
%changelog
* Thu Feb 18 2010 Adam Goode <adam@spicenitz.org> - 1.2-0.4.20100217cvs
- First Fedora release
* Wed Feb 3 2010 Adam Goode <adam@spicenitz.org> - 1.2-0.3.20100202cvs
- Update generate-tarball.sh to canonicalize owner/group and date
* Mon Jan 11 2010 Adam Goode <adam@spicenitz.org> - 1.2-0.2.20100111cvs
- Add generate-tarball.sh
* Wed Nov 11 2009 Adam Goode <adam@spicenitz.org> - 1.2-0.1.20091111cvs
- Initial release