summaryrefslogtreecommitdiffstats
path: root/php-pecl-handlebars.spec
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-06-09 16:23:07 +0200
committerRemi Collet <remi@remirepo.net>2017-06-09 16:23:07 +0200
commit1eb3f28c1513622102518049d0adf055215ab999 (patch)
tree47fe9c73c0d5c056e274e3bdf14ca2e3bae1b41a /php-pecl-handlebars.spec
parent27fb19ad29ae76398bd22c5a4a3ea4cc36449bfd (diff)
New package
Diffstat (limited to 'php-pecl-handlebars.spec')
-rw-r--r--php-pecl-handlebars.spec52
1 files changed, 41 insertions, 11 deletions
diff --git a/php-pecl-handlebars.spec b/php-pecl-handlebars.spec
index 38e3573..792830c 100644
--- a/php-pecl-handlebars.spec
+++ b/php-pecl-handlebars.spec
@@ -11,9 +11,10 @@
%scl_package php-pecl-handlebars
%endif
-%global pecl_name handlebars
-%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
-%global ini_name 40-%{pecl_name}.ini
+%global pecl_name handlebars
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
+%global ini_name 40-%{pecl_name}.ini
+%global with_tests 0%{!?_without_tests:1}
%global upstream_version 0.8.2
%global upstream_prever RC1
@@ -29,7 +30,8 @@ Source0: http://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstr
BuildRequires: %{?scl_prefix}php-devel > 5.6
BuildRequires: %{?scl_prefix}php-pear
-BuildRequires: handlebars-devel
+BuildRequires: libhandlebars-devel
+BuildRequires: libtalloc-devel
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
@@ -94,10 +96,9 @@ These are the files needed to compile programs using %{name}.
%setup -q -c
mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS
-# Don't install/register tests
-sed -e 's/role="test"/role="src"/' \
- %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \
- -i package.xml
+# Don't install/register License
+%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
+
cd NTS
@@ -118,6 +119,17 @@ cp -pr NTS ZTS
cat << 'EOF' | tee %{ini_name}
; Enable "%{pecl_name}" extension module
extension=%{pecl_name}.so
+
+; Configuration
+;handlebars.pool_size = '128k'
+;handlebars.cache.enable = 1
+;handlebars.cache.enable_cli = 0
+;handlebars.cache.backend = 'mmap'
+;handlebars.cache.max_size = 67108864
+;handlebars.cache.max_entries = 349529
+;handlebars.cache.max_age = -1
+;handlebars.cache.save_path = '/tmp/php-handlebars-cache'
+;handlebars.cache.stat = 1
EOF
@@ -166,8 +178,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
# Test & Documentation
for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//')
-do [ -f NTS/tests/$i ] && install -Dpm 644 NTS/tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i
- [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
+do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
done
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
@@ -201,18 +212,37 @@ cd NTS
--define extension=modules/%{pecl_name}.so \
--modules | grep %{pecl_name}
+%if %{with_tests}
+# Upstream test suite
+TEST_PHP_EXECUTABLE=%{__php} \
+TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+%{__php} -n run-tests.php --show-diff
+%endif
+
%if %{with_zts}
: Minimal load test for ZTS extension
cd ../ZTS
%{__ztsphp} --no-php-ini \
--define extension=modules/%{pecl_name}.so \
--modules | grep %{pecl_name}
+
+%if %{with_tests}
+# Upstream test suite
+TEST_PHP_EXECUTABLE=%{__ztsphp} \
+TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+%{__ztsphp} -n run-tests.php --show-diff
+%endif
%endif
%files
%{!?_licensedir:%global license %%doc}
-%license NTS/LICENSE
+%license NTS/LICENSE.md
+%doc %{pecl_docdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
%config(noreplace) %{php_inidir}/%{ini_name}