From 3d14aceede40c551006d08c42d6a059ad35efdd3 Mon Sep 17 00:00:00 2001 From: Xavier Bachelot Date: Nov 24 2023 15:19:24 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea76a8b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/smarty-gettext-1.7.0.tar.gz diff --git a/make_smarty_gettext_tarball.sh b/make_smarty_gettext_tarball.sh new file mode 100644 index 0000000..87c205c --- /dev/null +++ b/make_smarty_gettext_tarball.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TAG=$1 +TMPDIR=$(mktemp -d ) +pushd ${TMPDIR} +git clone https://github.com/smarty-gettext/smarty-gettext.git +cd smarty-gettext +cat > .git/info/attributes << EOF +# tests +/phpunit.xml -export-ignore +/tests -export-ignore +/composer.json -export-ignore + +# docs +/README.md -export-ignore +/COPYING -export-ignore +/CHANGELOG.md -export-ignore +/AUTHORS -export-ignore +EOF +git archive ${TAG} --format tar.gz --prefix smarty-gettext-${TAG}/ -o ../smarty-gettext-${TAG}.tar.gz +popd +mv ${TMPDIR}/smarty-gettext-${TAG}.tar.gz . +#rm -rf ${TMPDIR} diff --git a/php-smarty-gettext.spec b/php-smarty-gettext.spec new file mode 100644 index 0000000..fac08c7 --- /dev/null +++ b/php-smarty-gettext.spec @@ -0,0 +1,102 @@ +Name: php-smarty-gettext +Summary: Gettext support for Smarty +Version: 1.7.0 +Release: 2%{?dist} +License: LGPL-2.1-or-later +URL: https://github.com/smarty-gettext/smarty-gettext + +Source0: %{url}/archive/%{version}/smarty-gettext-%{version}.tar.gz +Source1: make_smarty_gettext_tarball.sh + +BuildArch: noarch + +BuildRequires: php(language) >= 5.3 +BuildRequires: php-fedora-autoloader-devel +# Tests +%if 0%{?fedora} +BuildRequires: phpunit9 +BuildRequires: gettext +# Not packaged +#BuildRequires: php-azatoth-php-pgettext +BuildRequires: glibc-langpack-pl +BuildRequires: glibc-langpack-et +BuildRequires: glibc-langpack-en +BuildRequires: php-Smarty +BuildRequires: php-pcre +%endif +Requires: php(language) >= 5.3 +Requires: php-Smarty +Requires: php-gettext + +Provides: php-composer(smarty-gettext/smarty-gettext) = %{version} + + +%description +smarty-gettext provides gettext (i18n) support for Smarty, the popular PHP +templating engine, to implement an NLS (Native Language Support) API which can +be used to internationalize and translate your PHP applications. + + +%prep +%setup -q -n smarty-gettext-%{version} +%if 0%{?fedora} +# Adapt for recent phpunit +sed -i -e 's/public static function setUpBeforeClass() {/public static function setUpBeforeClass():void {/' \ + tests/TestCase.php \ + tests/ParserTest.php +%endif + + +%build +# Nothing to build + + +%install +# Generate autoloader +phpab --template fedora --output smarty-gettext-autoload.php . tests +# Install Smarty +install -d -m 0755 %{buildroot}%{_datadir}/php/Smarty/plugins/ +install -p -m 0644 \ + block.t.php \ + function.locale.php \ + smarty-gettext-autoload.php \ + %{buildroot}%{_datadir}/php/Smarty/plugins/ + + +%check +%if 0%{fedora} +ls -lh +mkdir -p vendor +cat > vendor/autoload.php << EOF + +EOF +# Drop for now, it needs php-azatoth-php-pgettext +rm tests/MsgctxtTest.php +phpunit9 \ + --verbose \ + --do-not-cache-result \ + --testdox \ + tests +%endif + + +%files +%license COPYING +%doc AUTHORS CHANGELOG.md README.md +%{_datadir}/php/Smarty/plugins/smarty-gettext-autoload.php +%{_datadir}/php/Smarty/plugins/block.t.php +%{_datadir}/php/Smarty/plugins/function.locale.php + + +%changelog +* Thu Nov 16 2023 Xavier Bachelot - 1.7.0-2 +- Provide autoloader +- Run test suite + +* Mon Jul 17 2023 Xavier Bachelot - 1.7.0-1 +- Initial package diff --git a/sources b/sources new file mode 100644 index 0000000..9f37635 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (smarty-gettext-1.7.0.tar.gz) = c6003ddac9910b2bb6230a24f0286b0aa57a84497a7f771a9bd34967efcdc5b7a8b908f5c31610a904d83a99cc57521bd243408b4ef044894b5e156073c67215