summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-01-29 11:36:34 +0100
committerRemi Collet <remi@php.net>2024-01-29 11:36:34 +0100
commit5c8a2a642ff350de5c9daf0d53c2d433ef0674da (patch)
tree6950ed9323baffe170c7088aa8a99554c77a4333
parent35a6a99493061daca0152cd9346fa05384184307 (diff)
fix incompatible pointer types using upstream patch
build out of sources tree
-rw-r--r--php-smbclient.spec56
-rw-r--r--smbclient-upstream.patch66
2 files changed, 92 insertions, 30 deletions
diff --git a/php-smbclient.spec b/php-smbclient.spec
index 87495d3..5289cef 100644
--- a/php-smbclient.spec
+++ b/php-smbclient.spec
@@ -1,6 +1,6 @@
# remirepo spec file for php-smbclient
#
-# Copyright (c) 2015-2023 Remi Collet
+# Copyright (c) 2015-2024 Remi Collet
# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -20,7 +20,6 @@
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner eduardok
%global gh_project libsmbclient-php
-#global gh_date 20161104
#global prever RC1
%global pecl_name smbclient
@@ -32,29 +31,25 @@
%endif
# Test suite requires a Samba server and configuration file
%bcond_with tests
+%global sources %{pecl_name}-%{version}%{?prever}
+%global _configure ../%{sources}/configure
Name: %{?scl_prefix}php-smbclient
Version: 1.1.1
-%if 0%{?gh_date}
-Release: 0.10.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
-%else
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
-%endif
+Release: 6%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Summary: PHP wrapper for libsmbclient
License: BSD-2-Clause
URL: https://github.com/eduardok/libsmbclient-php
-%if 0%{?gh_date}
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
-%else
-Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
-%endif
+Source0: https://pecl.php.net/get/%{sources}.tgz
%if %{with tests}
Source2: %{pecl_name}-phpunit.xml
%endif
+Patch0: %{pecl_name}-upstream.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
@@ -104,23 +99,19 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -q -c
-%if 0%{?gh_date}
-mv %{gh_project}-%{gh_commit} NTS
-mv NTS/package.xml .
-%else
-mv %{pecl_name}-%{version}%{?prever} NTS
-%endif
# Don't install/register tests
sed -e 's/role="test"/role="src"/' \
%{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \
-i package.xml
-cd NTS
+cd %{sources}
+%patch -P0 -p1 -b .up
+
# Check extension version
ver=$(sed -n '/define PHP_SMBCLIENT_VERSION/{s/.* "//;s/".*$//;p}' php_smbclient.h)
-if test "$ver" != "%{version}%{?prever}%{?gh_date:-dev}"; then
- : Error: Upstream VERSION version is ${ver}, expecting %{version}%{?prever}%{?gh_date:-dev}.
+if test "$ver" != "%{version}%{?prever}"; then
+ : Error: Upstream VERSION version is ${ver}, expecting %{version}%{?prever}.
exit 1
fi
cd ..
@@ -131,24 +122,25 @@ extension=%{pecl_name}.so
EOF
+mkdir NTS
%if %{with_zts}
-# Duplicate source tree for NTS / ZTS build
-cp -pr NTS ZTS
+mkdir ZTS
%endif
%build
%{?dtsenable}
-cd NTS
-%{_bindir}/phpize
-%configure --with-php-config=%{_bindir}/php-config
+cd %{sources}
+%{__phpize}
+
+cd ../NTS
+%configure --with-php-config=%{__phpconfig}
make %{?_smp_mflags}
%if %{with_zts}
cd ../ZTS
-%{_bindir}/zts-phpize
-%configure --with-php-config=%{_bindir}/zts-php-config
+%configure --with-php-config=%{__ztsphpconfig}
make %{?_smp_mflags}
%endif
@@ -171,7 +163,7 @@ install -Dpm 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
# Documentation
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
-do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
@@ -220,7 +212,7 @@ fi
%files
-%{?_licensedir:%license NTS/LICENSE}
+%{?_licensedir:%license %{sources}/LICENSE}
%doc %{pecl_docdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
@@ -234,6 +226,10 @@ fi
%changelog
+* Mon Jan 29 2024 Remi Collet <remi@remirepo.net> - 1.1.1-6
+- fix incompatible pointer types using upstream patch
+- build out of sources tree
+
* Wed Aug 30 2023 Remi Collet <remi@remirepo.net> - 1.1.1-2
- rebuild for PHP 8.3.0RC1
diff --git a/smbclient-upstream.patch b/smbclient-upstream.patch
new file mode 100644
index 0000000..5799287
--- /dev/null
+++ b/smbclient-upstream.patch
@@ -0,0 +1,66 @@
+From 9ff3c987291dba1e4904672a9ca22e9b38739384 Mon Sep 17 00:00:00 2001
+From: Po-Chuan Hsieh <sunpoet@sunpoet.net>
+Date: Wed, 6 Sep 2023 00:46:57 +0800
+Subject: [PATCH] Fix build warning on i386
+
+/wrkdirs/usr/ports/net/pecl-smbclient/work-php81/smbclient-1.1.1/smbclient.c:1205:52: warning: format specifies type 'long' but the argument has type 'zend_long' (aka 'int') [-Wformat]
+ php_error(E_WARNING, "Negative byte count: %ld", count);
+ ~~~ ^~~~~
+ %d
+/wrkdirs/usr/ports/net/pecl-smbclient/work-php81/smbclient-1.1.1/smbclient.c:1256:52: warning: format specifies type 'long' but the argument has type 'zend_long' (aka 'int') [-Wformat]
+ php_error(E_WARNING, "Negative byte count: %ld", count);
+ ~~~ ^~~~~
+ %d
+2 warnings generated.
+---
+ smbclient.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/smbclient.c b/smbclient.c
+index ad1f3d8..8a24dab 100644
+--- a/smbclient.c
++++ b/smbclient.c
+@@ -1202,7 +1202,7 @@ PHP_FUNCTION(smbclient_read)
+ return;
+ }
+ if (count < 0) {
+- php_error(E_WARNING, "Negative byte count: %ld", count);
++ php_error(E_WARNING, "Negative byte count: " ZEND_LONG_FMT, count);
+ RETURN_FALSE;
+ }
+ STATE_FROM_ZSTATE;
+@@ -1253,7 +1253,7 @@ PHP_FUNCTION(smbclient_write)
+ return;
+ }
+ if (count < 0) {
+- php_error(E_WARNING, "Negative byte count: %ld", count);
++ php_error(E_WARNING, "Negative byte count: " ZEND_LONG_FMT, count);
+ RETURN_FALSE;
+ }
+ if (count == 0 || count > str_len) {
+From 43f9e8e3ee234e51390adbcc8f42ab0271930702 Mon Sep 17 00:00:00 2001
+From: Po-Chuan Hsieh <sunpoet@sunpoet.net>
+Date: Wed, 6 Sep 2023 00:45:40 +0800
+Subject: [PATCH] Fix build with Clang 16 on i386
+
+/wrkdirs/usr/ports/net/pecl-smbclient/work-php80/smbclient-1.1.1/smb_streams.c:328:2: error: incompatible function pointer types initializing 'int (*)(php_stream *, zend_off_t, int, zend_off_t *)' (aka 'int (*)(struct _php_stream *, int, int, int *)') with an expression of type 'int (php_stream *, off_t, int, off_t *)' (aka 'int (struct _php_stream *, long long, int, long long *)') [-Wincompatible-function-pointer-types]
+ php_smb_ops_seek,
+ ^~~~~~~~~~~~~~~~
+1 error generated.
+---
+ smb_streams.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/smb_streams.c b/smb_streams.c
+index 8b2a9ab..51a0a32 100644
+--- a/smb_streams.c
++++ b/smb_streams.c
+@@ -270,7 +270,7 @@ static int php_smb_ops_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_D
+ return 0;
+ }
+
+-static int php_smb_ops_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset TSRMLS_DC)
++static int php_smb_ops_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset TSRMLS_DC)
+ {
+ STREAM_DATA_FROM_STREAM();
+