# we don't want -z defs linker flag %undefine _strict_symbol_defs_build %{!?__php: %global __php %{_bindir}/php} %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} %{!?php_version: %global php_version %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} %{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} %global pecl_name datadog_trace %global mod_name ddtrace %global with_zts 0%{?__ztsphp:1} %global package_name %{pecl_name} %global ini_name 40-%{pecl_name}.ini Summary: APM and distributed tracing for PHP to Datadog Name: php-pecl-%{package_name} Version: 0.48.3 Release: 1%{?dist} License: ASL 2.0 or BSD URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz BuildRequires: php-devel BuildRequires: php-pear BuildRequires: libcurl-devel BuildRequires: php-curl BuildRequires: php-json Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} Requires: php-curl Requires: php-json Provides: php-%{pecl_name} = %{version}-%{release} Provides: php-%{pecl_name}%{?_isa} = %{version}-%{release} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} Provides: php-%{mod_name} = %{version}-%{release} Provides: php-%{mod_name}%{?_isa} = %{version}-%{release} Provides: php-pecl(%{mod_name}) = %{version} Provides: php-pecl(%{mod_name})%{?_isa} = %{version} %description The Datadog PHP Tracer brings APM and distributed tracing to PHP. %prep %setup -q -c mv %{pecl_name}-%{version}%{?prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml %if %{with_zts} # Duplicate source tree for NTS / ZTS build cp -pr NTS ZTS %endif # Create configuration file cat > %{ini_name} << 'EOF' ; Enable %{pecl_name} extension module extension=%{mod_name}.so EOF # Copy licensese to top level cp NTS/LICENSE* . %build cd NTS %{_bindir}/phpize %configure \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} %if %{with_zts} cd ../ZTS %{_bindir}/zts-phpize %configure \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} %endif %install make -C NTS install INSTALL_ROOT=%{buildroot} # install config file install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} # Install XML package description install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml %if %{with_zts} make -C ZTS install INSTALL_ROOT=%{buildroot} install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # 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 : Minimal load test for NTS extension cd NTS %{_bindir}/php --no-php-ini \ --define extension=modules/curl.so \ --define extension=modules/json.so \ --define extension=modules/posix.so \ --define extension=modules/%{mod_name}.so \ --modules | grep %{mod_name} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ TEST_PHP_ARGS="-n -d extension=curl.so -d extension=json.so -d extension=posix.so -d extension=$PWD/modules/%{mod_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php --show-diff %if %{with_zts} : Minimal load test for ZTS extension cd ../ZTS %{__ztsphp} --no-php-ini \ --define extension=modules/curl.so \ --define extension=modules/json.so \ --define extension=modules/posix.so \ --define extension=modules/%{mod_name}.so \ --modules | grep %{mod_name} : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=curl.so -d extension=json.so -d extension=posix.so -d extension=$PWD/modules/%{mod_name}.so" \ NO_INTERACTION=1 \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php --show-diff %endif %files %license LICENSE* %doc %{_docdir}/pecl/%{pecl_name}/ %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{mod_name}.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} %{php_ztsextdir}/%{mod_name}.so %endif %changelog * Thu Oct 8 2020 Daniel Axelrod - 0.48.3-1 - Initial packaging