File OpenOffice_org-openclipart.spec of Package OpenOffice_org-openclipart

# spec file for package OpenOffice_org-openclipart (Version 3)
# Copyright (c) 2009 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

# norootforbuild

Name:           OpenOffice_org-openclipart
# We use the gengal in the headles mode; it was added in OpenOffice_org-
BuildRequires:  OpenOffice_org >= 3.0.99
BuildRequires:  OpenOffice_org-filters >= 3.0.99
BuildRequires:  openclipart-svg
%if %suse_version == 1010
BuildRequires:  update-alternatives
%if %suse_version > 1000
%define 	openclipart_dir %_datadir/clipart/openclipart
%define 	openclipart_dir %_datadir/openclipart
%define 	ooo_home 	ooo3
%define 	ooo_basis	basis3.1
# 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
Group:          Productivity/Office/Suite
Version:        3
Release:        2
AutoReqProv:    on
# OOo-2.x with link-to-ooo-home script is required
Requires:       OpenOffice_org >= 3.0.99, OpenOffice_org < 3.1.99
Requires:       OpenOffice_org-filters >= 3.0.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

This package contains an extensive set of extra galleries for It can be used to enrich documents with graphics arts.

%setup -T -c
cp %{S:0} .

for prefix in /usr/lib /usr/lib64 ; do
    if test -x $prefix/%ooo_home/%ooo_basis/program/gengal ; then
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
	gal_name=`echo $gal_name | tr "_-" "  "`
	gal_name_first_char=`echo $gal_name_first_char | tr "a-z" "A-Z"`
	echo "Doing gallery $gal_name..."
	# add too big files to the black list (svg import is somewhat slow)
	blacklist=`mktemp /tmp/gengal.blacklist.XXXXXX`
	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
	# 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

# 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
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


%_datadir/%ooo_home/link-to-ooo-home %_datadir/%ooo_home/openclipart_list.txt || true

test "$1" = "0" && %_datadir/%ooo_home/link-to-ooo-home --unlink %_datadir/%ooo_home/openclipart_list.txt || true

%defattr(-, root, root)
%dir %_datadir/%ooo_home
%dir %_datadir/%ooo_home/%ooo_basis
%dir %_datadir/%ooo_home/%ooo_basis/share
%dir %_datadir/%ooo_home/%ooo_basis/share/gallery

* Wed Mar 18 2009
- updated basis dir to basis3.1
- update dependencies on OOo >= 3.0.99
- added update-alternatives to BuildRequires on SLED10
* Fri Nov 07 2008
- 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
- added Supplements: packageand(openclipart:OpenOffice_org) (bnc#168589)
* Mon Jul 21 2008
- updated for OOo-3.0 (prefixes, dependency)
* Tue Jul 24 2007
- split from the OpenOffice_org- 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
openSUSE Build Service is sponsored by