File OpenOffice_org-openclipart.spec of Package OpenOffice_org-openclipart
#
# spec file for package OpenOffice_org-openclipart (Version 3)
#
# Copyright (c) 2008 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: OpenOffice_org-openclipart
Url: http://www.openoffice.org/
# We use the gengal in the headles mode; it was added in OpenOffice_org-2.2.99.221
BuildRequires: OpenOffice_org >= 2.99
BuildRequires: OpenOffice_org-filters-optional >= 2.99
BuildRequires: openclipart-svg
%if %suse_version > 1000
%define openclipart_dir %_datadir/clipart/openclipart
%else
%define openclipart_dir %_datadir/openclipart
%endif
%define ooo_home ooo3
%define ooo_basis basis3.0
# OOo uses ugly names for galleries (std_prefix + index + std_suffix)
# The openlipart gallery should start from the index 70
%define gal_num_from 70
License: GPL v2 or later; LGPL v2.1 or later
Summary: Extra Galleries for OpenOffice.org
Group: Productivity/Office/Suite
Version: 3
Release: 1
AutoReqProv: on
# OOo-2.x with link-to-ooo-home script is required
Requires: OpenOffice_org >= 2.99, OpenOffice_org < 3.99
Requires: OpenOffice_org-filters-optional >= 2.99
# this package includes only thumbnails, the original clipart is still neeeded
%requires_eq openclipart-svg
Supplements: packageand(openclipart-svg:OpenOffice_org)
Provides: OpenOffice_org-galleries = %version
Provides: OpenOffice_org2-galleries = %version
Obsoletes: OpenOffice_org-galleries < %version
Obsoletes: OpenOffice_org2-galleries < %version
Source: OpenOffice_org-openclipart.blacklist
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
This package contains an extensive set of extra galleries for
OpenOffice.org. It can be used to enrich documents with graphics arts.
%prep
%setup -T -c
cp %{S:0} .
%build
for prefix in /usr/lib /usr/lib64 ; do
if test -x $prefix/%ooo_home/%ooo_basis/program/gengal ; then
GENGAL_BIN=$prefix/%ooo_home/%ooo_basis/program/gengal
break
fi
done
#
for dir in `find -L %openclipart_dir -mindepth 1 -maxdepth 1 -type d | LC_CTYPE=C sort` ; do
# get the gallery name from the directory name
# and make the first character uppercase
dirname=${dir##*/}
gal_name=$dirname
gal_name=`echo $gal_name | tr "_-" " "`
gal_name_rest=${gal_name#?}
gal_name_first_char=${gal_name%$gal_name_rest}
gal_name_first_char=`echo $gal_name_first_char | tr "a-z" "A-Z"`
gal_name=$gal_name_first_char$gal_name_rest
#
echo "Doing gallery $gal_name..."
#
# add too big files to the black list (svg import is somewhat slow)
blacklist=`mktemp /tmp/gengal.blacklist.XXXXXX`
IFS_saved="$IFS"
IFS="
"
for file in `find $dir -name "*.svg" | LC_CTYPE=C sort` ; do
test -L $file && echo "$file" >>$blacklist
echo size=`du -L $file | cut -f1`
test `du -b -L $file | cut -f1` -gt 100000 && echo "$file" >>$blacklist
done
IFS="$IFS_saved"
# add files from explicit blacklist if any
grep "^$dirname" OpenOffice_org-openclipart.blacklist >>$blacklist || true
echo "Ignoring too big and problematic files:"
cat $blacklist
echo "Enf of the list"
#
# xargs is necessary because the list of files is quite long
find $dir -name "*.svg" -print0 | \
LC_CTYPE=C sort -z | \
grep -z -v -f $blacklist | \
{ xargs -0 $GENGAL_BIN -headless --name "$gal_name" --path $RPM_BUILD_DIR/%name-%version --number-from "%gal_num_from" || exit 1; }
rm $blacklist
done
%install
# FIXME: The stuff from this directory is linked to ooo-home by the script
# link-to-ooo-home; so it must keep the usual OOo structure
install -m 755 -d $RPM_BUILD_ROOT%_datadir/%ooo_home/%ooo_basis/share/gallery
for file in `ls sg*` ; do
install -m 644 $file $RPM_BUILD_ROOT%_datadir/%ooo_home/%ooo_basis/share/gallery
echo "%_datadir/%ooo_home/%ooo_basis/share/gallery/$file" >>$RPM_BUILD_ROOT%_datadir/%ooo_home/openclipart_list.txt
done
echo "%dir %_datadir/%ooo_home/" >>$RPM_BUILD_ROOT%_datadir/%ooo_home/openclipart_list.txt
echo "%dir %_datadir/%ooo_home/%ooo_basis" >>$RPM_BUILD_ROOT%_datadir/%ooo_home/openclipart_list.txt
echo "%dir %_datadir/%ooo_home/%ooo_basis/share" >>$RPM_BUILD_ROOT%_datadir/%ooo_home/openclipart_list.txt
echo "%dir %_datadir/%ooo_home/%ooo_basis/share/gallery" >>$RPM_BUILD_ROOT%_datadir/%ooo_home/openclipart_list.txt
%clean
rm -rf $RPM_BUILD_ROOT
%post
%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/openclipart_list.txt || true
%preun
test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/openclipart_list.txt || true
%files
%defattr(-, root, root)
%dir %_datadir/%ooo_home
%_datadir/%ooo_home/openclipart_list.txt
%dir %_datadir/%ooo_home/%ooo_basis
%dir %_datadir/%ooo_home/%ooo_basis/share
%dir %_datadir/%ooo_home/%ooo_basis/share/gallery
%_datadir/%ooo_home/%ooo_basis/share/gallery/*
%changelog
* Fri Nov 07 2008 pmladek@suse.cz
- switched to the openclipart-svg sources
- added OpenOffice_org-filters-optional to BuildRequires and Requires;
it includes the SVG import filter for OOo
- added too big and some problematic files on the blacklist
- updated to the version 3 to be in sync with OpenOffice_org
* Fri Aug 15 2008 pmladek@suse.cz
- added Supplements: packageand(openclipart:OpenOffice_org) (bnc#168589)
* Mon Jul 21 2008 pmladek@suse.cz
- updated for OOo-3.0 (prefixes, dependency)
* Tue Jul 24 2007 pmladek@suse.cz
- split from the OpenOffice_org-2.2.99.221 source package [n#284980]
- renamed from OpenOffice_org-galleries to OpenOffice_org-openclipart
- used version 2 (should work for all OOo-2.x packages)
- used gengal in the headless mode; it was a feature added in
OpenOffice_org-2.2.99.221