File php5-xdebug.spec of Package php56-xdebug

# spec file for package php5-xdebug
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define php_name    php5
%define pkg_name    xdebug
%define ini_version 2_5_0
Name:           php56-%{pkg_name}
Version:        2.5.0
Release:        0
Summary:        Extended PHP debugger
License:        BSD-3-Clause
Group:          Productivity/Networking/Web/Servers
BuildRequires:  php56
BuildRequires:  php56-devel
BuildRequires:  php56-soap
Obsoletes:      php-xdebug < %{version}
# php-xdebug is intentionally not "provided" as a parallel installation of php5 and php7 should be possible
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %{?php_zend_api}0
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
%requires_eq    %{php_name}

The Xdebug extension helps you debugging your script by providing a lot of
valuable debug information. The debug information that Xdebug can provide
includes the following:

* stack and function traces in error messages with:
o full parameter display for user defined functions
o function name, file name and line indications
o support for member functions
* memory allocation
* protection for infinite recursions

Xdebug also provides:

* profiling information for PHP scripts
* script execution analysis
* capabilities to debug your scripts interactively with a debug client

%setup -q -n %{pkg_name}-%{version}
mkdir %{name}
install -m 644 %{SOURCE1} xdebug.ini

pushd %{name}
export CFLAGS="%{optflags}"
../configure --enable-xdebug
sed -i -e 's|PHP_EXECUTABLE = %{_bindir}/php-cgi|PHP_EXECUTABLE = %{_bindir}/php|' Makefile
make %{?_smp_mflags}
sed -i -e "s|; This is a generated file, do not modify by hand|zend_extension = \"%{_libdir}/%{php_name}/extensions/\"|g" xdebug.ini

make DESTDIR=%{buildroot} install %{?_smp_mflags} -C %{name} INSTALL_ROOT=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/%{php_name}/conf.d
install -m 644 xdebug.ini %{buildroot}%{_sysconfdir}/%{php_name}/conf.d/xdebug.ini

# only check if the extension can be loaded
%{_bindir}/php \
    --no-php-ini \
    --define zend_extension=%{buildroot}%{_libdir}/%{php_name}/extensions/ \
    --modules | grep Xdebug

if [ -x %{_bindir}/zts-php ] ; then
%{_bindir}/zts-php \
    --no-php-ini \
    --define zend_extension=%{buildroot}%{_libdir}/%{php_name}/extensions/ \
    --modules | grep Xdebug

%config(noreplace) %{_sysconfdir}/%{php_name}/conf.d/xdebug.ini