File libreoffice-templates-labels.spec of Package libreoffice-templates-labels

#
# spec file for package libreoffice-templates-labels
#
# Copyright (c) 2011 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:           libreoffice-templates-labels
License:        GPLv2+
Group:          Productivity/Office/Suite
AutoReqProv:    on
Version:        1.0.1
Release:        0.<RELEASE2>
Summary:        Label Templates for LibreOffice
Url:            http://sourceforge.net/projects/ooolabels
Source:         OOoLabel-Templates-20061106.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This source package includes a collection of label templates for
LibreOffice.



%package a4
License:        GPLv2+
Version:        1.0.1
Release:        0.<RELEASE2>
Group:          Productivity/Office/Suite
Summary:        A4 Size Label Templates for LibreOffice
%if %suse_version > 1000
Supplements:    OpenOffice_org
Supplements:    libreoffice
%endif
# compat stuff
Provides:       OpenOffice_org-templates-labels-a4 = %version
Obsoletes:      OpenOffice_org-templates-labels-a4 <= %version

%description a4
A collection of A4 size label templates for LibreOffice. They are
intended for Europe and Asia.



%package letter
License:        GPLv2+
Version:        1.0.1
Release:        0.<RELEASE2>
Group:          Productivity/Office/Suite
Summary:        Letter Size Label Templates for LibreOffice
%if %suse_version > 1000
Supplements:    OpenOffice_org
Supplements:    libreoffice
%endif
# compat stuff
Provides:       OpenOffice_org-templates-labels-letter = %version
Obsoletes:      OpenOffice_org-templates-labels-letter <= %version

%description letter
A collection of letter size label templates for LibreOffice. They
are intended for US.



%prep
%setup -c -q

%build

%install
install -m 755 -d $RPM_BUILD_ROOT/usr/share/templates/libreoffice/common/labels/
cp -a Europe-Asia-a4-sizes-OOolabels/* $RPM_BUILD_ROOT/usr/share/templates/libreoffice/common/labels/
cp -a USA-a5-sizes-OOolabels/* $RPM_BUILD_ROOT/usr/share/templates/libreoffice/common/labels/
#
# move documentation
install -m 755 -d $RPM_BUILD_ROOT/%{_docdir}/%{name}-a4
install -m 755 -d $RPM_BUILD_ROOT/%{_docdir}/%{name}-letter
mv "$RPM_BUILD_ROOT/usr/share/templates/libreoffice/common/labels/Europe-Asia-a4-Sizes-README.ott" $RPM_BUILD_ROOT/%{_docdir}/%{name}-a4
mv "$RPM_BUILD_ROOT/usr/share/templates/libreoffice/common/labels/USA-sizes-A5-README-OOoLabels.ott" $RPM_BUILD_ROOT/%{_docdir}/%{name}-letter
mv "$RPM_BUILD_ROOT/usr/share/templates/libreoffice/common/labels/Worldlabel.com Label Configurations.ods" $RPM_BUILD_ROOT/%{_docdir}/%{name}-letter
# compat stuff
install -m 755 -d $RPM_BUILD_ROOT/usr/share/templates/ooo/
for dir in `find $RPM_BUILD_ROOT/usr/share/templates/libreoffice/ -type d -printf "%%P \n"` ; do
    echo "~$RPM_BUILD_ROOT/usr/share/templates/ooo/$dir~"
    mkdir -p $RPM_BUILD_ROOT/usr/share/templates/ooo/$dir
done
for file in `find $RPM_BUILD_ROOT/usr/share/templates/libreoffice/ -type f -printf "%%P "` ; do
    ln -sf /usr/share/templates/libreoffice/$file $RPM_BUILD_ROOT/usr/share/templates/ooo/$file
done
#
# create file lists
# a4
ls Europe-Asia-a4-sizes-OOolabels/* | \
    grep -v -e "Europe-Asia-a4-Sizes-README.ott" | \
    sed "s|^Europe-Asia-a4-sizes-OOolabels/\(.*\)$|\"/usr/share/templates/libreoffice/common/labels/\1\"|" >a4.list
# a4 compat stuff
ls Europe-Asia-a4-sizes-OOolabels/* | \
    grep -v -e "Europe-Asia-a4-Sizes-README.ott" | \
    sed "s|^Europe-Asia-a4-sizes-OOolabels/\(.*\)$|\"/usr/share/templates/ooo/common/labels/\1\"|" >>a4.list
# a4 doc
echo "%doc \"%{_docdir}/%{name}-a4/Europe-Asia-a4-Sizes-README.ott\"" >>a4.list
# letter
ls USA-a5-sizes-OOolabels/* | \
    grep -v -e "USA-sizes-A5-README-OOoLabels.ott" -e "Worldlabel.com Label Configurations.ods" | \
    sed "s|^USA-a5-sizes-OOolabels/\(.*\)$|\"/usr/share/templates/libreoffice/common/labels/\1\"|" >letter.list
# letter compat stuff
ls USA-a5-sizes-OOolabels/* | \
    grep -v -e "USA-sizes-A5-README-OOoLabels.ott" -e "Worldlabel.com Label Configurations.ods" | \
    sed "s|^USA-a5-sizes-OOolabels/\(.*\)$|\"/usr/share/templates/ooo/common/labels/\1\"|" >>letter.list
# letter doc
echo "%doc \"%{_docdir}/%{name}-letter/USA-sizes-A5-README-OOoLabels.ott\"" >>letter.list
echo "%doc \"%{_docdir}/%{name}-letter/Worldlabel.com Label Configurations.ods\"" >>letter.list
#
# README and COPYING
for file in README COPYING ; do
    cp -a $file $RPM_BUILD_ROOT/%{_docdir}/%{name}-a4/
    cp -a $file $RPM_BUILD_ROOT/%{_docdir}/%{name}-letter/
    echo "%doc \"%{_docdir}/%{name}-a4/$file\"" >>a4.list
    echo "%doc \"%{_docdir}/%{name}-letter/$file\"" >>letter.list
done

%clean
rm -rf $RPM_BUILD_ROOT

%files -f a4.list a4
%defattr(-, root, root)
%doc %dir %{_docdir}/%{name}-a4
%dir /usr/share/templates/libreoffice/
%dir /usr/share/templates/libreoffice/common/
%dir /usr/share/templates/libreoffice/common/labels/
# compat stuff
%dir /usr/share/templates/ooo/
%dir /usr/share/templates/ooo/common/
%dir /usr/share/templates/ooo/common/labels/

%files -f letter.list letter
%defattr(-, root, root)
%doc %dir %{_docdir}/%{name}-letter
%dir /usr/share/templates/
%dir /usr/share/templates/libreoffice/
%dir /usr/share/templates/libreoffice/common/
%dir /usr/share/templates/libreoffice/common/labels/
# compat stuff
%dir /usr/share/templates/ooo/
%dir /usr/share/templates/ooo/common/
%dir /usr/share/templates/ooo/common/labels/

%changelog