File php5-pear-Horde_Role.spec of Package php5-pear-Horde_Role
#
# spec file for package php5-pear-Horde_Role
#
# 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/
#
%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear)
%define xmldir /var/lib/pear
%define hordedir /usr/share/php5/PEAR/www/horde
Summary: PEAR: PEAR installer role used to install Horde components
Name: php5-pear-Horde_Role
Version: 1.0.0
Release: 9
License: LGPL-3.0+
Group: Development/Libraries/PHP
Source0: http://pear.horde.org/get/Horde_Role-%{version}.tgz
Source1: Horde_Role.xml
Source2: COPYING.LGPLv3
Source3: author-says-it-is-lgpl
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://pear.horde.org/package/Horde_Role
BuildRequires: php5-pear php5-tokenizer
BuildRequires: php5-pear-channel-horde
Requires: php5-pear-channel-horde
BuildArch: noarch
%define pear_name Horde_Role
%define pear_sname horde_role
# Fix for renaming (package convention)
Provides: php5-pear-%{pear_sname} = %{version}
Provides: php-pear-%{pear_sname} = %{version}
Provides: pear-%{pear_sname} = %{version}
Obsoletes: php5-pear-%{pear_sname} < %{version}
Obsoletes: php-pear-%{pear_sname} < %{version}
Obsoletes: pear-%{pear_sname} < %{version}
%description
This package provides a method for PEAR to install Horde components into a
base Horde installation.
%prep
%setup -c -T
pear -v -c pearrc \
-d php_dir=%{peardir} \
-d doc_dir=%{_docdir}/%{name} \
-d bin_dir=%{_bindir} \
-d data_dir=%{peardir}/data \
-d test_dir=%{peardir}/tests \
-d ext_dir=%{_libdir} \
-s
%build
%install
pear -c pearrc install --nodeps --force --packagingroot %{buildroot} %{SOURCE0}
# Clean up unnecessary files
#rm pearrc
rm %{buildroot}/%{peardir}/.filemap
rm %{buildroot}/%{peardir}/.lock
rm -rf %{buildroot}/%{peardir}/.registry
rm -rf %{buildroot}%{peardir}/.channels
rm %{buildroot}%{peardir}/.depdb
rm %{buildroot}%{peardir}/.depdblock
# Install XML package description
mkdir -p %{buildroot}%{xmldir}
# make the horde_dir
mkdir -p %{buildroot}%{hordedir}
cp -p %{SOURCE1} %{buildroot}%{xmldir}/Horde_Role.xml
# copy licensing related files to docs
%{__install} -d %{buildroot}/usr/share/doc/packages/%{name}/
cp -p %{SOURCE2} %{buildroot}/usr/share/doc/packages/%{name}/
cp -p %{SOURCE3} %{buildroot}/usr/share/doc/packages/%{name}/
## todo: use patch instead
#tar -xzf % {SOURCE0} package.xml
#cp -p package.xml % {buildroot}% {xmldir}/Horde_Role.xml
%clean
rm -rf %{buildroot}
%post
pear install --register-only %{xmldir}/Horde_Role.xml
echo "/usr/share/php5/pear/www/horde" | pear run-scripts horde/horde_role
/usr/bin/pear config-set horde_dir %{hordedir}
mkdir -p %{hordedir}
chmod 755 /usr/share/php5/PEAR/www/
%postun
if [ "$1" -eq "0" ]; then
pear uninstall --nodeps --ignore-errors --register-only pear.horde.org/Horde_Role
fi
%files
%defattr(-,root,root,755)
%{peardir}/*
%{xmldir}/Horde_Role.xml
%{hordedir}
%{_docdir}/%{name}
%changelog