summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-pecl-apfd.spec85
1 files changed, 42 insertions, 43 deletions
diff --git a/php-pecl-apfd.spec b/php-pecl-apfd.spec
index 977d17c..6192ca6 100644
--- a/php-pecl-apfd.spec
+++ b/php-pecl-apfd.spec
@@ -3,36 +3,39 @@
#
# Fedora spec file for php-pecl-apfd
#
-# Copyright (c) 2015-2021 Remi Collet
-# License: CC-BY-SA
+# Copyright (c) 2015-2023 Remi Collet
+# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
-# we don't want -z defs linker flag
-%undefine _strict_symbol_defs_build
+%{?scl:%scl_package php-pecl-apfd}
-%if 0%{?scl:1}
-%global sub_prefix %{scl_prefix}
-%scl_package php-pecl-apfd
-%endif
+%bcond_without tests
+
+# For PHP < 5.6 and EPEL-9
+%{!?__phpize: %global __phpize %{_bindir}/phpize}
+%{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize}
+%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config}
+%{!?__ztsphpconfig:%global __ztsphpconfig %{_bindir}/zts-php-config}
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global pecl_name apfd
-%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
%if "%{php_version}" < "5.6"
%global ini_name %{pecl_name}.ini
%else
%global ini_name 40-%{pecl_name}.ini
%endif
#global prever RC1
+%global sources %{pecl_name}-%{version}
+%global _configure ../%{sources}/configure
Summary: Always Populate Form Data
-Name: %{?sub_prefix}php-pecl-%{pecl_name}
+Name: %{?scl_prefix}php-pecl-%{pecl_name}
Version: 1.0.3
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
-License: BSD
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+License: BSD-2-Clause
URL: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
@@ -40,10 +43,12 @@ BuildRequires: %{?dtsprefix}gcc
BuildRequires: make
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
+%if %{with tests}
+BuildRequires: %{?scl_prefix}php-pecl-json-post
+%endif
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
-%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
@@ -52,19 +57,6 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
# Split off pecl/http
Conflicts: %{?scl_prefix}php-pecl(http) < 2.4
-%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
-# Other third party repo stuff
-%if "%{php_version}" > "7.4"
-Obsoletes: php74-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "8.0"
-Obsoletes: php80-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "8.1"
-Obsoletes: php81-pecl-%{pecl_name} <= %{version}
-%endif
-%endif
-
%description
This tiny extension lets PHP's post handler parse `multipart/form-data` and
@@ -78,14 +70,13 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -q -c
-mv %{pecl_name}-%{version}%{?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
-cd NTS
+cd %{sources}
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_APFD_VERSION/{s/.* "//;s/".*$//;p}' php_apfd.h)
if test "x${extver}" != "x%{version}%{?prever}"; then
@@ -94,9 +85,9 @@ if test "x${extver}" != "x%{version}%{?prever}"; then
fi
cd ..
+mkdir NTS
%if %{with_zts}
-# Duplicate source tree for NTS / ZTS build
-cp -pr NTS ZTS
+mkdir ZTS
%endif
# Create configuration file
@@ -109,19 +100,20 @@ EOF
%build
%{?dtsenable}
-cd NTS
-%{_bindir}/phpize
+cd %{sources}
+%{__phpize}
+
+cd ../NTS
%configure \
--enable-apfd \
- --with-php-config=%{_bindir}/php-config
+ --with-php-config=%{__phpconfig}
make %{?_smp_mflags}
%if %{with_zts}
cd ../ZTS
-%{_bindir}/zts-phpize
%configure \
--enable-apfd \
- --with-php-config=%{_bindir}/zts-php-config
+ --with-php-config=%{__ztsphpconfig}
make %{?_smp_mflags}
%endif
@@ -145,7 +137,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
# Documentation
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
+do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
@@ -170,19 +162,22 @@ fi
%check
-cd NTS
+cd %{sources}
+
: Minimal load test for NTS extension
%{__php} --no-php-ini \
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
-%if %{with_tests}
+%if %{with tests}
: Upstream test suite for NTS extension
+OPT="-n"
+[ -f %{php_extdir}/json_post.so ] && OPT="$OPT -d extension=json_post.so"
+
TEST_PHP_EXECUTABLE=%{__php} \
-TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \
-NO_INTERACTION=1 \
+TEST_PHP_ARGS="$OPT -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \
REPORT_EXIT_STATUS=1 \
-%{__php} -n run-tests.php --show-diff
+%{__php} -n run-tests.php -q --show-diff
%endif
%if %{with_zts}
@@ -192,7 +187,7 @@ cd ../ZTS
--define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
-%if %{with_tests}
+%if %{with tests}
: Upstream test suite skipped as zts-php-cgi not available
%endif
%endif
@@ -200,7 +195,7 @@ cd ../ZTS
%files
%doc %{pecl_docdir}/%{pecl_name}
-%{?_licensedir:%license NTS/LICENSE}
+%{?_licensedir:%license %{sources}/LICENSE}
%{pecl_xmldir}/%{name}.xml
%config(noreplace) %{php_inidir}/%{ini_name}
@@ -213,6 +208,10 @@ cd ../ZTS
%changelog
+* Fri Jul 7 2023 Remi Collet <remi@remirepo.net> - 1.0.3-2
+- build out of sources tree
+- enable json_post for test suite
+
* Tue Oct 5 2021 Remi Collet <remi@remirepo.net> - 1.0.3-1
- update to 1.0.3
- drop patch merged upstream