From ff2674d48aa99dcc3478d503aa555ed7ad09547d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 2 Sep 2020 10:57:36 +0200 Subject: rebuild for PHP 8.0.0beta3 --- 73.patch | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php-smbclient.spec | 28 ++++++++------- 2 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 73.patch diff --git a/73.patch b/73.patch new file mode 100644 index 0000000..28ab97d --- /dev/null +++ b/73.patch @@ -0,0 +1,101 @@ +From 951f266b04c381a13d33d6445abe5d15c3fd8c53 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 1 Sep 2020 09:57:04 +0200 +Subject: [PATCH 1/2] fix for changes in stream in 7.4 + +--- + smb_streams.c | 23 ++++++++++++++++++++++- + 1 file changed, 22 insertions(+), 1 deletion(-) + +diff --git a/smb_streams.c b/smb_streams.c +index b6f73c6..8448dd6 100644 +--- a/smb_streams.c ++++ b/smb_streams.c +@@ -190,7 +190,11 @@ static int php_smb_ops_flush(php_stream *stream TSRMLS_DC) + return 0; + } + ++#if PHP_VERSION_ID < 70400 + static size_t php_smb_ops_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) ++#else ++static ssize_t php_smb_ops_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) ++#endif + { + ssize_t n = 0; + STREAM_DATA_FROM_STREAM(); +@@ -208,12 +212,20 @@ static size_t php_smb_ops_read(php_stream *stream, char *buf, size_t count TSRML + if (n == 0 || n < (ssize_t)count) { + stream->eof = 1; + } ++#if PHP_VERSION_ID < 70400 + return (n < 1 ? 0 : (size_t)n); ++#else ++ return n; ++#endif + } + ++#if PHP_VERSION_ID < 70400 + static size_t php_smb_ops_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) ++#else ++static ssize_t php_smb_ops_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) ++#endif + { +- size_t len = 0; ++ ssize_t len = 0; + STREAM_DATA_FROM_STREAM(); + + if (!self || !self->handle) { +@@ -225,7 +237,12 @@ static size_t php_smb_ops_write(php_stream *stream, const char *buf, size_t coun + if (self->smbc_write) { + len = self->smbc_write(self->state->ctx, self->handle, buf, count); + } ++ ++#if PHP_VERSION_ID < 70400 ++ return (len < 0 ? 0 : (size_t)len); ++#else + return len; ++#endif + } + + static int php_smb_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */ +@@ -500,7 +517,11 @@ static int php_smbdir_ops_close(php_stream *stream, int close_handle TSRMLS_DC) + return EOF; + } + ++#if PHP_VERSION_ID < 70400 + static size_t php_smbdir_ops_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) ++#else ++static ssize_t php_smbdir_ops_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) ++#endif + { + struct smbc_dirent *dirent; + php_stream_dirent *ent = (php_stream_dirent*)buf; + +From 93c27f7c7680110b130641cf874207625bcc454a Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 1 Sep 2020 09:57:20 +0200 +Subject: [PATCH 2/2] fix for upcoming PHP 8 + +--- + php_smbclient.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/php_smbclient.h b/php_smbclient.h +index ee17501..6b26ebe 100644 +--- a/php_smbclient.h ++++ b/php_smbclient.h +@@ -128,6 +128,14 @@ PHP_FUNCTION(smbclient_fstatvfs); + #endif + #endif + ++#if PHP_MAJOR_VERSION >= 8 ++#define TSRMLS_D void ++#define TSRMLS_DC ++#define TSRMLS_C ++#define TSRMLS_CC ++#define TSRMLS_FETCH() ++#endif ++ + extern php_stream_wrapper php_stream_smb_wrapper; + php_smbclient_state * php_smbclient_state_new (php_stream_context *context, int init TSRMLS_DC); + void php_smbclient_state_free (php_smbclient_state *state TSRMLS_DC); diff --git a/php-smbclient.spec b/php-smbclient.spec index fa33321..4a24547 100644 --- a/php-smbclient.spec +++ b/php-smbclient.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-smbclient # -# Copyright (c) 2015-2019 Remi Collet +# Copyright (c) 2015-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -39,7 +39,7 @@ Version: 1.0.0 %if 0%{?gh_date} Release: 0.8.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %else -Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 8%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %endif Summary: PHP wrapper for libsmbclient @@ -56,6 +56,7 @@ Source2: %{gh_project}-phpunit.xml %endif Patch0: https://patch-diff.githubusercontent.com/raw/eduardok/libsmbclient-php/pull/65.patch +Patch1: https://patch-diff.githubusercontent.com/raw/eduardok/libsmbclient-php/pull/73.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -83,30 +84,25 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff %if "%{php_version}" > "7.0" Obsoletes: php70u-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.1" Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif %endif @@ -140,7 +136,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -#patch0 -p1 -b .pr65 +%patch0 -p1 -b .pr65 +%patch1 -p1 -b .pr73 # Check extension version ver=$(sed -n '/define PHP_SMBCLIENT_VERSION/{s/.* "//;s/".*$//;p}' php_smbclient.h) @@ -259,6 +256,13 @@ fi %changelog +* Wed Sep 2 2020 Remi Collet - 1.0.0-8 +- rebuild for PHP 8.0.0beta3 + +* Tue Sep 1 2020 Remi Collet - 1.0.0-7 +- add patch for PHP 7.4 and 8.0 from + https://github.com/eduardok/libsmbclient-php/pull/73 + * Tue Sep 03 2019 Remi Collet - 1.0.0-4 - rebuild for 7.4.0RC1 -- cgit