# Fedora spec file for php-pecl-uploadprogress # # Copyright (c) 2023 Bussi Andrea # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # we don't want -z defs linker flag %undefine _strict_symbol_defs_build %global pecl_name uploadprogress %global with_zts 0%{?__ztsphp:1} %global ini_name 40-%{pecl_name}.ini Summary: An extension to track progress of a file upload Name: php-pecl-uploadprogress Version: 2.0.2 Release: 1%{?dist} License: LGPLv2+ URL: https://pecl.php.net/package/%{pecl_name} Source: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz BuildRequires: make BuildRequires: gcc BuildRequires: php-devel > 7.2 BuildRequires: php-pear Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} # both provides same extension, with different API Provides: php-%{pecl_name} = %{version} Provides: php-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} %description A PHP extension to track progress of a file upload, including details on the speed of the upload, estimated time remaining, and access to the contents of the file as it is being uploaded. The uploadprogress extension works on PHP 7.2+ and PHP 8. It works with Apache HTTP Server using mod_php, as well as Apache HTTP Server, nginx, and Caddy through PHP-FPM. It might work on other web servers; let us know where you're using it. See https://github.com/php/pecl-php-uploadprogress for documentation and examples. %prep %setup -q -c # Don't install/register tests #sed -e 's/role="test"/role="src"/' \ # -e '/LICENSE/s/role="doc"/role="src"/' \ # -i package.xml mv %{pecl_name}-%{version} NTS #cd NTS # Sanity check, really often broken #extver=$(sed -n '/#define PHP_UUID_VERSION/{s/.* "//;s/".*$//;p}' php_uuid.h) #if test "x${extver}" != "x%{version}"; then # : Error: Upstream extension version is ${extver}, expecting %{version}. # exit 1 #fi #cd .. %if %{with_zts} # duplicate for ZTS build cp -pr NTS ZTS %endif # Drop in the bit of configuration cat > %{ini_name} << 'EOF' ; Enable %{pecl_name} extension module extension = %{pecl_name}.so EOF %build export PHP_RPATH=no cd NTS %{_bindir}/phpize %configure \ --with-php-config=%{_bindir}/php-config \ --with-libdir=%{_lib} \ --enable-uploadprogress make %{?_smp_mflags} %if %{with_zts} cd ../ZTS %{_bindir}/zts-phpize %configure \ --with-php-config=%{_bindir}/zts-php-config \ --with-libdir=%{_lib} \ --enable-uploadprogress make %{?_smp_mflags} %endif %install # Install the NTS stuff make -C NTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} %if %{with_zts} # Install the ZTS stuff make -C ZTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # Install the package XML file install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml # Documentation cd NTS for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done %check cd NTS TEST_PHP_EXECUTABLE=%{_bindir}/php \ TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{_bindir}/php -n run-tests.php %if %{with_zts} cd ../ZTS TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php %endif %post %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : %postun if [ $1 -eq 0 ] ; then %{pecl_uninstall} %{pecl_name} >/dev/null || : fi %files %license NTS/LICENSE %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so %if %{with_zts} %{php_ztsextdir}/%{pecl_name}.so %config(noreplace) %{php_ztsinidir}/%{ini_name} %endif %changelog * Mon Mar 6 2023 Bussi Andrea - 2.0.2-1 - Initial version