Skip to content

Commit c3efb2c

Browse files
committed
php-openswoole: update to 25.2.0, 22.1.2, 4.12.1; patches for php85
incorporates work from macports#30146
1 parent 15691ca commit c3efb2c

File tree

2 files changed

+104
-20
lines changed

2 files changed

+104
-20
lines changed

php/php-openswoole/Portfile

Lines changed: 76 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,46 @@ categories-append net devel
88
maintainers {ryandesign @ryandesign} openmaintainer
99
license Apache-2
1010

11-
php.branches 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4
11+
php.branches 7.4 8.0 8.1 8.2 8.3 8.4 8.5
1212
php.pecl yes
1313

14-
if {[vercmp ${php.branch} >= 7.4]} {
15-
version 22.0.0
16-
revision 1
17-
checksums rmd160 9c9c2da1afd86be905ccc9b692450cf0af4f43c0 \
18-
sha256 bf1ebf241bd4a52b5b39102a37da8cfa4b3dfcbd2be4104adf408873dac89034 \
19-
size 1244040
20-
} elseif {[vercmp ${php.branch} >= 7.2]} {
14+
if {[vercmp ${php.branch} >= 8.2]} {
15+
version 25.2.0
16+
revision 11
17+
checksums rmd160 745e2859737fb01da2adb32ca032c2fd63a4e3ed \
18+
sha256 bcc1fed4877b6646cb8f79b092ba03d5e495800465a3fff83c065c58d4312d40 \
19+
size 1239054
20+
21+
# macOS pthread compatibility (all PHP versions)
22+
# Disable Linux-specific features not available on macOS
23+
post-patch {
24+
reinplace "s|AC_CHECK_LIB(pthread, pthread_spin_lock|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_spin_lock|g" ${worksrcpath}/config.m4
25+
reinplace "s|AC_CHECK_LIB(pthread, pthread_barrier_init|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_barrier_init|g" ${worksrcpath}/config.m4
26+
reinplace "s|AC_CHECK_LIB(pthread, pthread_mutex_timedlock|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_mutex_timedlock|g" ${worksrcpath}/config.m4
27+
reinplace "s|AC_CHECK_LIB(pthread, pthread_mutexattr_setrobust|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_mutexattr_setrobust|g" ${worksrcpath}/config.m4
28+
reinplace "s|AC_CHECK_LIB(pthread, pthread_mutex_consistent|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_mutex_consistent|g" ${worksrcpath}/config.m4
29+
reinplace "s|AC_CHECK_LIB(c, getrandom|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, getrandom|g" ${worksrcpath}/config.m4
30+
reinplace "s|AC_CHECK_LIB(c, accept4|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, accept4|g" ${worksrcpath}/config.m4
31+
reinplace "s|AC_CHECK_LIB(c, signalfd|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, signalfd|g" ${worksrcpath}/config.m4
32+
reinplace "s|AC_CHECK_LIB(c, malloc_trim|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, malloc_trim|g" ${worksrcpath}/config.m4
33+
reinplace "s|AC_CHECK_LIB(c, epoll_create|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, epoll_create|g" ${worksrcpath}/config.m4
34+
}
35+
36+
patchfiles-append patch-php85-shutdown.diff
37+
38+
} elseif {[vercmp ${php.branch} >= 8.1]} {
39+
version 22.1.2
40+
revision 0
41+
checksums rmd160 554eb7fa11c1927e57f7bdb5ca4eb820fbf9f548 \
42+
sha256 ec9d08e9484bf95a0080738342a84f09b9c5b8222f4a03c4736caacb7668cb46 \
43+
size 1252932
44+
} elseif {[vercmp ${php.branch} >= 8.0]} {
45+
version 4.12.1
46+
revision 0
47+
checksums rmd160 dc66de146301258d9364b42ea486a1d1bf0523f2 \
48+
sha256 64559632340aa67b09d6386b204750b7b58fb791e4e6ea8e8b610952935260b5 \
49+
size 1637580
50+
} else {
2151
version 4.10.0
2252
revision 2
2353
checksums rmd160 074542644edb0ff9815a7179d4d3ad0172c0d1cd \
@@ -26,34 +56,60 @@ if {[vercmp ${php.branch} >= 7.4]} {
2656
patchfiles arm.patch
2757
}
2858

29-
description an event-driven asynchronous & concurrent & coroutine networking engine with high performance for PHP
59+
description High Performance Programmatic Server for PHP with Async IO, Coroutines and Fibers
60+
61+
long_description OpenSwoole is a high-performance network framework for PHP. \
62+
It enables PHP developers to write high-performance, scalable, \
63+
concurrent TCP, UDP, Unix Socket, HTTP, and WebSocket services \
64+
without requiring in-depth knowledge about non-blocking I/O \
65+
programming and low-level Linux kernel. OpenSwoole is a fork \
66+
of Swoole with additional features and improvements.
3067

31-
long_description ${name} is ${description}.
68+
notes "
69+
You'll have to make sure the ${php}-sockets extension loads before the ${php}-openswoole extension.
70+
You can do this by either:
71+
1) adding priority statements to both the ${prefix}/var/db/${php}/sockets.ini file
72+
and the ${prefix}/var/db/${php}/openswoole.ini file
73+
2) add 'extension=sockets.so' to the ${prefix}/var/db/${php}/sockets.ini file
74+
and disable it in the ${prefix}/var/db/${php}/sockets.ini file
75+
see : https://github.com/swoole/swoole-src/issues/3952
76+
"
3277

3378
if {${name} ne ${subport}} {
79+
conflicts ${php}-swoole
80+
3481
PortGroup legacysupport 1.1
3582
# strndup
3683
legacysupport.newest_darwin_requires_legacy \
3784
10
38-
# https://github.com/swoole/swoole-src/issues/3896
39-
# CLOCK_REALTIME
40-
legacysupport.newest_darwin_requires_legacy \
41-
15
42-
43-
conflicts ${php}-swoole
4485

4586
compiler.cxx_standard 2011
4687
compiler.thread_local_storage yes
4788

48-
depends_lib-append port:brotli \
89+
depends_lib-append port:${php}-sockets \
4990
port:hiredis \
5091
port:nghttp2 \
5192
path:lib/libssl.dylib:openssl \
5293
port:zlib
5394

54-
configure.args --enable-async-redis \
55-
--enable-http2 \
95+
compiler.blacklist-append \
96+
*gcc-4.0 *gcc-4.2
97+
98+
configure.args --enable-http2 \
5699
--enable-openssl \
57-
--enable-swoole \
100+
--enable-sockets \
101+
--enable-mysqlnd \
58102
--with-openssl-dir=${prefix}
103+
104+
# brotli and c-ares support only in versions >= 22.0.0
105+
if {[vercmp ${version} >= 22.0.0]} {
106+
depends_lib-append \
107+
port:brotli \
108+
port:c-ares
109+
110+
configure.args-append \
111+
--enable-cares
112+
}
113+
114+
use_parallel_build yes
59115
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--- ext-src/php_swoole.cc.orig
2+
+++ ext-src/php_swoole.cc
3+
@@ -162,9 +162,25 @@
4+
php_shutdown_function_entry shutdown_function_entry;
5+
zval function_name;
6+
ZVAL_STRING(&function_name, function);
7+
+#if PHP_VERSION_ID >= 80500
8+
+ // PHP 8.5: shutdown function structure changed - removed fci field
9+
+ // Create temporary fci to initialize fci_cache, then only use fci_cache
10+
+ zend_fcall_info fci_tmp;
11+
+ shutdown_function_entry.params = NULL;
12+
+ shutdown_function_entry.param_count = 0;
13+
+
14+
+ if (zend_fcall_info_init(&function_name, 0, &fci_tmp,
15+
+ &shutdown_function_entry.fci_cache, NULL, NULL) != SUCCESS) {
16+
+ zval_ptr_dtor(&function_name);
17+
+ return;
18+
+ }
19+
+
20+
+ register_user_shutdown_function(Z_STRVAL(function_name), Z_STRLEN(function_name), &shutdown_function_entry);
21+
+#else
22+
zend_fcall_info_init(
23+
&function_name, 0, &shutdown_function_entry.fci, &shutdown_function_entry.fci_cache, NULL, NULL);
24+
register_user_shutdown_function(Z_STRVAL(function_name), Z_STRLEN(function_name), &shutdown_function_entry);
25+
+#endif
26+
}
27+
28+
void php_swoole_set_global_option(HashTable *vht) {

0 commit comments

Comments
 (0)