# remirepo spec file for php-twig # With SCL stuff, from Fedora: # # Fedora spec file for php-twig # # Copyright (c) 2014-2019 Shawn Iwinski # Remi Collet # # License: MIT # http://opensource.org/licenses/MIT # # Please preserve changelog entries # %if 0%{?scl:1} # PHPUnit not available in SCL %global with_tests 0 %global sub_prefix %{scl_prefix} %scl_package php-twig %else %global pkg_name %{name} %if 0%{?fedora} || 0%{?rhel} >= 8 # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} %else # Build using "--with tests" to enable tests # PHPUnit in remi requires PHP 5.6 %global with_tests 0%{?_with_tests:1} %endif %endif %global github_owner twigphp %global github_name Twig %global github_version 1.40.1 %global github_commit 35889516bbd6bbe46a600c2c33b03515df4a076e %global github_short %(c=%{github_commit}; echo ${c:0:7}) %if "%{php_version}" < "7" %global with_ext 1 %else %global with_ext 0 BuildArch: noarch %endif # Lib %global composer_vendor twig %global composer_project twig # Ext %global ext_name twig %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %if "%{php_version}" < "5.6" %global ini_name %{ext_name}.ini %else %global ini_name 40-%{ext_name}.ini %endif # "php": ">=5.4.0" %global php_min_ver 5.4 %global phpdir %{_datadir}/php Name: %{?sub_prefix}php-%{composer_project} Version: %{github_version} Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: The flexible, fast, and secure template engine for PHP License: BSD URL: http://twig.sensiolabs.org Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{pkg_name}-%{github_version}-%{github_short}.tar.gz BuildRequires: %{?scl_prefix}php-devel >= %{php_min_ver} %if %{with_tests} # For tests BuildRequires: php-composer(phpunit/phpunit) %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 BuildRequires: (php-composer(symfony/debug) >= 2.7 with php-composer(symfony/debug) < 3) BuildRequires: (php-composer(psr/container) >= 1.0 with php-composer(psr/container) < 2) %else BuildRequires: php-symfony-debug >= 2.7 BuildRequires: php-composer(psr/container) < 2 BuildRequires: php-composer(psr/container) >= 1.0 %endif ## phpcompatinfo (computed from version 1.34.2) BuildRequires: %{?scl_prefix}php-ctype BuildRequires: %{?scl_prefix}php-date BuildRequires: %{?scl_prefix}php-dom BuildRequires: %{?scl_prefix}php-hash BuildRequires: %{?scl_prefix}php-iconv BuildRequires: %{?scl_prefix}php-json BuildRequires: %{?scl_prefix}php-mbstring BuildRequires: %{?scl_prefix}php-pcre BuildRequires: %{?scl_prefix}php-reflection BuildRequires: %{?scl_prefix}php-spl %endif # Autoloader BuildRequires: php-fedora-autoloader-devel # Lib ## composer.json Requires: %{?scl_prefix}php(language) >= %{php_min_ver} ## phpcompatinfo (computed from version 1.34.2) Requires: %{?scl_prefix}php-ctype Requires: %{?scl_prefix}php-date Requires: %{?scl_prefix}php-dom Requires: %{?scl_prefix}php-hash Requires: %{?scl_prefix}php-iconv Requires: %{?scl_prefix}php-json Requires: %{?scl_prefix}php-mbstring Requires: %{?scl_prefix}php-pcre Requires: %{?scl_prefix}php-reflection Requires: %{?scl_prefix}php-spl %if %{with_ext} # Ext Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} %endif # Autoloader Requires: php-composer(fedora/autoloader) # Lib ## Composer Provides: %{?scl_prefix}php-composer(%{composer_vendor}/%{composer_project}) = %{version} ## Rename Obsoletes: %{?scl_prefix}php-twig-Twig < %{version}-%{release} Provides: %{?scl_prefix}php-twig-Twig = %{version}-%{release} ## PEAR Provides: %{?scl_prefix}php-pear(pear.twig-project.org/Twig) = %{version} %if %{with_ext} # Ext ## Rename Obsoletes: %{?scl_prefix}php-twig-ctwig < %{version}-%{release} Provides: %{?scl_prefix}php-twig-ctwig = %{version}-%{release} Provides: %{?scl_prefix}php-twig-ctwig%{?_isa} = %{version}-%{release} %if "%{?scl_prefix}" != "%{?sub_prefix}" ## Compat SCL (rh-php56) Provides: %{?scl_prefix}php-twig = %{version}-%{release} Provides: %{?scl_prefix}php-twig%{?_isa} = %{version}-%{release} %endif ## PECL Provides: %{?scl_prefix}php-pecl(pear.twig-project.org/CTwig) = %{version} Provides: %{?scl_prefix}php-pecl(pear.twig-project.org/CTwig)%{?_isa} = %{version} %endif # This pkg was the only one in this channel so the channel is no longer needed Obsoletes: %{?scl_prefix}php-channel-twig %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff Obsoletes: php53-%{ext_name} <= %{version} Obsoletes: php53u-%{ext_name} <= %{version} Obsoletes: php54-%{ext_name} <= %{version} Obsoletes: php54w-%{ext_name} <= %{version} %if "%{php_version}" > "5.5" Obsoletes: php55u-%{ext_name} <= %{version} Obsoletes: php55w-%{ext_name} <= %{version} %endif %if "%{php_version}" > "5.6" Obsoletes: php56u-%{ext_name} <= %{version} Obsoletes: php56w-%{ext_name} <= %{version} %endif %if "%{php_version}" > "7.0" Obsoletes: php70u-%{ext_name} <= %{version} Obsoletes: php70w-%{ext_name} <= %{version} %endif %if "%{php_version}" > "7.1" Obsoletes: php71u-%{ext_name} <= %{version} Obsoletes: php71w-%{ext_name} <= %{version} %endif %if "%{php_version}" > "7.2" Obsoletes: php72u-%{ext_name} <= %{version} Obsoletes: php72w-%{ext_name} <= %{version} %endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 # Filter shared private %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} %endif %description %{summary}. * Fast: Twig compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum. * Secure: Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design. * Flexible: Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL. Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. %prep %setup -qn %{github_name}-%{github_commit} : PHP version %{php_version} : Build extension %{with_ext} %if %{with_ext} : Ext -- NTS mv ext/%{ext_name} ext/NTS sed -e '/PHP_TWIG_VERSION/s/-DEV//' -i ext/NTS/php_twig.h %if %{with_zts} : Ext -- ZTS cp -pr ext/NTS ext/ZTS %endif : Ext -- Create configuration file cat > %{ini_name} << 'INI' ; Enable %{ext_name} extension module extension=%{ext_name}.so INI %endif : Move the PSR-4 compat library mv src lib/Twig/psr4 : Create lib autoloader phpab --template fedora --output lib/Twig/autoload.php lib %build %{?dtsenable} %if %{with_ext} : Ext -- NTS pushd ext/NTS %{_bindir}/phpize %configure --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} popd : Ext -- ZTS %if %{with_zts} pushd ext/ZTS %{_bindir}/zts-phpize %configure --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} popd %endif %endif %install %{?dtsenable} : PSR-0 and PSR-4 Libraries mkdir -p %{buildroot}%{phpdir} cp -rp lib/* %{buildroot}%{phpdir}/ %if %{with_ext} : Ext -- NTS make -C ext/NTS install INSTALL_ROOT=%{buildroot} install -D -m 0644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} : Ext -- ZTS %if %{with_zts} make -C ext/ZTS install INSTALL_ROOT=%{buildroot} install -D -m 0644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif %endif %check : Library version check %{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Twig/autoload.php"; exit(version_compare("%{version}", Twig_Environment::VERSION, "=") ? 0 : 1);' %{_bindir}/php -r 'require_once "%{buildroot}%{phpdir}/Twig/autoload.php"; exit(version_compare("%{version}", Twig\Environment::VERSION, "=") ? 0 : 1);' %if %{with_ext} : Extension version check EXT_VERSION=`grep PHP_TWIG_VERSION ext/NTS/php_twig.h | awk '{print $3}' | sed 's/"//g'` \ %{_bindir}/php -r 'exit(version_compare("%{version}", getenv("EXT_VERSION"), "=") ? 0 : 1);' : Extension NTS minimal load test %{__php} --no-php-ini \ --define extension=ext/NTS/modules/%{ext_name}.so \ --modules | grep %{ext_name} %if %{with_zts} : Extension ZTS minimal load test %{__ztsphp} --no-php-ini \ --define extension=ext/ZTS/modules/%{ext_name}.so \ --modules | grep %{ext_name} %endif %endif %if %{with_tests} : Generate autoloader mkdir vendor cat << 'EOF' | tee vendor/autoload.php phpunit.xml : Test suite without extension ret=0 for cmd in php php71 php72 php73; do if which $cmd; then $cmd %{_bindir}/phpunit --verbose || ret=1 fi done %if %{with_ext} : Test suite with extension %{_bindir}/php --define extension=ext/NTS/modules/%{ext_name}.so \ %{_bindir}/phpunit --verbose || ret=1 %endif exit $ret %else : Tests skipped %endif %files %{!?_licensedir:%global license %%doc} %license LICENSE %doc CHANGELOG README.rst composer.json # Lib %{phpdir}/Twig %if %{with_ext} # Ext ## NTS %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{ext_name}.so ## ZTS %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} %{php_ztsextdir}/%{ext_name}.so %endif %endif %changelog * Tue Apr 30 2019 Remi Collet - 1.40.1-1 - update to 1.40.1 * Mon Apr 29 2019 Remi Collet - 1.40.0-1 - update to 1.40.0 * Wed Apr 17 2019 Remi Collet - 1.39.1-1 - update to 1.39.1 * Mon Mar 25 2019 Remi Collet - 1.38.4-1 - update to 1.38.4 * Fri Mar 22 2019 Remi Collet - 1.38.3-1 - update to 1.38.3 * Wed Mar 13 2019 Remi Collet - 1.38.2-1 - update to 1.38.2 * Tue Mar 12 2019 Remi Collet - 1.38.0-1 - update to 1.38.0 * Mon Jan 14 2019 Remi Collet - 1.37.1-1 - update to 1.37.1 - bump dependency on PHP 5.4 * Tue Dec 18 2018 Remi Collet - 1.36.0-1 - update to 1.36.0 * Fri Jul 13 2018 Remi Collet - 1.35.4-1 - update to 1.35.4 * Tue Mar 20 2018 Remi Collet - 1.35.3-1 - update to 1.35.3 * Sun Mar 4 2018 Remi Collet - 1.35.2-1 - Update to 1.35.2 * Sat Mar 3 2018 Remi Collet - 1.35.1-1 - Update to 1.35.1 - use range dependencies on F27+ * Thu Sep 28 2017 Remi Collet - 1.35.0-1 - Update to 1.35.0 * Wed Jul 5 2017 Remi Collet - 1.34.4-1 - Update to 1.34.4 * Thu Jun 8 2017 Remi Collet - 1.34.3-1 - Update to 1.34.3 * Tue Jun 6 2017 Remi Collet - 1.34.2-1 - Update to 1.34.2 - raise dependency on PHP 5.3.3 - add namespaced compat library - switch to fedora/autoloader * Fri Apr 21 2017 Remi Collet - 1.33.2-1 - Update to 1.33.2 * Thu Mar 23 2017 Remi Collet - 1.33.0-1 - Update to 1.33.0 * Mon Feb 27 2017 Remi Collet - 1.32.0-1 - Update to 1.32.0 * Thu Jan 12 2017 Remi Collet - 1.31.0-1 - Update to 1.31.0 * Fri Dec 23 2016 Remi Collet - 1.30.0-1 - Update to 1.30.0 * Wed Dec 14 2016 Remi Collet - 1.29.0-1 - Update to 1.29.0 * Thu Nov 24 2016 Remi Collet - 1.28.2-1 - Update to 1.28.2 * Tue Nov 22 2016 Remi Collet - 1.28.1-1 - Update to 1.28.1 * Fri Nov 18 2016 Remi Collet - 1.28.0-1 - Update to 1.28.0 * Wed Oct 26 2016 Remi Collet - 1.27.0-1 - Update to 1.27.0 * Thu Oct 6 2016 Remi Collet - 1.26.1-1 - Update to 1.26.1 * Mon Oct 3 2016 Remi Collet - 1.26.0-1 - Update to 1.26.0 * Thu Sep 22 2016 Remi Collet - 1.25.0-1 - Update to 1.25.0 * Fri Sep 2 2016 Remi Collet - 1.24.2-1 - Update to 1.24.2 * Mon Jun 27 2016 Remi Collet - 1.24.1-2 - fix dependency with PHP-7 * Mon May 30 2016 Remi Collet - 1.24.1-1 - Update to 1.24.1 - disable deprecation warning - disable extension build with PHP 7 * Tue Jan 26 2016 Remi Collet - 1.24.0-1 - Update to 1.24.0 * Mon Jan 11 2016 Remi Collet - 1.23.3-1 - Update to 1.23.3 - run test suite with both PHP 5 and 7 when available * Thu Nov 05 2015 Remi Collet - 1.23.1-1 - Update to 1.23.1 * Fri Oct 30 2015 Remi Collet - 1.23.0-1 - Update to 1.23.0 * Tue Oct 13 2015 Remi Collet - 1.22.3-1 - Update to 1.22.3 * Sun Oct 11 2015 Shawn Iwinski - 1.22.2-1 - Updated to 1.22.2 (RHBZ #1262655) - Added lib and ext version checks * Wed Sep 23 2015 Remi Collet - 1.22.2-1 - Update to 1.22.2 * Tue Sep 15 2015 Remi Collet - 1.22.1-1 - Update to 1.22.1 * Sun Sep 13 2015 Remi Collet - 1.22.0-1 - Update to 1.22.0 * Sat Sep 12 2015 Shawn Iwinski - 1.21.2-1 - Updated to 1.21.2 (BZ #1256767) * Wed Sep 9 2015 Remi Collet - 1.21.2-1 - Update to 1.21.2 * Wed Aug 26 2015 Remi Collet - 1.21.1-1 - Update to 1.21.1 * Tue Aug 25 2015 Remi Collet - 1.21.0-1 - Update to 1.21.0 * Wed Aug 12 2015 Shawn Iwinski - 1.20.0-1 - Updated to 1.20.0 (BZ #1249259) * Wed Aug 12 2015 Remi Collet - 1.20.0-1 - Update to 1.20.0 * Fri Jul 31 2015 Remi Collet - 1.19.0-1 - Update to 1.19.0 * Mon Jun 22 2015 Remi Collet - 1.18.2-4 - add virtual "rh-php56" provides * Fri Jun 19 2015 Remi Collet - 1.18.2-3 - allow build against rh-php56 (as more-php56) * Mon Jun 15 2015 Remi Collet - 1.18.2-2 - rebuild for remirepo with rawhide changes (autoloader) * Thu Jun 11 2015 Shawn Iwinski - 1.18.2-1 - Updated to 1.18.2 (BZ #1183601) - Added autoloader * Sun Jun 7 2015 Remi Collet - 1.18.2-1 - Update to 1.18.2 * Sun Apr 19 2015 Remi Collet - 1.18.1-1 - Update to 1.18.1 * Mon Jan 26 2015 Remi Collet - 1.18.0-1 - Update to 1.18.0 * Wed Jan 14 2015 Remi Collet - 1.17.0-1 - Update to 1.17.0 * Fri Dec 26 2014 Remi Collet - 1.16.3-1 - Update to 1.16.3 * Wed Dec 24 2014 Remi Collet - 1.16.2-1.1 - Fedora 21 SCL mass rebuild * Fri Oct 17 2014 Remi Collet - 1.16.2-1 - Update to 1.16.2 * Sat Oct 11 2014 Remi Collet - 1.16.1-1 - Update to 1.16.1 * Thu Aug 28 2014 Remi Collet - 1.16.0-2 - allow SCL build - add backport stuff for EL-5 * Mon Aug 25 2014 Shawn Iwinski - 1.16.0-2 - Removed obsolete and provide of php-twig-CTwig (never imported into Fedora/EPEL) - Obsolete php-channel-twig - Removed comment about optional Xdebug in description (does not provide any new feature) - Always run extension minimal load test * Tue Jul 29 2014 Shawn Iwinski - 1.16.0-1 - Initial package