File php7-smbclient.spec of Package php7-smbclient

# spec file for package php7-smbclient
# Copyright (c) 2019 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 pkg_name smbclient
Name:           php7-smbclient
Version:        1.0.0
Release:        0
Summary:        A PHP wrapper for libsmbclient
License:        PHP-3.01
Group:          Productivity/Networking/Web/Servers
BuildRequires:  php7-devel >= 7.0
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(smbclient)
Patch0:         0001-fix-incorrect-deallocation-of-zend_string.patch
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
Provides:       php-smbclient = %{version}
Obsoletes:      php-smbclient < %{version}

smbclient is a PHP extension that uses Samba's libsmbclient library to provide
Samba related functions and 'smb' streams to PHP programs.

%setup -q -n %{pkg_name}-%{version}
%patch0 -p1
export CFLAGS="%{optflags} -fvisibility=hidden"
make %{?_smp_mflags}

make %{?_smp_mflags} test PHP_EXECUTABLE=%{_bindir}/php NO_INTERACTION=1

make install INSTALL_ROOT=%{buildroot}
mkdir -p %{buildroot}%{_sysconfdir}/php7/conf.d
echo "; comment out next line to disable smbclient extension in php" > %{buildroot}%{_sysconfdir}/php7/conf.d/%{pkg_name}.ini
echo 'extension =' >> %{buildroot}%{_sysconfdir}/php7/conf.d/%{pkg_name}.ini

%config(noreplace) %{_sysconfdir}/php7/conf.d/%{pkg_name}.ini