c4c84a5
%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
c4c84a5
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
c4c84a5
%global pear_name XML_SVG
c4c84a5
c4c84a5
Name:           php-pear-XML-SVG
c4c84a5
Version:        1.1.0
c4c84a5
Release:        2%{?dist}
c4c84a5
Summary:        API for building SVG documents
c4c84a5
c4c84a5
Group:          Development/Libraries
c4c84a5
# https://pear.php.net/bugs/19690 - Please Provides LICENSE file
c4c84a5
License:        LGPLv3
c4c84a5
URL:            http://pear.php.net/package/%{pear_name}
c4c84a5
Source0:        http://pear.php.net/get/%{pear_name}-%{version}.tgz
c4c84a5
c4c84a5
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
c4c84a5
BuildArch:      noarch
c4c84a5
BuildRequires:  php-pear(PEAR)
c4c84a5
c4c84a5
Requires(post): %{__pear}
c4c84a5
Requires(postun): %{__pear}
c4c84a5
Requires:       php-pear(PEAR)
c4c84a5
c4c84a5
Provides:       php-pear(%{pear_name}) = %{version}
c4c84a5
c4c84a5
c4c84a5
%description
c4c84a5
This package provides an object-oriented API for building SVG documents.
c4c84a5
c4c84a5
c4c84a5
%prep
c4c84a5
%setup -q -c
c4c84a5
cd %{pear_name}-%{version}
c4c84a5
c4c84a5
# https://pear.php.net/bugs/19718 - README is Doc
c4c84a5
sed -e '/README/s/role="data"/role="doc"/' \
c4c84a5
    ../package.xml >%{name}.xml
c4c84a5
c4c84a5
c4c84a5
%build
c4c84a5
cd %{pear_name}-%{version}
c4c84a5
# Empty build section, most likely nothing required.
c4c84a5
c4c84a5
c4c84a5
%install
c4c84a5
rm -rf %{buildroot}
c4c84a5
c4c84a5
cd %{pear_name}-%{version}
c4c84a5
%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
c4c84a5
c4c84a5
# Clean up unnecessary files
c4c84a5
rm -rf %{buildroot}%{pear_metadir}/.??*
c4c84a5
c4c84a5
# Install XML package description
c4c84a5
install -Dpm 644 %{name}.xml %{buildroot}%{pear_xmldir}/%{name}.xml
c4c84a5
c4c84a5
c4c84a5
%clean
c4c84a5
rm -rf %{buildroot}
c4c84a5
c4c84a5
c4c84a5
%post
c4c84a5
%{__pear} install --nodeps --soft --force --register-only \
c4c84a5
    %{pear_xmldir}/%{name}.xml >/dev/null || :
c4c84a5
c4c84a5
%postun
c4c84a5
if [ $1 -eq 0 ] ; then
c4c84a5
    %{__pear} uninstall --nodeps --ignore-errors --register-only \
c4c84a5
        pear.php.net/%{pear_name} >/dev/null || :
c4c84a5
fi
c4c84a5
c4c84a5
c4c84a5
%files
c4c84a5
%defattr(-,root,root,-)
c4c84a5
%doc %{pear_docdir}/%{pear_name}
c4c84a5
%{pear_xmldir}/%{name}.xml
c4c84a5
%dir %{pear_phpdir}/XML
c4c84a5
%{pear_phpdir}/XML/SVG.php
c4c84a5
%{pear_phpdir}/XML/SVG
c4c84a5
c4c84a5
c4c84a5
%changelog
c4c84a5
* Fri Nov 23 2012 Remi Collet <remi@fedoraproject.org> - 1.1.0-2
c4c84a5
- fix README Role (from review #872957)
c4c84a5
c4c84a5
* Sun Nov  4 2012 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
c4c84a5
- Initial package