Skip to content

Commit 20f2d34

Browse files
committed
php-swoole: updated to 6.1.4, 5.1.8; patches for php85
incorporates work from macports#30146
1 parent 6a23782 commit 20f2d34

File tree

4 files changed

+90
-7
lines changed

4 files changed

+90
-7
lines changed

php/php-swoole/Portfile

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,43 @@ categories-append net devel
99
maintainers {ryandesign @ryandesign} openmaintainer
1010
license Apache-2
1111

12-
php.branches 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4
12+
php.branches 5.3 5.4 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5
1313
php.pecl yes
1414

15-
if {[vercmp ${php.branch} >= 8.0]} {
16-
version 5.0.3
17-
revision 1
18-
checksums rmd160 c8d3b6e892b2c2bc919ac0da36c6837b4315bfa6 \
19-
sha256 6c51e11199214921e07ab1b9f0e67781c96f7b8e06afb4225f05d1dc79832ead \
20-
size 2066852
15+
if {[vercmp ${php.branch} >= 8.1]} {
16+
version 6.1.4
17+
revision 0
18+
checksums rmd160 dc763a78fcc8788c6273fa148b869e6f3f7ceae2 \
19+
sha256 b0edefe2985360099a5701045258e003dc98868a8d966821ce81af2c7569770a \
20+
size 2455442
21+
22+
# macOS pthread compatibility (all PHP versions)
23+
# Disable Linux-specific features not available on macOS
24+
post-patch {
25+
reinplace "s|AC_CHECK_LIB(pthread, pthread_spin_lock|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_spin_lock|g" ${worksrcpath}/config.m4
26+
reinplace "s|AC_CHECK_LIB(pthread, pthread_barrier_init|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_barrier_init|g" ${worksrcpath}/config.m4
27+
reinplace "s|AC_CHECK_LIB(pthread, pthread_mutex_timedlock|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_mutex_timedlock|g" ${worksrcpath}/config.m4
28+
reinplace "s|AC_CHECK_LIB(pthread, pthread_mutexattr_setrobust|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_mutexattr_setrobust|g" ${worksrcpath}/config.m4
29+
reinplace "s|AC_CHECK_LIB(pthread, pthread_mutex_consistent|dnl DISABLED_ON_MACOS AC_CHECK_LIB(pthread, pthread_mutex_consistent|g" ${worksrcpath}/config.m4
30+
reinplace "s|AC_CHECK_LIB(c, getrandom|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, getrandom|g" ${worksrcpath}/config.m4
31+
reinplace "s|AC_CHECK_LIB(c, accept4|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, accept4|g" ${worksrcpath}/config.m4
32+
reinplace "s|AC_CHECK_LIB(c, signalfd|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, signalfd|g" ${worksrcpath}/config.m4
33+
reinplace "s|AC_CHECK_LIB(c, malloc_trim|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, malloc_trim|g" ${worksrcpath}/config.m4
34+
reinplace "s|AC_CHECK_LIB(c, epoll_create|dnl DISABLED_ON_MACOS AC_CHECK_LIB(c, epoll_create|g" ${worksrcpath}/config.m4
35+
}
36+
37+
# PHP 8.5+ compatibility patches
38+
if {[vercmp ${php.branch} >= 8.5]} {
39+
patchfiles-append patch-php85-runtime.diff \
40+
patch-php85-sapi.diff \
41+
patch-php85-shutdown.diff
42+
}
43+
} elseif {[vercmp ${php.branch} >= 8.0]} {
44+
version 5.1.8
45+
revision 0
46+
checksums rmd160 dbb5bddd7df188a56d23338606182986c31ef8dc \
47+
sha256 c365ccd37b1804527064325a0d2641d4bc33fda23c5b4660dd840ac24f333aa8 \
48+
size 2267867
2149
} elseif {[vercmp ${php.branch} >= 7.2]} {
2250
version 4.8.13
2351
revision 1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--- ext-src/swoole_runtime.cc.orig
2+
+++ ext-src/swoole_runtime.cc
3+
@@ -190,12 +190,10 @@
4+
memcpy(new_list, old_list, ZEND_TYPE_LIST_SIZE(old_list->num_types));
5+
ZEND_TYPE_SET_PTR(new_arg_info[i].type, new_list);
6+
7+
- zend_type *list_type;
8+
- ZEND_TYPE_LIST_FOREACH(new_list, list_type) {
9+
- zend_string *name = zend_string_dup(ZEND_TYPE_NAME(*list_type), true);
10+
- ZEND_TYPE_SET_PTR(*list_type, name);
11+
+ for (uint32_t j = 0; j < new_list->num_types; j++) {
12+
+ zend_string *name = zend_string_dup(ZEND_TYPE_NAME(new_list->types[j]), true);
13+
+ ZEND_TYPE_SET_PTR(new_list->types[j], name);
14+
}
15+
- ZEND_TYPE_LIST_FOREACH_END();
16+
} else if (ZEND_TYPE_HAS_NAME(arg_info[i].type)) {
17+
zend_string *name = zend_string_dup(ZEND_TYPE_NAME(arg_info[i].type), true);
18+
ZEND_TYPE_SET_PTR(new_arg_info[i].type, name);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- thirdparty/php/main/SAPI.h.orig
2+
+++ thirdparty/php/main/SAPI.h
3+
@@ -38,7 +38,11 @@
4+
5+
switch (arg) {
6+
case PARSE_STRING:
7+
+#if PHP_VERSION_ID >= 80500
8+
+ separator = ZSTR_VAL(PG(arg_separator).input);
9+
+#else
10+
separator = PG(arg_separator).input;
11+
+#endif
12+
break;
13+
case PARSE_COOKIE:
14+
separator = (char *) ";\0";
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--- ext-src/php_swoole.cc.orig
2+
+++ ext-src/php_swoole.cc
3+
@@ -274,11 +274,20 @@
4+
void php_swoole_register_shutdown_function(const char *function) {
5+
php_shutdown_function_entry shutdown_function_entry;
6+
#if PHP_VERSION_ID >= 80500
7+
+ // PHP 8.5: Initialize fci_cache via zend_fcall_info_init
8+
zval function_name;
9+
+ zend_fcall_info fci_tmp;
10+
memset(&shutdown_function_entry, 0, sizeof(php_shutdown_function_entry));
11+
ZVAL_STRING(&function_name, function);
12+
shutdown_function_entry.params = NULL;
13+
shutdown_function_entry.param_count = 0;
14+
+
15+
+ if (zend_fcall_info_init(&function_name, 0, &fci_tmp,
16+
+ &shutdown_function_entry.fci_cache, nullptr, nullptr) != SUCCESS) {
17+
+ zval_ptr_dtor(&function_name);
18+
+ return;
19+
+ }
20+
+
21+
register_user_shutdown_function(Z_STRVAL(function_name), Z_STRLEN(function_name), &shutdown_function_entry);
22+
zval_ptr_dtor(&function_name);
23+
#else

0 commit comments

Comments
 (0)