cdc9005
# Fedora spec file for php-pecl-pcov
cdc9005
# with SCL stuff removed from:
cdc9005
#
cdc9005
# remirepo spec file for php-pecl-pcov
cdc9005
#
e7ffc39
# Copyright (c) 2019-2021 Remi Collet
cdc9005
# License: CC-BY-SA
cdc9005
# http://creativecommons.org/licenses/by-sa/4.0/
cdc9005
#
cdc9005
# Please, preserve the changelog entries
cdc9005
#
cdc9005
%global with_zts  0%{!?_without_zts:%{?__ztsphp:1}}
cdc9005
%global pecl_name pcov
cdc9005
%global ini_name  40-%{pecl_name}.ini
cdc9005
cdc9005
Summary:        Code coverage driver
cdc9005
Name:           php-pecl-%{pecl_name}
4519103
Version:        1.0.10
4519103
Release:        1%{?dist}
cdc9005
License:        PHP
e7ffc39
URL:            https://pecl.php.net/package/%{pecl_name}
e7ffc39
Source0:        https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
cdc9005
e7ffc39
BuildRequires:  make
cdc9005
BuildRequires:  gcc
078559f
BuildRequires:  php-devel >= 7.1
cdc9005
BuildRequires:  php-pear
cdc9005
cdc9005
Requires:       php(zend-abi) = %{php_zend_api}
cdc9005
Requires:       php(api) = %{php_core_api}
cdc9005
cdc9005
Provides:       php-%{pecl_name}               = %{version}
cdc9005
Provides:       php-%{pecl_name}%{?_isa}       = %{version}
cdc9005
Provides:       php-pecl(%{pecl_name})         = %{version}
cdc9005
Provides:       php-pecl(%{pecl_name})%{?_isa} = %{version}
cdc9005
cdc9005
cdc9005
%description
cdc9005
A self contained php-code-coverage compatible driver for PHP7.
cdc9005
cdc9005
cdc9005
%prep
cdc9005
%setup -q -c
cdc9005
mv %{pecl_name}-%{version} NTS
cdc9005
cdc9005
# Don't install/register tests
cdc9005
sed -e 's/role="test"/role="src"/' \
cdc9005
    -e '/LICENSE/s/role="doc"/role="src"/' \
cdc9005
    -i package.xml
cdc9005
cdc9005
cd NTS
cdc9005
# Sanity check, really often broken
cdc9005
extver=$(sed -n '/#define PHP_PCOV_VERSION/{s/.* "//;s/".*$//;p}' php_pcov.h)
cdc9005
if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
cdc9005
   : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever:-%{prever}}.
cdc9005
   exit 1
cdc9005
fi
cdc9005
cd ..
cdc9005
cdc9005
%if %{with_zts}
cdc9005
# Duplicate source tree for NTS / ZTS build
cdc9005
cp -pr NTS ZTS
cdc9005
%endif
cdc9005
cdc9005
# Create configuration file
cdc9005
cat << 'EOF' | tee %{ini_name}
cdc9005
; Enable %{pecl_name} extension module
cdc9005
extension=%{pecl_name}.so
cdc9005
cdc9005
; Configuration
cdc9005
cdc9005
; The recommended defaults for production should be:
cdc9005
pcov.enabled = 0
cdc9005
cdc9005
; The recommended defaults for development should be:
cdc9005
;pcov.enabled = 1
cdc9005
;pcov.directory = /path/to/your/source/directory
cdc9005
;pcov.exclude = ''
cdc9005
;pcov.initial.memory = 65536
cdc9005
;pcov.initial.files = 64
cdc9005
EOF
cdc9005
cdc9005
cdc9005
%build
cdc9005
cd NTS
cdc9005
%{_bindir}/phpize
cdc9005
%configure \
cdc9005
    --enable-pcov \
cdc9005
    --with-libdir=%{_lib} \
cdc9005
    --with-php-config=%{_bindir}/php-config
cdc9005
cdc9005
make %{?_smp_mflags}
cdc9005
cdc9005
%if %{with_zts}
cdc9005
cd ../ZTS
cdc9005
%{_bindir}/zts-phpize
cdc9005
%configure \
cdc9005
    --enable-pcov \
cdc9005
    --with-libdir=%{_lib} \
cdc9005
    --with-php-config=%{_bindir}/zts-php-config
cdc9005
cdc9005
make %{?_smp_mflags}
cdc9005
%endif
cdc9005
cdc9005
cdc9005
%install
cdc9005
make -C NTS install INSTALL_ROOT=%{buildroot}
cdc9005
cdc9005
# install config file
cdc9005
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
cdc9005
cdc9005
# Install XML package description
cdc9005
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
cdc9005
cdc9005
%if %{with_zts}
cdc9005
make -C ZTS install INSTALL_ROOT=%{buildroot}
cdc9005
cdc9005
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
cdc9005
%endif
cdc9005
cdc9005
# Documentation
cdc9005
cd NTS
cdc9005
for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
cdc9005
do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
cdc9005
done
cdc9005
cdc9005
cdc9005
%check
cdc9005
: Minimal load test for NTS extension
cdc9005
cd NTS
cdc9005
%{_bindir}/php --no-php-ini \
cdc9005
    --define extension=modules/%{pecl_name}.so \
cdc9005
    --modules | grep %{pecl_name}
cdc9005
cdc9005
: Upstream test suite for NTS extension
cdc9005
TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \
4519103
%{_bindir}/php -n run-tests.php -q -P --show-diff
cdc9005
cdc9005
cdc9005
%if %{with_zts}
cdc9005
: Minimal load test for ZTS extension
cdc9005
cd ../ZTS
cdc9005
%{__ztsphp} --no-php-ini \
cdc9005
    --define extension=modules/%{pecl_name}.so \
cdc9005
    --modules | grep %{pecl_name}
cdc9005
cdc9005
: Upstream test suite for ZTS extension
cdc9005
TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \
4519103
%{__ztsphp} -n run-tests.php -q -P --show-diff
cdc9005
%endif
cdc9005
cdc9005
cdc9005
%files
cdc9005
%license NTS/LICENSE
cdc9005
%doc %{pecl_docdir}/%{pecl_name}
cdc9005
%{pecl_xmldir}/%{name}.xml
cdc9005
cdc9005
%config(noreplace) %{php_inidir}/%{ini_name}
cdc9005
%{php_extdir}/%{pecl_name}.so
cdc9005
cdc9005
%if %{with_zts}
cdc9005
%config(noreplace) %{php_ztsinidir}/%{ini_name}
cdc9005
%{php_ztsextdir}/%{pecl_name}.so
cdc9005
%endif
cdc9005
cdc9005
cdc9005
%changelog
4519103
* Wed Nov 24 2021 Remi Collet <remi@remirepo.net> - 1.0.10-1
4519103
- update to 1.0.10
4519103
47dc5ab
* Thu Oct 28 2021 Remi Collet <remi@remirepo.net> - 1.0.9-3
47dc5ab
- rebuild for https://fedoraproject.org/wiki/Changes/php81
47dc5ab
7882af3
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.9-2
7882af3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
7882af3
27ba9a0
* Mon Jun  7 2021 Remi Collet <remi@remirepo.net> - 1.0.9-1
27ba9a0
- update to 1.0.9
27ba9a0
078559f
* Fri Mar 19 2021 Remi Collet <remi@remirepo.net> - 1.0.7-1
078559f
- update to 1.0.7
078559f
e7ffc39
* Thu Mar  4 2021 Remi Collet <remi@remirepo.net> - 1.0.6-5
e7ffc39
- rebuild for https://fedoraproject.org/wiki/Changes/php80
e7ffc39
- add upstream patch for test suite with PHP 8
e7ffc39
7246e1f
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-4
7246e1f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
7246e1f
6b0d906
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-3
6b0d906
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
6b0d906
40cca40
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.6-2
40cca40
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
40cca40
b4fd057
* Thu Oct 03 2019 Remi Collet <remi@remirepo.net> - 1.0.6-1
b4fd057
- update to 1.0.6
35a012a
- rebuild for https://fedoraproject.org/wiki/Changes/php74
35a012a
962db68
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.5-2
962db68
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
962db68
48885c8
* Tue Jun 11 2019 Remi Collet <remi@remirepo.net> - 1.0.5-1
48885c8
- update to 1.0.5
48885c8
f24f062
* Mon Jun  3 2019 Remi Collet <remi@remirepo.net> - 1.0.4-1
f24f062
- update to 1.0.4
f24f062
050abf6
* Mon May  6 2019 Remi Collet <remi@remirepo.net> - 1.0.3-1
050abf6
- update to 1.0.3
050abf6
a734a48
* Sun Mar 31 2019 Remi Collet <remi@remirepo.net> - 1.0.2-1
a734a48
- update to 1.0.2
a734a48
94abb4d
* Mon Mar 25 2019 Remi Collet <remi@remirepo.net> - 1.0.1-1
94abb4d
- update to 1.0.1
94abb4d
cdc9005
* Fri Feb  1 2019 Remi Collet <remi@remirepo.net> - 1.0.0-2
cdc9005
- cleanup SCL stuff for Fedora review
cdc9005
cdc9005
* Wed Jan 30 2019 Remi Collet <remi@remirepo.net> - 1.0.0-1
cdc9005
- update to 1.0.0 (stable)
cdc9005
- raise dependency on PHP 7.1
cdc9005
- switch to production recommended configuration
cdc9005
cdc9005
* Tue Jan 22 2019 Remi Collet <remi@remirepo.net> - 0.9.0-1
cdc9005
- initial package, version 0.9.0 (beta)