git: c89b6f279989 - main - lang/php8[12]: Fix build on aarch64 with ZTS

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Wed, 12 Apr 2023 05:39:24 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c89b6f2799891129e89d1b4fedf8e25865241060

commit c89b6f2799891129e89d1b4fedf8e25865241060
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2023-04-12 04:05:35 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-04-12 05:39:13 +0000

    lang/php8[12]: Fix build on aarch64 with ZTS
    
    - Refresh patches
    
    PR:             266175
    Reported by:    thresh@nginx.com
    Sponsored by:   Bounce Experts
---
 lang/php81/Makefile                                           |  4 ++++
 lang/php81/files/patch-TSRM_TSRM.c                            | 11 +++++++++++
 lang/php81/files/patch-build_Makefile.global                  |  4 ++--
 lang/php81/files/patch-configure.ac                           |  6 +++---
 lang/php81/files/patch-ext_mysqli_mysqli__nonapi.c            |  6 +++---
 lang/php81/files/patch-ext_mysqli_mysqli__prop.c              |  6 +++---
 lang/php81/files/patch-ext_mysqli_php__mysqli__structs.h      |  6 +++---
 .../files/patch-ext_pcre_pcre2lib_sljit_sljitConfigInternal.h |  4 ++--
 lang/php81/files/patch-sapi_apache2handler_config.m4          |  6 +++---
 lang/php81/files/patch-sapi_fpm_config.m4                     |  4 ++--
 lang/php81/files/patch-sapi_fpm_www.conf.in                   |  4 ++--
 lang/php82/Makefile                                           |  6 +++++-
 lang/php82/files/patch-TSRM_TSRM.c                            | 11 +++++++++++
 lang/php82/files/patch-configure.ac                           | 10 +++++-----
 lang/php82/files/patch-ext_hash_xxhash_xxhash.h               |  4 ++--
 lang/php82/files/patch-sapi_apache2handler_config.m4          |  6 +++---
 lang/php82/files/patch-sapi_fpm_config.m4                     |  4 ++--
 lang/php82/files/patch-sapi_fpm_www.conf.in                   |  4 ++--
 18 files changed, 68 insertions(+), 38 deletions(-)

diff --git a/lang/php81/Makefile b/lang/php81/Makefile
index eecdfdc2114e..d8aa6a3deed3 100644
--- a/lang/php81/Makefile
+++ b/lang/php81/Makefile
@@ -400,8 +400,12 @@ CONFIGURE_ARGS+=	--enable-odbc \
 .if ${PHP_MODNAME} == "opcache"
 # This is needed by Zend extensions, keep before everything.
 PHP_MOD_PRIO=		10
+.if ${ARCH} == aarch64
+CONFIGURE_ARGS+=	--disable-opcache-jit
+.else
 CONFIGURE_ARGS+=	--enable-opcache
 .endif
+.endif
 
 .if ${PHP_MODNAME} == "pcntl"
 CONFIGURE_ARGS+=	--enable-pcntl
diff --git a/lang/php81/files/patch-TSRM_TSRM.c b/lang/php81/files/patch-TSRM_TSRM.c
new file mode 100644
index 000000000000..f2e0059dcede
--- /dev/null
+++ b/lang/php81/files/patch-TSRM_TSRM.c
@@ -0,0 +1,11 @@
+--- TSRM/TSRM.c.orig	2023-04-12 03:52:48 UTC
++++ TSRM/TSRM.c
+@@ -750,7 +750,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
+ 	asm ("leal _tsrm_ls_cache@ntpoff,%0"
+           : "=r" (ret));
+ 	return ret;
+-#elif defined(__aarch64__)
++#elif defined(__aarch64__) && !defined(__FreeBSD__)
+ 	size_t ret;
+ 
+ # ifdef __APPLE__
diff --git a/lang/php81/files/patch-build_Makefile.global b/lang/php81/files/patch-build_Makefile.global
index 4b838d157941..d18a33114464 100644
--- a/lang/php81/files/patch-build_Makefile.global
+++ b/lang/php81/files/patch-build_Makefile.global
@@ -1,6 +1,6 @@
---- build/Makefile.global.orig	2019-08-06 06:54:07 UTC
+--- build/Makefile.global.orig	2023-03-14 19:50:20 UTC
 +++ build/Makefile.global
-@@ -89,14 +89,14 @@ test: all
+@@ -92,14 +92,14 @@ test: all
  	@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
  		INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
  		if test "$$INI_FILE"; then \
diff --git a/lang/php81/files/patch-configure.ac b/lang/php81/files/patch-configure.ac
index b8c26f6c43f1..fae0134d0c7b 100644
--- a/lang/php81/files/patch-configure.ac
+++ b/lang/php81/files/patch-configure.ac
@@ -1,4 +1,4 @@
---- configure.ac.orig	2021-12-15 02:00:45 UTC
+--- configure.ac.orig	2023-03-14 19:50:20 UTC
 +++ configure.ac
 @@ -55,6 +55,7 @@ AH_BOTTOM([
  
@@ -25,7 +25,7 @@
  
  dnl Haiku does not have network api in libc.
  PHP_CHECK_FUNC_LIB(setsockopt, network)
-@@ -1360,7 +1360,7 @@ EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
+@@ -1372,7 +1372,7 @@ EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
  EXPANDED_DATADIR=$datadir
  EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
  EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
@@ -34,7 +34,7 @@
  
  exec_prefix=$old_exec_prefix
  libdir=$old_libdir
-@@ -1579,7 +1579,7 @@ PHP_SUBST(all_targets)
+@@ -1591,7 +1591,7 @@ PHP_SUBST(all_targets)
  PHP_SUBST(install_targets)
  PHP_SUBST(install_binary_targets)
  
diff --git a/lang/php81/files/patch-ext_mysqli_mysqli__nonapi.c b/lang/php81/files/patch-ext_mysqli_mysqli__nonapi.c
index 9baa04218bf9..e7de52f5be9d 100644
--- a/lang/php81/files/patch-ext_mysqli_mysqli__nonapi.c
+++ b/lang/php81/files/patch-ext_mysqli_mysqli__nonapi.c
@@ -1,6 +1,6 @@
---- ext/mysqli/mysqli_nonapi.c.orig	2020-01-09 11:40:57 UTC
+--- ext/mysqli/mysqli_nonapi.c.orig	2023-03-14 19:50:20 UTC
 +++ ext/mysqli/mysqli_nonapi.c
-@@ -28,7 +28,9 @@
+@@ -26,7 +26,9 @@
  #include "php_ini.h"
  #include "ext/standard/info.h"
  #include "zend_smart_str.h"
@@ -8,5 +8,5 @@
  #include "php_mysqli_structs.h"
 +#endif
  #include "mysqli_priv.h"
+ #define ERROR_ARG_POS(arg_num) (getThis() ? (arg_num-1) : (arg_num))
  
- #define SAFE_STR(a) ((a)?a:"")
diff --git a/lang/php81/files/patch-ext_mysqli_mysqli__prop.c b/lang/php81/files/patch-ext_mysqli_mysqli__prop.c
index 37d47a304440..26983cb2dbf9 100644
--- a/lang/php81/files/patch-ext_mysqli_mysqli__prop.c
+++ b/lang/php81/files/patch-ext_mysqli_mysqli__prop.c
@@ -1,6 +1,6 @@
---- ext/mysqli/mysqli_prop.c.orig	2020-01-09 11:40:11 UTC
+--- ext/mysqli/mysqli_prop.c.orig	2023-03-14 19:50:20 UTC
 +++ ext/mysqli/mysqli_prop.c
-@@ -26,7 +26,9 @@
+@@ -24,7 +24,9 @@
  #include "php.h"
  #include "php_ini.h"
  #include "ext/standard/info.h"
@@ -9,4 +9,4 @@
 +#endif
  #include "mysqli_priv.h"
  
- #define CHECK_STATUS(value) \
+ #define CHECK_STATUS(value, quiet) \
diff --git a/lang/php81/files/patch-ext_mysqli_php__mysqli__structs.h b/lang/php81/files/patch-ext_mysqli_php__mysqli__structs.h
index f0e33efd03aa..6884caf3f9f8 100644
--- a/lang/php81/files/patch-ext_mysqli_php__mysqli__structs.h
+++ b/lang/php81/files/patch-ext_mysqli_php__mysqli__structs.h
@@ -1,7 +1,7 @@
---- ext/mysqli/php_mysqli_structs.h.orig	2019-12-17 10:29:23 UTC
+--- ext/mysqli/php_mysqli_structs.h.orig	2023-03-14 19:50:20 UTC
 +++ ext/mysqli/php_mysqli_structs.h
-@@ -36,7 +36,7 @@
- #define FALSE 0
+@@ -26,7 +26,7 @@
+ #undef LIST
  #endif
  
 -#ifdef MYSQLI_USE_MYSQLND
diff --git a/lang/php81/files/patch-ext_pcre_pcre2lib_sljit_sljitConfigInternal.h b/lang/php81/files/patch-ext_pcre_pcre2lib_sljit_sljitConfigInternal.h
index 9a75bc3e86c1..0711e717f932 100644
--- a/lang/php81/files/patch-ext_pcre_pcre2lib_sljit_sljitConfigInternal.h
+++ b/lang/php81/files/patch-ext_pcre_pcre2lib_sljit_sljitConfigInternal.h
@@ -1,6 +1,6 @@
---- ext/pcre/pcre2lib/sljit/sljitConfigInternal.h.orig	2022-03-25 09:54:56 UTC
+--- ext/pcre/pcre2lib/sljit/sljitConfigInternal.h.orig	2023-03-14 19:50:20 UTC
 +++ ext/pcre/pcre2lib/sljit/sljitConfigInternal.h
-@@ -283,7 +283,7 @@
+@@ -319,7 +319,7 @@ extern "C" {
  /* Instruction cache flush. */
  /****************************/
  
diff --git a/lang/php81/files/patch-sapi_apache2handler_config.m4 b/lang/php81/files/patch-sapi_apache2handler_config.m4
index 5b0cfb9d4591..3a33d9ad7f21 100644
--- a/lang/php81/files/patch-sapi_apache2handler_config.m4
+++ b/lang/php81/files/patch-sapi_apache2handler_config.m4
@@ -1,6 +1,6 @@
---- sapi/apache2handler/config.m4.orig	2018-08-14 11:39:14 UTC
+--- sapi/apache2handler/config.m4.orig	2023-03-14 19:50:20 UTC
 +++ sapi/apache2handler/config.m4
-@@ -65,7 +65,7 @@ if test "$PHP_APXS2" != "no"; then
+@@ -64,7 +64,7 @@ if test "$PHP_APXS2" != "no"; then
    fi
  
    APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
@@ -8,4 +8,4 @@
 +  if true; then
      INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
                   $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-                        -i -n php7"
+                        -i -n php"
diff --git a/lang/php81/files/patch-sapi_fpm_config.m4 b/lang/php81/files/patch-sapi_fpm_config.m4
index e88c204384ae..6da0b1f4f40c 100644
--- a/lang/php81/files/patch-sapi_fpm_config.m4
+++ b/lang/php81/files/patch-sapi_fpm_config.m4
@@ -1,6 +1,6 @@
---- sapi/fpm/config.m4.orig	2018-08-14 11:39:14 UTC
+--- sapi/fpm/config.m4.orig	2023-03-14 19:50:20 UTC
 +++ sapi/fpm/config.m4
-@@ -319,7 +319,7 @@ AC_DEFUN([AC_FPM_LQ],
+@@ -315,7 +315,7 @@ AC_DEFUN([AC_FPM_LQ],
      AC_MSG_RESULT([no])
    ])
  
diff --git a/lang/php81/files/patch-sapi_fpm_www.conf.in b/lang/php81/files/patch-sapi_fpm_www.conf.in
index c7e7fe399854..ebe34421ef0f 100644
--- a/lang/php81/files/patch-sapi_fpm_www.conf.in
+++ b/lang/php81/files/patch-sapi_fpm_www.conf.in
@@ -1,6 +1,6 @@
---- sapi/fpm/www.conf.in.orig	2019-01-26 15:54:27 UTC
+--- sapi/fpm/www.conf.in.orig	2023-03-14 19:50:20 UTC
 +++ sapi/fpm/www.conf.in
-@@ -27,10 +27,14 @@ group = @php_fpm_group@
+@@ -32,10 +32,14 @@ group = @php_fpm_group@
  ; Valid syntaxes are:
  ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
  ;                            a specific port;
diff --git a/lang/php82/Makefile b/lang/php82/Makefile
index 67f06b08868c..ecbc964bad66 100644
--- a/lang/php82/Makefile
+++ b/lang/php82/Makefile
@@ -401,7 +401,11 @@ CONFIGURE_ARGS+=	--enable-odbc \
 .if ${PHP_MODNAME} == "opcache"
 # This is needed by Zend extensions, keep before everything.
 PHP_MOD_PRIO=		10
-CONFIGURE_ARGS+=	--enable-opcache
+.if ${ARCH} == aarch64
+CONFIGURE_ARGS+=        --disable-opcache-jit
+.else
+CONFIGURE_ARGS+=        --enable-opcache
+.endif
 .endif
 
 .if ${PHP_MODNAME} == "pcntl"
diff --git a/lang/php82/files/patch-TSRM_TSRM.c b/lang/php82/files/patch-TSRM_TSRM.c
new file mode 100644
index 000000000000..3746de1d8b36
--- /dev/null
+++ b/lang/php82/files/patch-TSRM_TSRM.c
@@ -0,0 +1,11 @@
+--- TSRM/TSRM.c.orig	2023-04-12 04:09:40 UTC
++++ TSRM/TSRM.c
+@@ -740,7 +740,7 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
+ 	asm ("leal _tsrm_ls_cache@ntpoff,%0"
+           : "=r" (ret));
+ 	return ret;
+-#elif defined(__aarch64__)
++#elif defined(__aarch64__) && !defined(__FreeBSD__)
+ 	size_t ret;
+ 
+ # ifdef __APPLE__
diff --git a/lang/php82/files/patch-configure.ac b/lang/php82/files/patch-configure.ac
index edf17428ebee..242c702f4b8d 100644
--- a/lang/php82/files/patch-configure.ac
+++ b/lang/php82/files/patch-configure.ac
@@ -1,4 +1,4 @@
---- configure.ac.orig	2022-08-02 13:57:03 UTC
+--- configure.ac.orig	2023-03-14 16:11:05 UTC
 +++ configure.ac
 @@ -55,6 +55,7 @@ AH_BOTTOM([
  
@@ -8,7 +8,7 @@
  #endif /* PHP_CONFIG_H */
  ])
  
-@@ -279,7 +280,6 @@ dnl --------------------------------------------------
+@@ -279,7 +280,6 @@ sinclude(Zend/Zend.m4)
  
  dnl ----------------------------------------------------------------------------
  
@@ -16,7 +16,7 @@
  PHP_HELP_SEPARATOR([SAPI modules:])
  PHP_SHLIB_SUFFIX_NAMES
  PHP_BUILD_PROGRAM
-@@ -627,7 +627,7 @@ dnl Some systems (like OpenSolaris) do not have nanosl
+@@ -626,7 +626,7 @@ memrchr \
  AX_FUNC_WHICH_GETHOSTBYNAME_R
  
  dnl Some systems (like OpenSolaris) do not have nanosleep in libc.
@@ -25,7 +25,7 @@
  
  dnl Haiku does not have network api in libc.
  PHP_CHECK_FUNC_LIB(setsockopt, network)
-@@ -1375,7 +1375,7 @@ EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CON
+@@ -1413,7 +1413,7 @@ EXPANDED_SYSCONFDIR=`eval echo $sysconfdir`
  EXPANDED_DATADIR=$datadir
  EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
  EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
@@ -34,7 +34,7 @@
  
  exec_prefix=$old_exec_prefix
  libdir=$old_libdir
-@@ -1600,7 +1600,7 @@ PHP_SUBST(install_binary_targets)
+@@ -1638,7 +1638,7 @@ PHP_SUBST(all_targets)
  PHP_SUBST(install_targets)
  PHP_SUBST(install_binary_targets)
  
diff --git a/lang/php82/files/patch-ext_hash_xxhash_xxhash.h b/lang/php82/files/patch-ext_hash_xxhash_xxhash.h
index 714a074f7050..141fdc0c515c 100644
--- a/lang/php82/files/patch-ext_hash_xxhash_xxhash.h
+++ b/lang/php82/files/patch-ext_hash_xxhash_xxhash.h
@@ -1,6 +1,6 @@
---- ext/hash/xxhash/xxhash.h.orig	2022-08-02 13:57:03 UTC
+--- ext/hash/xxhash/xxhash.h.orig	2023-03-14 16:11:05 UTC
 +++ ext/hash/xxhash/xxhash.h
-@@ -3048,22 +3048,32 @@ enum XXH_VECTOR_TYPE /* fake enum */ {
+@@ -3047,22 +3047,32 @@ enum XXH_VECTOR_TYPE /* fake enum */ {
   * inconsistent intrinsics, spotty coverage, and multiple endiannesses.
   */
  #if XXH_VECTOR == XXH_VSX
diff --git a/lang/php82/files/patch-sapi_apache2handler_config.m4 b/lang/php82/files/patch-sapi_apache2handler_config.m4
index 5b0cfb9d4591..a68054d116c2 100644
--- a/lang/php82/files/patch-sapi_apache2handler_config.m4
+++ b/lang/php82/files/patch-sapi_apache2handler_config.m4
@@ -1,6 +1,6 @@
---- sapi/apache2handler/config.m4.orig	2018-08-14 11:39:14 UTC
+--- sapi/apache2handler/config.m4.orig	2023-03-14 16:11:05 UTC
 +++ sapi/apache2handler/config.m4
-@@ -65,7 +65,7 @@ if test "$PHP_APXS2" != "no"; then
+@@ -64,7 +64,7 @@ if test "$PHP_APXS2" != "no"; then
    fi
  
    APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
@@ -8,4 +8,4 @@
 +  if true; then
      INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
                   $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
-                        -i -n php7"
+                        -i -n php"
diff --git a/lang/php82/files/patch-sapi_fpm_config.m4 b/lang/php82/files/patch-sapi_fpm_config.m4
index e88c204384ae..8f6824fdd4e8 100644
--- a/lang/php82/files/patch-sapi_fpm_config.m4
+++ b/lang/php82/files/patch-sapi_fpm_config.m4
@@ -1,6 +1,6 @@
---- sapi/fpm/config.m4.orig	2018-08-14 11:39:14 UTC
+--- sapi/fpm/config.m4.orig	2023-03-14 16:11:05 UTC
 +++ sapi/fpm/config.m4
-@@ -319,7 +319,7 @@ AC_DEFUN([AC_FPM_LQ],
+@@ -339,7 +339,7 @@ AC_DEFUN([AC_FPM_LQ],
      AC_MSG_RESULT([no])
    ])
  
diff --git a/lang/php82/files/patch-sapi_fpm_www.conf.in b/lang/php82/files/patch-sapi_fpm_www.conf.in
index c7e7fe399854..c7465018244d 100644
--- a/lang/php82/files/patch-sapi_fpm_www.conf.in
+++ b/lang/php82/files/patch-sapi_fpm_www.conf.in
@@ -1,6 +1,6 @@
---- sapi/fpm/www.conf.in.orig	2019-01-26 15:54:27 UTC
+--- sapi/fpm/www.conf.in.orig	2023-03-14 16:11:05 UTC
 +++ sapi/fpm/www.conf.in
-@@ -27,10 +27,14 @@ group = @php_fpm_group@
+@@ -32,10 +32,14 @@ group = @php_fpm_group@
  ; Valid syntaxes are:
  ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
  ;                            a specific port;