diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | 07c762243598947e932502e92674df7fc6d01204.patch | 129 | ||||
-rw-r--r-- | REFLECTION | 24 | ||||
-rw-r--r-- | php-pecl-swoole.spec | 40 |
4 files changed, 189 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/07c762243598947e932502e92674df7fc6d01204.patch b/07c762243598947e932502e92674df7fc6d01204.patch new file mode 100644 index 0000000..b5a23f5 --- /dev/null +++ b/07c762243598947e932502e92674df7fc6d01204.patch @@ -0,0 +1,129 @@ +From 07c762243598947e932502e92674df7fc6d01204 Mon Sep 17 00:00:00 2001 +From: matyhtf <mikan.tenny@gmail.com> +Date: Tue, 18 Apr 2017 18:46:34 +0800 +Subject: [PATCH] fixed compile error with enable-ringbuffer + +--- + src/network/ReactorThread.c | 91 +-------------------------------------------- + 1 file changed, 2 insertions(+), 89 deletions(-) + +diff --git a/src/network/ReactorThread.c b/src/network/ReactorThread.c +index 877fdc4..5994d27 100644 +--- a/src/network/ReactorThread.c ++++ b/src/network/ReactorThread.c +@@ -1263,7 +1263,6 @@ int swReactorThread_dispatch(swConnection *conn, char *data, uint32_t length) + #ifdef SW_USE_RINGBUFFER + swServer *serv = SwooleG.serv; + swReactorThread *thread = swServer_get_thread(serv, SwooleTG.id); +- int target_worker_id = swServer_worker_schedule(serv, conn->fd); + + swPackage package; + package.length = length; +@@ -1271,12 +1270,12 @@ int swReactorThread_dispatch(swConnection *conn, char *data, uint32_t length) + + task.data.info.type = SW_EVENT_PACKAGE; + task.data.info.len = sizeof(package); +- task.target_worker_id = target_worker_id; + +- //swoole_dump_bin(package.data, 's', buffer->length); + memcpy(package.data, data, package.length); + memcpy(task.data.data, &package, sizeof(package)); + ++ task.target_worker_id = swServer_worker_schedule(serv, conn->fd, &task.data); ++ + //dispatch failed, free the memory. + if (factory->dispatch(factory, &task) < 0) + { +@@ -1335,92 +1334,6 @@ int swReactorThread_dispatch(swConnection *conn, char *data, uint32_t length) + return SW_OK; + } + +-#if 0 +-int swReactorThread_dispatch_array_buffer(swReactorThread *thread, swConnection *conn) +-{ +- swDispatchData task; +- swFactory *factory = SwooleG.factory; +- +- task.data.info.fd = conn->fd; +- task.data.info.from_id = conn->from_id; +- +- swBuffer *buffer = conn->in_buffer; +- swBuffer_trunk *trunk = swBuffer_get_trunk(buffer); +- +-#ifdef SW_USE_RINGBUFFER +- swServer *serv = SwooleG.serv; +- uint16_t target_worker_id = swServer_worker_schedule(serv, conn->fd); +- swPackage package; +- +- package.length = 0; +- package.data = swReactorThread_alloc(thread, buffer->length); +- +- task.data.info.type = SW_EVENT_PACKAGE; +- +- while (trunk != NULL) +- { +- task.data.info.len = trunk->length; +- memcpy(package.data + package.length, trunk->store.ptr, trunk->length); +- package.length += trunk->length; +- +- swBuffer_pop_trunk(buffer, trunk); +- trunk = swBuffer_get_trunk(buffer); +- } +- task.data.info.len = sizeof(package); +- task.target_worker_id = target_worker_id; +- memcpy(task.data.data, &package, sizeof(package)); +- //swWarn("[ReactorThread] copy_n=%d", package.length); +- //dispatch failed, free the memory. +- if (factory->dispatch(factory, &task) < 0) +- { +- thread->buffer_input->free(thread->buffer_input, package.data); +- } +- else +- { +- return SW_OK; +- } +-#else +- int ret; +- task.data.info.type = SW_EVENT_PACKAGE_START; +- task.target_worker_id = -1; +- +- /** +- * lock target +- */ +- SwooleTG.factory_lock_target = 1; +- +- while (trunk != NULL) +- { +- task.data.info.fd = conn->fd; +- task.data.info.len = trunk->length; +- memcpy(task.data.data, trunk->store.ptr, task.data.info.len); +- //package end +- if (trunk->next == NULL) +- { +- task.data.info.type = SW_EVENT_PACKAGE_END; +- } +- ret = factory->dispatch(factory, &task); +- //TODO: 处理数据失败,数据将丢失 +- if (ret < 0) +- { +- swWarn("factory->dispatch() failed."); +- } +- swBuffer_pop_trunk(buffer, trunk); +- trunk = swBuffer_get_trunk(buffer); +- +- swTrace("send2worker[trunk_num=%d][type=%d]", buffer->trunk_num, task.data.info.type); +- } +- /** +- * unlock +- */ +- SwooleTG.factory_target_worker = -1; +- SwooleTG.factory_lock_target = 0; +- +-#endif +- return SW_OK; +-} +-#endif +- + void swReactorThread_free(swServer *serv) + { + int i; @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #80 swoole version 1.9.8 ] { +Extension [ <persistent> extension #80 swoole version 1.9.9 ] { - INI { Entry [ swoole.aio_thread_num <ALL> ] @@ -16,6 +16,9 @@ Extension [ <persistent> extension #80 swoole version 1.9.8 ] { Entry [ swoole.unixsock_buffer_size <ALL> ] Current = '8388608' } + Entry [ swoole.modules <SYSTEM> ] + Current = '' + } } - Constants [60] { @@ -63,7 +66,7 @@ Extension [ <persistent> extension #80 swoole version 1.9.8 ] { Constant [ integer SWOOLE_DTLSv1_CLIENT_METHOD ] { 17 } Constant [ integer SWOOLE_EVENT_READ ] { 512 } Constant [ integer SWOOLE_EVENT_WRITE ] { 1024 } - Constant [ string SWOOLE_VERSION ] { 1.9.8 } + Constant [ string SWOOLE_VERSION ] { 1.9.9 } Constant [ integer SWOOLE_AIO_BASE ] { 0 } Constant [ integer SWOOLE_AIO_LINUX ] { 1 } Constant [ integer SWOOLE_FILELOCK ] { 2 } @@ -259,6 +262,10 @@ Extension [ <persistent> extension #80 swoole version 1.9.8 ] { } } Function [ <internal:swoole> function swoole_load_module ] { + + - Parameters [1] { + Parameter #0 [ <required> $module_file ] + } } } @@ -1496,8 +1503,9 @@ Extension [ <persistent> extension #80 swoole version 1.9.8 ] { Method [ <internal:swoole> public method get ] { - - Parameters [1] { + - Parameters [2] { Parameter #0 [ <required> $key ] + Parameter #1 [ <optional> $field ] } } @@ -1516,8 +1524,9 @@ Extension [ <persistent> extension #80 swoole version 1.9.8 ] { Method [ <internal:swoole> public method exist ] { - - Parameters [1] { + - Parameters [2] { Parameter #0 [ <required> $key ] + Parameter #1 [ <optional> $field ] } } @@ -2710,7 +2719,12 @@ Extension [ <persistent> extension #80 swoole version 1.9.8 ] { - Properties [0] { } - - Methods [0] { + - Methods [1] { + Method [ <internal:swoole> public method destroy ] { + + - Parameters [0] { + } + } } } diff --git a/php-pecl-swoole.spec b/php-pecl-swoole.spec index 7dc9566..91d383e 100644 --- a/php-pecl-swoole.spec +++ b/php-pecl-swoole.spec @@ -27,23 +27,20 @@ %global with_mysqlnd 0 %endif - -%if 0%{?fedora} >= 22 || 0%{?rhel} >= 6 %global with_nghttpd2 1 -%else -%global with_nghttpd2 0 -%endif %global with_hiredis 1 Summary: PHP's asynchronous concurrent distributed networking framework Name: %{?sub_prefix}php-pecl-%{pecl_name} -Version: 1.9.8 +Version: 1.9.9 Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD Group: Development/Languages URL: http://pecl.php.net/package/%{pecl_name} Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: 07c762243598947e932502e92674df7fc6d01204.patch + BuildRequires: %{?scl_prefix}php-devel >= 5.3.10 BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-sockets @@ -129,6 +126,20 @@ Documentation: https://rawgit.com/tchiotludo/swoole-ide-helper/english/docs/ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. +%package devel +Summary: %{name} developer files (header) +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: %{?scl_prefix}php-devel%{?_isa} +%if "%{?scl_prefix}" != "%{?sub_prefix}" +Provides: %{?scl_prefix}php-pecl-%{pecl_name}-devel = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl-%{pecl_name}-devel%{?_isa} = %{version}-%{release} +%endif + +%description devel +These are the files needed to compile programs using %{name}. + + %prep %setup -q -c mv %{pecl_name}-%{version} NTS @@ -141,6 +152,8 @@ sed -e 's/role="test"/role="src"/' \ cd NTS +%patch0 -p1 -b .upstream + # Sanity check, really often broken extver=$(sed -n '/#define PHP_SWOOLE_VERSION/{s/.* "//;s/".*$//;p}' php_swoole.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then @@ -165,6 +178,7 @@ extension=%{pecl_name}.so ;swoole.use_namespace = Off ;swoole.fast_serialize = Off ;swoole.unixsock_buffer_size = 8388608 +;swoole.modules = '' EOF @@ -283,8 +297,22 @@ cd ../ZTS %{php_ztsextdir}/%{pecl_name}.so %endif +%files devel +%{php_incldir}/ext/%{pecl_name} + +%if %{with_zts} +%{php_ztsincldir}/ext/%{pecl_name} +%endif + + %changelog +* Fri Apr 21 2017 Remi Collet <remi@remirepo.net> - 1.9.9-1 +- Update to 1.9.9 +- add upstream patch for broken build, see + https://github.com/swoole/swoole-src/issues/1194 +- add devel sub-package with extension headers + * Thu Mar 16 2017 Remi Collet <remi@remirepo.net> - 1.9.8-1 - Update to 1.9.8 - drop patch merged upstream |