File php5-pear-Crypt_Blowfish.spec of Package php5-pear-Crypt_Blowfish

#
# spec file for package php5-pear-Crypt_Blowfish
#
# Copyright (c) 2012 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 pear_name  Crypt_Blowfish
%define pear_sname crypt_blowfish
%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear)
%define xmldir  /var/lib/pear

Summary:        Allows for quick two-way blowfish encryption without the MCrypt PHP extension
License:        BSD-3-Clause
Group:          Development/Libraries/PHP

Name:           php5-pear-Crypt_Blowfish
Version:        1.1.0RC2
Release:        0
Source0:        http://pear.php.net/get/Crypt_Blowfish-%{version}.tgz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://pear.php.net/package/Crypt_Blowfish
BuildRequires:  php5 >= 1.4.7
BuildRequires:  php5-pear
Requires:       php5-pear php5 >= 1.4.7
BuildArch:      noarch
Requires:       php >= 4.3.2
Requires:       php5-pear
Suggests:       php5-mcrypt
# 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 allows you to perform two-way blowfish encryption on the fly
using only PHP. This package does not require the MCrypt PHP extension to
work, although it can make use of it if available.

%prep
%setup -c -T
pear -v -c pearrc \
        -d php_dir=%{peardir} \
        -d doc_dir=/docs \
        -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 --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}
tar -xzf %{SOURCE0} package.xml
cp -p package.xml %{buildroot}%{xmldir}/Crypt_Blowfish.xml

%clean
rm -rf %{buildroot}

%post
pear install --nodeps --soft --force --register-only %{xmldir}/Crypt_Blowfish.xml

%postun
if [ "$1" -eq "0" ]; then
    pear uninstall --nodeps --ignore-errors --register-only pear.php.net/Crypt_Blowfish
fi

%files
%defattr(-,root,root)

%{peardir}/*
%{xmldir}/Crypt_Blowfish.xml

%changelog
openSUSE Build Service is sponsored by