diff options
-rw-r--r-- | fann-php81.patch | 69 | ||||
-rw-r--r-- | php-pecl-fann.spec | 14 |
2 files changed, 82 insertions, 1 deletions
diff --git a/fann-php81.patch b/fann-php81.patch new file mode 100644 index 0000000..597d019 --- /dev/null +++ b/fann-php81.patch @@ -0,0 +1,69 @@ +From 319b0bd26acde6f5897f96d5a1f3dfed3f4f482c Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 10 Jun 2021 16:17:26 +0200 +Subject: [PATCH] add PHPC_PHP_STAT helper + +--- + phpc.h | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/phpc.h b/phpc.h +index 9206105..fcf1f02 100644 +--- a/phpc/phpc.h ++++ b/phpc/phpc.h +@@ -29,6 +29,8 @@ + #error "Only PHP 5.2+ supported" + #endif + ++#include "ext/standard/php_filestat.h" ++ + /* no operation */ + #define PHPC_NOOP ((void) 0) + +@@ -1595,5 +1597,16 @@ typedef const char phpc_stream_opener_char_t; + php_stream_locate_url_wrapper(_path, (char **) _path_for_open, _options TSRMLS_CC) + #endif + ++#if (PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION >= 1) || (PHP_MAJOR_VERSION > 8) ++static zend_always_inline void PHPC_PHP_STAT(const char *filename, size_t filename_length, int type, zval *return_value) ++{ ++ zend_string *str = zend_string_init(filename, filename_length, 0); ++ php_stat(str, type, return_value); ++ zend_string_release(str); ++} ++#else ++#define PHPC_PHP_STAT php_stat ++#endif ++ + #endif /* PHPC_H */ + +From 79111c0b9504d18f4c9b70c2a6b6ed9eadc5047d Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 10 Jun 2021 16:18:23 +0200 +Subject: [PATCH] Use PHPC_PHP_STAT helper + +--- + fann.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/fann.c b/fann.c +index 68dd96b..d0c0d84 100644 +--- a/fann.c ++++ b/fann.c +@@ -1189,13 +1189,13 @@ static char *php_fann_get_path_for_open(char *path, phpc_str_size_t path_len, in + char *path_for_open; + + if (read) { +- php_stat(path, (php_stat_len) path_len, FS_IS_R, &retval TSRMLS_CC); ++ PHPC_PHP_STAT(path, (php_stat_len) path_len, FS_IS_R, &retval TSRMLS_CC); + } else { +- php_stat(path, (php_stat_len) path_len, FS_IS_W, &retval TSRMLS_CC); ++ PHPC_PHP_STAT(path, (php_stat_len) path_len, FS_IS_W, &retval TSRMLS_CC); + if (PHP_FANN_PATH_FORBIDDEN(retval)) { + char *dirname = estrndup(path, path_len); + size_t dirname_len = php_dirname(dirname, (size_t) path_len); +- php_stat(dirname, (php_stat_len) dirname_len, FS_IS_W, &retval TSRMLS_CC); ++ PHPC_PHP_STAT(dirname, (php_stat_len) dirname_len, FS_IS_W, &retval TSRMLS_CC); + efree(dirname); + } + } diff --git a/php-pecl-fann.spec b/php-pecl-fann.spec index 8106838..8772bae 100644 --- a/php-pecl-fann.spec +++ b/php-pecl-fann.spec @@ -29,11 +29,13 @@ Summary: Wrapper for FANN Library Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Patch0: %{pecl_name}-php81.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: fann-devel > 2.1 @@ -64,6 +66,9 @@ Obsoletes: php74-pecl-%{pecl_name} <= %{version} %if "%{php_version}" > "8.0" Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.1" +Obsoletes: php81-pecl-%{pecl_name} <= %{version} +%endif %endif @@ -86,6 +91,8 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_FANN_VERSION/{s/.* "//;s/".*$//;p}' php_fann.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -216,6 +223,11 @@ fi %changelog +* Thu Jun 10 2021 Remi Collet <remi@remirepo.net> - 1.2.0~RC1-2 +- add patch for PHP 8.1 from + https://github.com/bukka/phpc/pull/2 + https://github.com/bukka/php-fann/pull/43 + * Mon Mar 15 2021 Remi Collet <remi@remirepo.net> - 1.2.0~RC1-1 - update to 1.2.0RC1 - drop all patches merged upstream |