diff options
-rw-r--r-- | php-sqlsrv.spec | 92 | ||||
-rw-r--r-- | sqlsrv-pr153.patch | 22 | ||||
-rw-r--r-- | sqlsrv-pr154.patch | 40 | ||||
-rw-r--r-- | sqlsrv-pr155.patch | 23 |
4 files changed, 159 insertions, 18 deletions
diff --git a/php-sqlsrv.spec b/php-sqlsrv.spec index a9bc65d..08d3ae0 100644 --- a/php-sqlsrv.spec +++ b/php-sqlsrv.spec @@ -8,30 +8,38 @@ # %{?scl: %scl_package php-sqlsrv} -%global __arch_install_post /bin/true -%global debug_package %{nil} -%global __debug_install_post /bin/true +%global gh_commit 4ccffbbe077e87288bf00cc6327142579da46775 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner Microsoft +%global gh_project msphpsql %global extname sqlsrv -%global with_zts 0%{?__ztsphp:1} +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} # After 20-pdo.ini %global ininame 40-%{extname}.ini Name: %{?scl_prefix}php-sqlsrv Summary: Microsoft Drivers for PHP for SQL Server Version: 4.0.4 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT Group: Development/Languages URL: https://github.com/Microsoft/msphpsql -Source0: https://github.com/Microsoft/msphpsql/releases/download/%{version}-Linux/CentOS7.zip#/CentOS7-%{version}.zip -Source1: https://github.com/Microsoft/msphpsql/blob/master/LICENSE +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz + +# https://github.com/Microsoft/msphpsql/pull/153 - build +Patch0: %{extname}-pr153.patch +# https://github.com/Microsoft/msphpsql/pull/154 - odbcver +Patch1: %{extname}-pr154.patch +# https://github.com/Microsoft/msphpsql/pull/155 - PHP 7.1 +Patch2: %{extname}-pr155.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: %{?scl_prefix}php-devel > 7 BuildRequires: %{?scl_prefix}php-pdo BuildRequires: msodbcsql >= 13 +BuildRequires: unixODBC-devel >= 2.3.1 Requires: msodbcsql%{?_isa} >= 13 # ABI check @@ -71,8 +79,14 @@ Package built for PHP %(%{__php} -n -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VER %prep -%setup -q -n CentOS7 -cp %{SOURCE1} LICENSE +%setup -qc +cd %{gh_project}-%{gh_commit} +%patch0 -p1 -b .pr153 +%patch1 -p1 -b .pr154 +%patch2 -p1 -b .pr155 +cd .. + +mv %{gh_project}-%{gh_commit}/source NTS cat << 'EOF' | tee %{ininame} ; Enable '%{summary}' extension module @@ -90,24 +104,60 @@ extension = pdo_%{extname}.so ;pdo_sqlsrv.client_buffer_max_kb_size = 10240 EOF +%if %{with_zts} +# duplicate for ZTS build +cp -pr NTS ZTS +%endif + %build -: tarball provides binaries +: =================== sqlsrv NTS =================== +cd NTS/%{extname} +%{_bindir}/phpize +%configure \ + --with-php-config=%{_bindir}/php-config \ + --enable-sqlsrv +make %{?_smp_mflags} + +: =================== pdo_sqlsrv NTS =================== +cd ../../NTS/pdo_%{extname} +%{_bindir}/phpize +%configure \ + --with-php-config=%{_bindir}/php-config \ + --with-pdo_sqlsrv +make %{?_smp_mflags} + +%if %{with_zts} +: =================== sqlsrv ZTS =================== +cd ../../ZTS/%{extname} +%{_bindir}/zts-phpize +%configure \ + --with-php-config=%{_bindir}/zts-php-config \ + --enable-sqlsrv +make %{?_smp_mflags} + +: =================== pdo_sqlsrv ZTS =================== +cd ../../ZTS/pdo_%{extname} +%{_bindir}/zts-phpize +%configure \ + --with-php-config=%{_bindir}/zts-php-config \ + --with-pdo_sqlsrv +make %{?_smp_mflags} +%endif %install rm -rf %{buildroot} ver=$(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;') - -install -D -pm 755 php_pdo_sqlsrv_7_nts.so %{buildroot}%{php_extdir}/pdo_%{extname}.so -install -D -pm 755 php_sqlsrv_7_nts.so %{buildroot}%{php_extdir}/%{extname}.so -install -D -m 644 %{ininame} %{buildroot}%{php_inidir}/%{ininame} +make -C NTS/%{extname} install INSTALL_ROOT=%{buildroot} +make -C NTS/pdo_%{extname} install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ininame} %{buildroot}%{php_inidir}/%{ininame} %if %{with_zts} -install -D -pm 755 php_pdo_sqlsrv_7_ts.so %{buildroot}%{php_ztsextdir}/pdo_%{extname}.so -install -D -pm 755 php_sqlsrv_7_ts.so %{buildroot}%{php_ztsextdir}/%{extname}.so -install -D -m 644 %{ininame} %{buildroot}%{php_ztsinidir}/%{ininame} +make -C ZTS/%{extname} install INSTALL_ROOT=%{buildroot} +make -C ZTS/pdo_%{extname} install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ininame} %{buildroot}%{php_ztsinidir}/%{ininame} %endif @@ -139,7 +189,7 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} -%license LICENSE +%license %{gh_project}-%{gh_commit}/LICENSE %config(noreplace) %{php_inidir}/%{ininame} %{php_extdir}/%{extname}.so @@ -153,6 +203,12 @@ rm -rf %{buildroot} %changelog +* Fri Sep 16 2016 Remi Collet <remi@remirepo.net> - 4.0.4-2 +- build from sources +- open https://github.com/Microsoft/msphpsql/pull/153 - build +- open https://github.com/Microsoft/msphpsql/pull/154 - odbcver +- open https://github.com/Microsoft/msphpsql/pull/155 - PHP 7.1 + * Fri Sep 16 2016 Remi Collet <remi@remirepo.net> - 4.0.4-1 - initial package diff --git a/sqlsrv-pr153.patch b/sqlsrv-pr153.patch new file mode 100644 index 0000000..566879a --- /dev/null +++ b/sqlsrv-pr153.patch @@ -0,0 +1,22 @@ +From 4152c7bc585f6fff7658776c7a6312b1fbbaedd9 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@famillecollet.com> +Date: Fri, 16 Sep 2016 14:49:56 +0200 +Subject: [PATCH] Fix #152 build failure, unneded come + +--- + source/pdo_sqlsrv/config.m4 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source/pdo_sqlsrv/config.m4 b/source/pdo_sqlsrv/config.m4 +index dd88ae8..dd83f58 100644 +--- a/source/pdo_sqlsrv/config.m4 ++++ b/source/pdo_sqlsrv/config.m4 +@@ -44,7 +44,7 @@ if test "$PHP_PDO_SQLSRV" != "no"; then + PHP_ADD_LIBRARY(stdc++, 1, PDO_SQLSRV_SHARED_LIBADD) + PHP_ADD_LIBRARY(odbc, 1, PDO_SQLSRV_SHARED_LIBADD) + AC_DEFINE(HAVE_PDO_SQLSRV, 1, [ ]) +- PHP_NEW_EXTENSION(pdo_sqlsrv, $sources, $ext_shared,,-I$pdo_cv_inc_path, -std=c++11) ++ PHP_NEW_EXTENSION(pdo_sqlsrv, $sources, $ext_shared,,-I$pdo_cv_inc_path -std=c++11) + PHP_SUBST(PDO_SQLSRV_SHARED_LIBADD) + PHP_ADD_EXTENSION_DEP(pdo_sqlsrv, pdo) + fi diff --git a/sqlsrv-pr154.patch b/sqlsrv-pr154.patch new file mode 100644 index 0000000..ccab311 --- /dev/null +++ b/sqlsrv-pr154.patch @@ -0,0 +1,40 @@ +From 9082b42b45f9bb926189aba875a8a62c54bfb1b8 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Fri, 16 Sep 2016 15:31:23 +0200 +Subject: [PATCH] ensure correct ODBCVER is used + +--- + source/pdo_sqlsrv/xplat.h | 4 ++++ + source/sqlsrv/xplat.h | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/source/pdo_sqlsrv/xplat.h b/source/pdo_sqlsrv/xplat.h +index bede13c..3408f00 100644 +--- a/source/pdo_sqlsrv/xplat.h ++++ b/source/pdo_sqlsrv/xplat.h +@@ -228,6 +228,10 @@ typedef windowsULongLong_t ULONGLONG; + #define UNIXODBC + #endif + ++/* can be defined in php sources */ ++#ifdef ODBCVER ++#undef ODBCVER ++#endif + // Build the mplat driver as an ODBC 3.8 driver, so that all of the + // source code shared with Windows SNAC (which is ODBC 3.8) compiles. + #define ODBCVER 0x0380 +diff --git a/source/sqlsrv/xplat.h b/source/sqlsrv/xplat.h +index bede13c..3408f00 100644 +--- a/source/sqlsrv/xplat.h ++++ b/source/sqlsrv/xplat.h +@@ -228,6 +228,10 @@ typedef windowsULongLong_t ULONGLONG; + #define UNIXODBC + #endif + ++/* can be defined in php sources */ ++#ifdef ODBCVER ++#undef ODBCVER ++#endif + // Build the mplat driver as an ODBC 3.8 driver, so that all of the + // source code shared with Windows SNAC (which is ODBC 3.8) compiles. + #define ODBCVER 0x0380 diff --git a/sqlsrv-pr155.patch b/sqlsrv-pr155.patch new file mode 100644 index 0000000..f655f40 --- /dev/null +++ b/sqlsrv-pr155.patch @@ -0,0 +1,23 @@ +From 66f003c661c430031f7a55bd470fe0da1536a5b1 Mon Sep 17 00:00:00 2001 +From: Remi Collet <fedora@famillecollet.com> +Date: Fri, 16 Sep 2016 15:53:20 +0200 +Subject: [PATCH] Fix PHP 7.1 build + +--- + source/sqlsrv/stmt.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/source/sqlsrv/stmt.cpp b/source/sqlsrv/stmt.cpp +index 90bb025..b3f1dac 100644 +--- a/source/sqlsrv/stmt.cpp ++++ b/source/sqlsrv/stmt.cpp +@@ -881,7 +881,9 @@ PHP_FUNCTION( sqlsrv_fetch_object ) + + memset( &fci, 0, sizeof( fci )); + fci.size = sizeof( fci ); ++#if PHP_VERSION_ID < 70100 + fci.function_table = &( class_entry )->function_table; ++#endif + ZVAL_UNDEF( &( fci.function_name ) ); + fci.retval = &ctor_retval_z; + fci.param_count = num_params; |