File jimi.spec of Package jimi

#
# spec file for package jimi
#
# 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.



Name:           jimi
Version:        1.0
%define         cvs_version     1_0
Release:        1
License:        Sun Binary Code License
Summary:        Java imaging toolkit
Url:            http://java.sun.com/products/jimi/
Group:          Development/Libraries/Java
Source0:        %{name}%{cvs_version}.zip
BuildRequires:  fdupes
BuildRequires:  java-devel
BuildRequires:  perl
BuildRequires:  unzip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Vendor:         openSUSE-Education
NoSource:       0

%description
JIMI Software Development Kit Jimi is a class library for managing
images. Its primary function is image I/O. Jimi was formerly a product
of Activated Intelligence. Sun is making it available for developers who
have code with dependencies on Jimi or for those who need image I/O
functionality in applications running under 1.1.x versions of the JavaTM
Platform. Jimi's range of supported formats includes GIF, JPEG, TIFF,
PNG, PICT, Photoshop, BMP, Targa, ICO, CUR, Sunraster, XBM, XPM, and
PCX, although some of these formats do not have complete support for all
features.

%package manual
Summary:        Manual for %{name}
Group:          Development/Libraries/Java
Recommends:     %{name} = %{version}

%description manual
Documentation for %{name}.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation
Recommends:     %{name} = %{version}

%description javadoc
Javadoc (HTML) for %{name}.

%package demo
Summary:        Demo for %{name}
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}

%description demo
Demonstrations and samples for %{name}.

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

%prep
%setup -q -n Jimi

# use jar archive
unzip -q JimiProClasses.zip
jar cf %{name}.jar com
# correct examples
find examples -name "*.bat" -exec rm -f {} ';'
for file in `find examples -name *.html`; do
  perl -pi -e 's/JimiProClasses\.jar/jimi.jar/' $file
done
for file in `find examples -name *.sh`; do
  perl -pi -e 's|\$CLASSPATH:[./:]*JimiProClasses\.zip[./:]*|\$CLASSPATH:%{_javadir}/jimi.jar:.|' $file
done

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

%build
echo

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

%install
# jars
mkdir -p %{buildroot}%{_javadir}
cp -p %{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && ln -sf %{name}-%{version}.jar %{name}.zip)
(cd %{buildroot}%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)

# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}-%{version}
cp -pr docs/html/api/* %{buildroot}%{_javadocdir}/%{name}-%{version}
rm -rf docs/html/api

# data
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -pr examples %{buildroot}%{_datadir}/%{name}

# permissions
chmod +x %{buildroot}%{_datadir}/%{name}/examples/*/*/*.sh
chmod +x %{buildroot}%{_datadir}/%{name}/examples/*/*.sh

# fdupes
%fdupes -s %{buildroot}%{_datadir}/%{name}/examples

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

%clean
rm -rf %{buildroot}

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

%post javadoc
if [ -L %{_javadocdir}/%{name} ]; then
  rm -f %{_javadocdir}/%{name}
  ln -s %{name}-%{version} %{_javadocdir}/%{name}
fi

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

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

%files
%defattr(0644,root,root,0755)
%doc License Readme
%{_javadir}/*

%files manual
%defattr(0644,root,root,0755)
%doc docs/html/*

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

%files demo
%defattr(-,root,root,0755)
%{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by