File php7-sqlsrv.spec of Package php7-sqlsrv

%define pkg_name sqlsrv
%define version 5.2.0

%define prefix          /DBA/apache24/PHP/%{php_version}
%define maketest        0

Name:       php7-%{pkg_name}
Summary: 	PHP Extension to access Microsoft SQL Server
Version: 	%{version}
Release: 	0
License: 	BSD-2-Clause
Group: 		Productivity/Networking/Web/Servers
BuildRoot: 	%{_tmppath}/%{name}-%{version}-build
BuildRequires:	php7-devel
BuildRequires:	unzip
BuildRequires:	gcc-c++ libstdc++-devel
BuildRequires:	unixODBC-devel
%if 0%{?suse_version} >= 1100
BuildRequires:  -post-build-checks
%if 0%{?suse_version} >= 1200
BuildRequires:  automake libtool
%if %{?php_zend_api}0
Requires:       php(api) = %{php_core_api}
Requires:       php(zend-abi) = %{php_zend_api}
%requires_eq    php7
Requires: msodbcsql
Requires: unixODBC

The PHP extension to access Microsoft SQL Server allows for the reading and writing of SQL Server data from within PHP scripts. 
The SQLSRV extension provides a procedural interface while the PDO_SQLSRV extension 
implements PDO for accessing data in all editions of SQL Server 2008 R2 and later (including Azure SQL DB). 
These drivers rely on the Microsoft ODBC Driver for SQL Server to handle the low-level communication with SQL Server.

%setup -q -n %{pkg_name}-%{version}

CFLAGS="%{optflags} -fno-strict-aliasing"
CXXFLAGS="%{optflags} -fno-strict-aliasing"
%if 0%{?suse_version} > 1000
CFLAGS="$CFLAGS -fstack-protector"
CXXFLAGS="$CXXFLAGS -fstack-protector"

export CFLAGS



%{__make} %{?jobs:-j%jobs}

%if %maketest
%{__make} test

%{__rm} -rf %{buildroot}

%makeinstall INSTALL_ROOT=%{buildroot}
%{__mkdir_p} %{buildroot}%{_sysconfdir}/php7/conf.d
echo "; comment out next line to disable %{pkg_name} extension in php" > %{buildroot}%{_sysconfdir}/php7/conf.d/%{pkg_name}.ini
echo "extension = %{pkg_name}.so" >> %{buildroot}%{_sysconfdir}/php7/conf.d/%{pkg_name}.ini

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