File openclipart.spec of Package openclipart

#
# spec file for package openclipart (Version 0.18)
#
# Copyright (c) 2010 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


Name:           openclipart
License:        Public Domain, Freeware
Group:          Productivity/Graphics/Other
AutoReqProv:    on
Summary:        Open Clip Art Library
Version:        0.18
Release:        137
Url:            http://www.openclipart.org/
# This tarball has been generated using:
# sh generate-png-source.sh openclipart-0.18-svgonly.tar.bz2 2>&1 | tee generate-png-source.sh.log
Source0:        openclipart-%{version}-pngonly.tar.bz2
Source1:        openclipart-%{version}-svgonly.tar.bz2
Source2:        generate-png-source.sh
Source3:        generate-png-source.sh.log.bz2
Source4:        clean-up-sources.sh
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
An extensive set of clip art graphics that can be used for free.



%package svg
License:        Public Domain, Freeware
Summary:        Open Clip Art Library in the SVG File Format
Group:          Productivity/Graphics/Other
%if 0%{?suse_version} >= 01020 || 0%{?meego_version}
# FIXME: http://en.opensuse.org/Packaging/Distribution_differences claims that Requires(posttrans) is not implemented
Requires(post): coreutils
%else
PreReq:         coreutils
%endif

%description svg
An extensive set of clip art graphics that can be used for free.

This package includes the pictures in the original SVG graphics file
format.



%package png
License:        Public Domain, Freeware
Summary:        Open Clip Art Library in the PNG File Format
Group:          Productivity/Graphics/Other
Provides:       openclipart:/usr/share/clipart/openclipart-0.18/animals/birds/baby_tux_01.png
Provides:       openclipart <= 0.18
Obsoletes:      openclipart <= 0.18
%if 0%{?suse_version} >= 01020 || 0%{?meego_version}
# FIXME: http://en.opensuse.org/Packaging/Distribution_differences claims that Requires(posttrans) is not implemented
Requires(post): coreutils
%else
PreReq:         coreutils
%endif

%description png
An extensive set of clip art graphics that can be used for free.

This package includes the pictures converted to the PNG graphics file
format.



%prep
%setup -q -n openclipart-%{version}-pngonly -b 1
#
install -m 755 %{S:2} %{S:4} .
bzip2 -dc %{S:3} >generate-png-source.sh.log

%build

%install
install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/clipart/%name-%version
cp -a ../openclipart-%{version}-pngonly/clipart/* \
      $RPM_BUILD_ROOT%{_datadir}/clipart/%name-%version
cp -a ../openclipart-%{version}-svgonly/clipart/* \
      $RPM_BUILD_ROOT%{_datadir}/clipart/%name-%version
find $RPM_BUILD_ROOT%{_datadir}/clipart/%name-%version -mindepth 1  -maxdepth 1 -type f -exec rm {} \;
rm -rf $RPM_BUILD_ROOT%{_datadir}/clipart/%name-%version/nsis
#
# do clean up ...
DESTDIR=$RPM_BUILD_ROOT ./clean-up-sources.sh %{_datadir}/clipart/%name-%version/
#
# compat symlink without version
ln -sf %name-%version $RPM_BUILD_ROOT%{_datadir}/clipart/%name
#
# file lists
for suffix in png svg ; do
    find $RPM_BUILD_ROOT%{_datadir}/clipart -type d | sed "s|^$RPM_BUILD_ROOT\(.*\)$|%dir \"\1\"|" >files.$suffix
    find $RPM_BUILD_ROOT%{_datadir}/clipart -name "*.$suffix" | sed "s|^$RPM_BUILD_ROOT\(.*\)$|\"\1\"|" >>files.$suffix
done

%clean
rm -rf $RPM_BUILD_ROOT

%posttrans svg
test -L %{_datadir}/clipart/%name && rm %{_datadir}/clipart/%name || true
test ! -e %{_datadir}/clipart/%name && ln -sf %name-%version %{_datadir}/clipart/%name || true;

%posttrans png
test -L %{_datadir}/clipart/%name && rm %{_datadir}/clipart/%name || true
test ! -e %{_datadir}/clipart/%name && ln -sf %name-%version %{_datadir}/clipart/%name || true;

%files -f files.svg svg
%defattr(-, root,root)
%doc AUTHORS ChangeLog INSTALL LICENSE NEWS README VERSION clipart/{PASSFAIL,TODO}
%ghost %{_datadir}/clipart/%name

%files -f files.png png
%defattr(-, root,root)
%doc AUTHORS ChangeLog INSTALL LICENSE NEWS README VERSION generate-png-source.sh* clipart/{PASSFAIL,TODO}
%ghost %{_datadir}/clipart/%name

%changelog