Blob Blame History Raw
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
%global pear_name Horde_Translation

Name:           php-horde-Horde-Translation
Version:        1.0.2
Release:        3%{?dist}
Summary:        Horde translation library

Group:          Development/Libraries
License:        LGPLv2+
URL:            http://pear.horde.org
Source0:        http://pear.horde.org/get/%{pear_name}-%{version}.tgz

BuildArch:      noarch
BuildRequires:  php-pear(PEAR) >= 1.7.0
Requires(post): %{__pear}
Requires(postun): %{__pear}
Provides:       php-pear(pear.horde.org/Horde_Translation) = %{version}
BuildRequires:  php-channel(pear.horde.org)
Requires:       php-channel(pear.horde.org)
Requires:       php-common >= 5.2.0

%description
Translation wrappers.

%prep
%setup -q -c
cd %{pear_name}-%{version}

# Don't install .po and .pot files
# Remove checksum for .mo, as we regenerate them
sed -e '/%{pear_name}.po/d' \
    -e '/Horde_Other.po/d' \
    -e '/%{pear_name}.mo/s/md5sum=.*name=/name=/' \
    ../package.xml >%{name}.xml

%build
cd %{pear_name}-%{version}

# Regenerate the locales
for po in $(find locale -name \*.po)
do
   msgfmt $po -o $(dirname $po)/$(basename $po .po).mo
done

%install
cd %{pear_name}-%{version}
rm -rf $RPM_BUILD_ROOT
%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{name}.xml

# Clean up unnecessary files
rm -rf $RPM_BUILD_ROOT%{pear_phpdir}/.??*

# Install XML package description
mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
%find_lang %{pear_name}
%find_lang Horde_Other
cat Horde_Other.lang >> %{pear_name}.lang

%post
%{__pear} install --nodeps --soft --force --register-only \
    %{pear_xmldir}/%{name}.xml >/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    %{__pear} uninstall --nodeps --ignore-errors --register-only \
        pear.horde.org/%{pear_name} >/dev/null || :
fi


%files -f %{pear_name}-%{version}/%{pear_name}.lang
# own locales (non standard) directories, .mo own by find_lang
%{pear_xmldir}/%{name}.xml
%dir %{pear_phpdir}/Horde
%{pear_phpdir}/Horde/Translation
%{pear_phpdir}/Horde/Translation.php
%{pear_docdir}/Horde_Translation
# own locales (non standard) directories, .mo own by find_lang
%dir %{pear_testdir}/Horde_Translation
%dir %{pear_testdir}/Horde_Translation/Horde
%dir %{pear_testdir}/Horde_Translation/Horde/Translation
%dir %{pear_testdir}/Horde_Translation/Horde/Translation/locale
%dir %{pear_testdir}/Horde_Translation/Horde/Translation/locale/de
%dir %{pear_testdir}/Horde_Translation/Horde/Translation/locale/de/LC_MESSAGES
%{pear_testdir}/Horde_Translation/Horde/Translation/*.php


%changelog
* Tue Aug 14 2012 Remi Collet <remi@fedoraproject.org> - 1.0.2-3
- rebuilt for new pear_testdir

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jun 14 2012 Nick Bebout <nb@fedoraproject.org> - 1.0.2-1
- Upgrade to 1.0.2

* Sat Jan 28 2012 Nick Bebout <nb@fedoraproject.org> - 1.0.1-1
- Initial package