File itext.spec of Package itext

#
# spec file for package itext (Version 1.4)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2005, 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 section free

Summary:        A Free Java-PDF library

Name:           itext
Version:        1.4
Release:        0.<RELEASE2>
License:        MOZILLA PUBLIC LICENSE (MPL/NPL)
Url:            http://www.lowagie.com/iText/
Group:          Development/Languages/Java
Source0:        itext-src-1.4.tar.gz
# svn export https://itext.svn.sourceforge.net/svnroot/itext/tags/iText_1_4 itext
# tar czf itext-src-1.4.tar.gz itext
Source2:        itext-1.3-manifest.mf
Source3:        %{name}.pom
Patch0:         %{name}-usefreesoftware.patch
BuildRequires:  jpackage-utils >= 1.6
BuildRequires:  ant
BuildRequires:  ant-trax
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
iText is a library that allows you to generate PDF files on the fly.
The iText classes are very useful for people who need to generate
read-only, platform independent documents containing text, lists,
tables and images. The library is especially useful in combination with
Java(TM) technology-based Servlets: The look and feel of HTML is
browser dependent; with iText and PDF you can control exactly how your
servlet's output will look.



%package javadoc
License:        MOZILLA PUBLIC LICENSE (MPL/NPL)
Summary:        A Free Java-PDF library
Group:          Development/Languages/Java

%description javadoc
iText is a library that allows you to generate PDF files on the fly.
The iText classes are very useful for people who need to generate
read-only, platform independent documents containing text, lists,
tables and images. The library is especially useful in combination with
Java(TM) technology-based Servlets: The look and feel of HTML is
browser dependent; with iText and PDF you can control exactly how your
servlet's output will look.



%{summary}.

%package manual
License:        MOZILLA PUBLIC LICENSE (MPL/NPL)
Summary:        A Free Java-PDF library
Group:          Development/Languages/Java

%description manual
iText is a library that allows you to generate PDF files on the fly.
The iText classes are very useful for people who need to generate
read-only, platform independent documents containing text, lists,
tables and images. The library is especially useful in combination with
Java(TM) technology-based Servlets: The look and feel of HTML is
browser dependent; with iText and PDF you can control exactly how your
servlet's output will look.



%{summary}.

%prep
%setup -q -n %{name}
mkdir -p src/META-INF
cp %{SOURCE2} src/META-INF/MANIFEST.MF
find . -name "*.jar" -exec rm {} \;

%patch0

%build
pushd src
export OPT_JAR_LIST="ant/ant-trax"
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 jar javadoc tutorial lowagie.com
popd

%install

# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}/itext
cp -p build/bin/iText.jar \
      $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && 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 build/docs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink

# manual
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr build/lowagie/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr build/examples $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr build/tutorial $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}

# Install the pom
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
cp -pr %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.itext.pom
%add_to_maven_depmap itext itext 1.3 JPP itext
%add_to_maven_depmap com.lowagie itext 1.3 JPP itext

%clean
rm -rf $RPM_BUILD_ROOT

%post
%update_maven_depmap

%postun
%update_maven_depmap

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

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

%files
%defattr(0644,root,root,0755)
%if ! 0%{?suse_version}
%doc %{_docdir}/%{name}-%{version}/MPL-1.1.txt
%doc %{_docdir}/%{name}-%{version}/lgpl.txt
%endif
%{_javadir}/*
%{_datadir}/maven2
%{_mavendepmapfragdir}

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

%files manual
%defattr(0644,root,root,0755)
%doc %{_docdir}/%{name}-%{version}/MPL-1.1.txt
%doc %{_docdir}/%{name}-%{version}/lgpl.txt
%doc %{_docdir}/%{name}-%{version}

# -----------------------------------------------------------------------------

%changelog
openSUSE Build Service is sponsored by