summaryrefslogtreecommitdiff
path: root/repo/php8
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-08-29 13:01:02 +0000
committerdavidovski <david@davidovski.xyz>2022-08-29 13:01:02 +0000
commitc38dfe6188112ca490090966a63faefe5ec7e9a0 (patch)
tree0b5cb4f2b5148784d852070317d90485ab31e122 /repo/php8
parent49fa1762a5c52ff2cf981f29a45e1797e3885bb4 (diff)
added snes9x and php
Diffstat (limited to 'repo/php8')
-rw-r--r--repo/php8/.php8.xibuild.swpbin0 -> 24576 bytes
-rw-r--r--repo/php8/atomic-lsapi.patch82
-rw-r--r--repo/php8/disabled-tests.list213
-rw-r--r--repo/php8/fix-tests-devserver.patch23
-rw-r--r--repo/php8/includedir.patch41
-rw-r--r--repo/php8/install-pear.patch14
-rw-r--r--repo/php8/php8-fpm-version-suffix.patch79
-rw-r--r--repo/php8/php8-fpm.initd93
-rw-r--r--repo/php8/php8-fpm.logrotate13
-rw-r--r--repo/php8/php8-module.conf13
-rw-r--r--repo/php8/php8.xibuild215
-rw-r--r--repo/php8/sharedir.patch11
-rw-r--r--repo/php8/xfail-openssl-1.1-test.patch13
13 files changed, 810 insertions, 0 deletions
diff --git a/repo/php8/.php8.xibuild.swp b/repo/php8/.php8.xibuild.swp
new file mode 100644
index 0000000..ffdb8e4
--- /dev/null
+++ b/repo/php8/.php8.xibuild.swp
Binary files differ
diff --git a/repo/php8/atomic-lsapi.patch b/repo/php8/atomic-lsapi.patch
new file mode 100644
index 0000000..39cf182
--- /dev/null
+++ b/repo/php8/atomic-lsapi.patch
@@ -0,0 +1,82 @@
+Patch-Source: https://github.com/php/php-src/pull/7997
+
+diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
+index 2208bbd47b..42dd320356 100644
+--- a/sapi/litespeed/lsapilib.c
++++ b/sapi/litespeed/lsapilib.c
+@@ -443,7 +443,7 @@ static void lsapi_close_connection(LSAPI_Request *pReq)
+ if (s_busy_workers)
+ __sync_fetch_and_sub(s_busy_workers, 1);
+ if (s_worker_status)
+- __sync_lock_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE);
++ __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE);
+ }
+
+
+@@ -1587,7 +1587,7 @@ int LSAPI_Accept_r( LSAPI_Request * pReq )
+ else
+ {
+ if (s_worker_status)
+- __sync_lock_test_and_set(&s_worker_status->m_state,
++ __atomic_test_and_set(&s_worker_status->m_state,
+ LSAPI_STATE_CONNECTED);
+ if (s_busy_workers)
+ __sync_fetch_and_add(s_busy_workers, 1);
+@@ -3315,7 +3315,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
+ if (pthread_atfork_func)
+ (*pthread_atfork_func)(NULL, NULL, set_skip_write);
+
+- __sync_lock_test_and_set(&s_worker_status->m_state,
++ __atomic_test_and_set(&s_worker_status->m_state,
+ LSAPI_STATE_CONNECTED);
+ if (s_busy_workers)
+ __sync_add_and_fetch(s_busy_workers, 1);
+@@ -3402,7 +3402,7 @@ int LSAPI_Postfork_Child(LSAPI_Request * pReq)
+ if (pthread_atfork_func)
+ (*pthread_atfork_func)(NULL, NULL, set_skip_write);
+
+- __sync_lock_test_and_set(&s_worker_status->m_state,
++ __atomic_test_and_set(&s_worker_status->m_state,
+ LSAPI_STATE_CONNECTED);
+ if (s_busy_workers)
+ __sync_add_and_fetch(s_busy_workers, 1);
+@@ -3651,7 +3651,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
+ if (fd == pReq->m_fdListen)
+ {
+ if (s_worker_status)
+- __sync_lock_test_and_set(&s_worker_status->m_state,
++ __atomic_test_and_set(&s_worker_status->m_state,
+ LSAPI_STATE_ACCEPTING);
+ if (s_accepting_workers)
+ __sync_fetch_and_add(s_accepting_workers, 1);
+@@ -3662,7 +3662,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
+ if (s_accepting_workers)
+ __sync_fetch_and_sub(s_accepting_workers, 1);
+ if (s_worker_status)
+- __sync_lock_test_and_set(&s_worker_status->m_state,
++ __atomic_test_and_set(&s_worker_status->m_state,
+ LSAPI_STATE_IDLE);
+ }
+
+@@ -3711,7 +3711,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
+ if ( pReq->m_fd != -1 )
+ {
+ if (s_worker_status)
+- __sync_lock_test_and_set(&s_worker_status->m_state,
++ __atomic_test_and_set(&s_worker_status->m_state,
+ LSAPI_STATE_CONNECTED);
+ if (s_busy_workers)
+ __sync_fetch_and_add(s_busy_workers, 1);
+diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
+index 42dd320356..0932ebaaa8 100644
+--- a/sapi/litespeed/lsapilib.c
++++ b/sapi/litespeed/lsapilib.c
+@@ -3390,7 +3390,7 @@ int LSAPI_Postfork_Child(LSAPI_Request * pReq)
+ {
+ int max_children = g_prefork_server->m_iMaxChildren;
+ s_pid = getpid();
+- __sync_lock_test_and_set(&pReq->child_status->m_pid, s_pid);
++ __atomic_test_and_set(&pReq->child_status->m_pid, s_pid);
+ s_worker_status = pReq->child_status;
+
+ setsid();
diff --git a/repo/php8/disabled-tests.list b/repo/php8/disabled-tests.list
new file mode 100644
index 0000000..6b6540f
--- /dev/null
+++ b/repo/php8/disabled-tests.list
@@ -0,0 +1,213 @@
+#
+# Tests that we don't need to run
+#
+
+# Windows tests
+ext/standard/tests/file/windows_mb_path/*
+ext/standard/tests/file/*win32*.phpt
+ext/standard/tests/dir/*win32*.phpt
+
+# Require database or slow as dblib
+ext/mysqli/tests/*
+ext/odbc/tests/*
+ext/pdo/tests/*.phpt
+ext/pdo_dblib/tests/*
+ext/pdo_mysql/tests/*
+ext/pdo_odbc/tests/*
+ext/pdo_pgsql/tests/*
+ext/pgsql/tests/*
+
+#
+# Tests that fail and probably should not...
+#
+
+# Too many tests fail! Some of them bogus, some not.
+# THIS SHOULD BE REALLY FIXED!
+ext/openssl/tests/bug46127.phpt
+ext/openssl/tests/bug48182.phpt
+ext/openssl/tests/bug54992.phpt
+ext/openssl/tests/bug65538_001.phpt
+ext/openssl/tests/bug65538_003.phpt
+ext/openssl/tests/bug65729.phpt
+ext/openssl/tests/bug68265.phpt
+ext/openssl/tests/bug68879.phpt
+ext/openssl/tests/bug68920.phpt
+ext/openssl/tests/bug69215.phpt
+ext/openssl/tests/bug72333.phpt
+ext/openssl/tests/bug73072.phpt
+ext/openssl/tests/bug74159.phpt
+ext/openssl/tests/bug76705.phpt
+ext/openssl/tests/bug77390.phpt
+ext/openssl/tests/capture_peer_cert_001.phpt
+ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
+ext/openssl/tests/peer_verification.phpt
+ext/openssl/tests/san_peer_matching.phpt
+ext/openssl/tests/session_meta_capture.phpt
+ext/openssl/tests/session_meta_capture_tlsv13.phpt
+ext/openssl/tests/sni_server.phpt
+ext/openssl/tests/sni_server_key_cert.phpt
+ext/openssl/tests/stream_crypto_flags_001.phpt
+ext/openssl/tests/stream_crypto_flags_002.phpt
+ext/openssl/tests/stream_crypto_flags_003.phpt
+ext/openssl/tests/stream_crypto_flags_004.phpt
+ext/openssl/tests/stream_security_level.phpt
+ext/openssl/tests/stream_verify_peer_name_001.phpt
+ext/openssl/tests/stream_verify_peer_name_002.phpt
+ext/openssl/tests/stream_verify_peer_name_003.phpt
+ext/openssl/tests/streams_crypto_method.phpt
+ext/openssl/tests/tls_min_v1.0_max_v1.1_wrapper.phpt
+ext/openssl/tests/tls_wrapper.phpt
+ext/openssl/tests/tls_wrapper_with_tls_v1.3.phpt
+ext/openssl/tests/tlsv1.0_wrapper.phpt
+ext/openssl/tests/tlsv1.1_wrapper.phpt
+ext/openssl/tests/tlsv1.2_wrapper.phpt
+ext/openssl/tests/tlsv1.3_wrapper.phpt
+
+# Needs to open tls socket
+ext/openssl/tests/bug62890.phpt
+
+# Broken tests, missing config.
+sapi/fpm/tests/socket-ipv4-fallback.phpt
+
+# Fails in chroot (on Travis).
+sapi/cli/tests/cli_process_title_unix.phpt
+
+# Error messages in different order.
+sapi/cgi/tests/005.phpt
+
+# Fails on ppc64le.
+sapi/phpdbg/tests/watch_006.phpt
+
+# Not stable enchant-2 library support - 15/29
+ext/enchant/tests/broker_dict_exists.phpt
+ext/enchant/tests/broker_free_02.phpt
+ext/enchant/tests/broker_free_dict.phpt
+ext/enchant/tests/broker_request_dict.phpt
+ext/enchant/tests/broker_request_dict_01.phpt
+ext/enchant/tests/broker_set_ordering.phpt
+ext/enchant/tests/dict_add_to_personal.phpt
+ext/enchant/tests/dict_add_to_session.phpt
+ext/enchant/tests/dict_check.phpt
+ext/enchant/tests/dict_describe.phpt
+ext/enchant/tests/dict_get_error.phpt
+ext/enchant/tests/dict_is_in_session.phpt
+ext/enchant/tests/dict_quick_check_01.phpt
+ext/enchant/tests/dict_store_replacement.phpt
+ext/enchant/tests/dict_suggest.phpt
+
+# Wrong charset, conversion from `UTF-8' to `ASCII//TRANSLIT' is not allowed.
+ext/iconv/tests/iconv_basic_001.phpt
+
+# Wrong charset, conversion from `UTF-8' to `UTF-8//IGNORE' is not allowed.
+ext/iconv/tests/bug48147.phpt
+
+# stream_filter_append(): unable to create or locate filter "convert.iconv.ucs-2/utf-8//IGNORE"
+ext/iconv/tests/bug76249.phpt
+
+# for ICU <= 57.1
+ext/intl/tests/spoofchecker_001.phpt
+ext/intl/tests/timezone_IDforWindowsID_basic.phpt
+ext/intl/tests/timezone_windowsID_basic.phpt
+
+# Class 'Phar' not found.
+ext/opcache/tests/issue0115.phpt
+ext/opcache/tests/issue0149.phpt
+
+# Fails in CI - Insufficient privileges. https://gitlab.alpinelinux.org/alpine/aports/-/issues/12692#note_169663
+ext/pcntl/tests/pcntl_unshare_01.phpt
+ext/pcntl/tests/pcntl_unshare_02.phpt
+ext/pcntl/tests/pcntl_unshare_03.phpt
+ext/pcntl/tests/pcntl_unshare_04.phpt
+
+# Randomly fails.
+ext/pcntl/tests/002.phpt
+# Randomly fails on arm7
+ext/standard/tests/file/bug60120.phpt
+
+# Call to undefined function session_start().
+ext/session/tests/session_regenerate_id_cookie.phpt
+
+# Class 'SoapServer' not found.
+ext/soap/tests/bug73037.phpt
+
+# Incorrect results.
+ext/soap/tests/server009.phpt
+
+# Failing tests related to locale and/or iconv.
+ext/date/tests/009.phpt
+ext/iconv/tests/bug52211.phpt
+ext/intl/tests/bug67052.phpt
+ext/json/tests/bug41403.phpt
+ext/pcre/tests/ctype_back_to_c.phpt
+ext/pcre/tests/locales.phpt
+ext/soap/tests/bugs/bug39815.phpt
+ext/standard/tests/array/locale_sort.phpt
+ext/standard/tests/strings/htmlentities02.phpt
+ext/standard/tests/strings/htmlentities03.phpt
+ext/standard/tests/strings/setlocale_basic1.phpt
+ext/standard/tests/strings/setlocale_basic2.phpt
+ext/standard/tests/strings/setlocale_basic3.phpt
+ext/standard/tests/strings/setlocale_error.phpt
+ext/standard/tests/strings/setlocale_variation1.phpt
+ext/standard/tests/strings/setlocale_variation2.phpt
+ext/standard/tests/strings/setlocale_variation3.phpt
+ext/standard/tests/strings/setlocale_variation4.phpt
+ext/standard/tests/strings/setlocale_variation5.phpt
+ext/standard/tests/strings/sprintf_f_3.phpt
+ext/standard/tests/strings/strtoupper.phpt
+ext/standard/tests/time/strptime_basic.phpt
+ext/standard/tests/time/strptime_parts.phpt
+tests/basic/consistent_float_string_casts.phpt
+ext/standard/tests/strings/locale_independent_float_to_string.phpt
+tests/lang/bug30638.phpt
+Zend/tests/lc_ctype_inheritance.phpt
+
+# setlocale() does not affect result of nl_langinfo(CODESET) always returns UTF-8
+ext/fileinfo/tests/bug74170.phpt
+ext/standard/tests/strings/bug79986.phpt
+
+# Wrong results
+ext/pcre/tests/bug79846.phpt
+ext/pcre/tests/bug80118.phpt
+# compilation failed https://gitlab.alpinelinux.org/alpine/aports/-/issues/13116
+ext/pcre/tests/bug70345.phpt
+
+# no xml header displayed
+ext/tidy/tests/020.phpt
+
+# float formatting
+ext/standard/tests/strings/printf_h_H.phpt
+
+# fails on armv7
+ext/standard/tests/strings/chunk_split_variation2_32bit.phpt
+
+# fails on arch64, ppc64le, s390x
+ext/standard/tests/array/range.phpt
+
+
+#
+# Tests that fail for known reason and/or we don't need to worry about them
+#
+
+# Fails due to unsupported JP charsets.
+ext/iconv/tests/eucjp2iso2022jp.phpt
+ext/iconv/tests/iconv_mime_encode.phpt
+
+# Requires running SNMP server.
+ext/snmp/tests/*
+
+# Expects permissions on /etc to be 40755
+ext/standard/tests/file/006_error.phpt
+
+# Fails probably due to differencies in musl.
+ext/sockets/tests/socket_create_pair-wrongparams.phpt
+
+# Fail due to libxml2 upgrade to 2.9.12
+# See: https://gitlab.alpinelinux.org/alpine/aports/-/issues/12692
+ext/dom/tests/DOMDocument_loadXML_error1.phpt
+ext/dom/tests/DOMDocument_load_error1.phpt
+ext/dom/tests/bug43364.phpt
+ext/dom/tests/bug80268.phpt
+ext/libxml/tests/bug61367-read.phpt
+ext/libxml/tests/libxml_disable_entity_loader.phpt
+sapi/fpm/tests/bug68391-conf-include-order.phpt
diff --git a/repo/php8/fix-tests-devserver.patch b/repo/php8/fix-tests-devserver.patch
new file mode 100644
index 0000000..5447980
--- /dev/null
+++ b/repo/php8/fix-tests-devserver.patch
@@ -0,0 +1,23 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Mon, 01 May 2017 01:33:00 +0200
+Subject: [PATCH] Fix tests failing due to extra message from built-in web server
+
+Remove messages like:
+
+ PHP 7.1.4 Development Server started at Mon May 1 00:42:39 2017
+
+from test outputs, because tests do not expect them. I have no clue what
+happens here...
+
+--- a/run-tests.php
++++ b/run-tests.php
+@@ -2563,6 +2563,9 @@
+ // Does the output match what is expected?
+ $output = preg_replace("/\r\n/", "\n", trim($out));
+
++ // Remove message from built-in development server.
++ $output = preg_replace("/^PHP [0-9.]+ Development Server started at .*\n\n?/m", "", $output);
++
+ /* when using CGI, strip the headers from the output */
+ $headers = [];
+
diff --git a/repo/php8/includedir.patch b/repo/php8/includedir.patch
new file mode 100644
index 0000000..a835815
--- /dev/null
+++ b/repo/php8/includedir.patch
@@ -0,0 +1,41 @@
+--- a/scripts/Makefile.frag
++++ b/scripts/Makefile.frag
+@@ -2,7 +2,7 @@
+ # Build environment install
+ #
+
+-phpincludedir = $(includedir)/php
++phpincludedir = $(includedir)/php8
+ phpbuilddir = $(libdir)/build
+
+ BUILD_FILES = \
+--- a/ext/pdo/Makefile.frag
++++ b/ext/pdo/Makefile.frag
+@@ -1,4 +1,4 @@
+-phpincludedir=$(prefix)/include/php
++phpincludedir=$(prefix)/include/php8
+
+ PDO_HEADER_FILES= \
+ php_pdo.h \
+--- a/scripts/php-config.in
++++ b/scripts/php-config.in
+@@ -6,7 +6,7 @@
+ exec_prefix="@exec_prefix@"
+ version="@PHP_VERSION@"
+ vernum="@PHP_VERSION_ID@"
+-include_dir="@includedir@/php"
++include_dir="@includedir@/php8"
+ includes="-I$include_dir -I$include_dir/main -I$include_dir/TSRM -I$include_dir/Zend -I$include_dir/ext -I$include_dir/ext/date/lib"
+ ldflags="@PHP_LDFLAGS@"
+ libs="@EXTRA_LIBS@"
+--- a/scripts/phpize.in
++++ b/scripts/phpize.in
+@@ -5,7 +5,7 @@
+ datarootdir='@datarootdir@'
+ exec_prefix="`eval echo @exec_prefix@`"
+ phpdir="`eval echo @libdir@`/build"
+-includedir="`eval echo @includedir@`/php"
++includedir="`eval echo @includedir@`/php8"
+ builddir="`pwd`"
+ SED="@SED@"
+
diff --git a/repo/php8/install-pear.patch b/repo/php8/install-pear.patch
new file mode 100644
index 0000000..1c9f07f
--- /dev/null
+++ b/repo/php8/install-pear.patch
@@ -0,0 +1,14 @@
+--- ./pear/Makefile.frag.orig 2013-04-12 07:02:27.041602514 +0000
++++ ./pear/Makefile.frag 2013-04-12 07:04:09.065836822 +0000
+@@ -1,7 +1,10 @@
+ peardir=$(PEAR_INSTALLDIR)
+
++# help the built php to find xml extension so we can install pear
++PEAR_INSTALL_XML_FLAGS = -d extension="$(top_builddir)/modules/xml.so" -d extension="$(top_builddir)/modules/phar.so"
++
+ # Skip all php.ini files altogether
+-PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 -ddetect_unicode=0
++PEAR_INSTALL_FLAGS = -n -dshort_open_tag=0 -dopen_basedir= -derror_reporting=1803 -dmemory_limit=-1 -ddetect_unicode=0 $(PEAR_INSTALL_XML_FLAGS)
+
+ WGET = `which wget 2>/dev/null`
+ FETCH = `which fetch 2>/dev/null`
diff --git a/repo/php8/php8-fpm-version-suffix.patch b/repo/php8/php8-fpm-version-suffix.patch
new file mode 100644
index 0000000..50e1345
--- /dev/null
+++ b/repo/php8/php8-fpm-version-suffix.patch
@@ -0,0 +1,79 @@
+--- a/sapi/fpm/fpm/fpm_conf.c
++++ b/sapi/fpm/fpm/fpm_conf.c
+@@ -1262,7 +1262,7 @@
+ }
+
+ if (!fpm_global_config.error_log) {
+- fpm_global_config.error_log = strdup("log/php-fpm.log");
++ fpm_global_config.error_log = strdup("log/php8/error.log");
+ }
+
+ #ifdef HAVE_SYSTEMD
+@@ -1273,7 +1273,7 @@
+
+ #ifdef HAVE_SYSLOG_H
+ if (!fpm_global_config.syslog_ident) {
+- fpm_global_config.syslog_ident = strdup("php-fpm");
++ fpm_global_config.syslog_ident = strdup("php-fpm8");
+ }
+
+ if (fpm_global_config.syslog_facility < 0) {
+@@ -1777,7 +1777,7 @@
+ if (fpm_globals.prefix == NULL) {
+ spprintf(&tmp, 0, "%s/php-fpm.conf", PHP_SYSCONFDIR);
+ } else {
+- spprintf(&tmp, 0, "%s/etc/php-fpm.conf", fpm_globals.prefix);
++ spprintf(&tmp, 0, "%s/etc/php8/php-fpm.conf", fpm_globals.prefix);
+ }
+
+ if (!tmp) {
+
+--- a/sapi/fpm/php-fpm.conf.in
++++ b/sapi/fpm/php-fpm.conf.in
+@@ -16,3 +16,3 @@
+ ; Default Value: none
+-;pid = run/php-fpm.pid
++;pid = run/php-fpm8.pid
+
+@@ -22,4 +22,4 @@
+ ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
+-; Default Value: log/php-fpm.log
+-;error_log = log/php-fpm.log
++; Default Value: log/php8/error.log
++;error_log = log/php8/error.log
+
+@@ -35,4 +35,4 @@
+ ; which must suit common needs.
+-; Default Value: php-fpm
+-;syslog.ident = php-fpm
++; Default Value: php-fpm8
++;syslog.ident = php-fpm8
+
+--- a/sapi/fpm/www.conf.in
++++ b/sapi/fpm/www.conf.in
+@@ -273,7 +273,7 @@
+
+ ; The access log file
+ ; Default: not set
+-;access.log = log/$pool.access.log
++;access.log = log/php8/$pool.access.log
+
+ ; The access log format.
+ ; The following syntax is allowed
+@@ -337,7 +337,7 @@
+ ; The log file for slow requests
+ ; Default Value: not set
+ ; Note: slowlog is mandatory if request_slowlog_timeout is set
+-;slowlog = log/$pool.log.slow
++;slowlog = log/php8/$pool.slow.log
+
+ ; The timeout for serving a single request after which a PHP backtrace will be
+ ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+@@ -450,6 +450,6 @@
+ ; specified at startup with the -d argument
+ ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
+ ;php_flag[display_errors] = off
+-;php_admin_value[error_log] = /var/log/fpm-php.www.log
++;php_admin_value[error_log] = /var/log/php8/$pool.error.log
+ ;php_admin_flag[log_errors] = on
+ ;php_admin_value[memory_limit] = 32M
diff --git a/repo/php8/php8-fpm.initd b/repo/php8/php8-fpm.initd
new file mode 100644
index 0000000..f498581
--- /dev/null
+++ b/repo/php8/php8-fpm.initd
@@ -0,0 +1,93 @@
+#!/sbin/openrc-run
+
+# If you want to run separate master process per pool, then create a symlink
+# to this runscript for each pool. In that mode, the php-fpm daemon is started
+# as nobody by default. You can override the user (and group) by declaring
+# variable "user" and optionally "group" in conf.d file, or in the $fpm_config
+# file (the former has precedence).
+
+: ${name:="PHP FastCGI Process Manager"}
+
+command="/usr/sbin/php-fpm8"
+command_background="yes"
+start_stop_daemon_args="--quiet"
+pidfile="/run/$RC_SVCNAME/php-fpm.pid"
+retry="SIGTERM/20"
+
+# configtest is here only for backward compatibility
+extra_commands="checkconfig configtest"
+extra_started_commands="reload reopen"
+description_checkconfig="Run php-fpm config check"
+description_reload="Gracefully reload workers and config"
+description_reopen="Reopen log files"
+
+required_files="$fpm_config"
+
+depend() {
+ need net
+ use apache2 lighttpd nginx
+}
+
+init_vars() {
+ # Defaults for single master process with multiple pools
+ if [ "$RC_SVCNAME" = "php-fpm8" ]; then
+ : ${fpm_config:="/etc/php8/php-fpm.conf"}
+ : ${user:="root"}
+ # Defaults for master process per pool
+ else
+ : ${fpm_config="/etc/php8/php-fpm.d/${RC_SVCNAME#php-fpm8.}.conf"}
+ : ${user:="$(conf_get user)"}
+ : ${user:="nobody"}
+ : ${group:="$(conf_get group)"}
+ fi
+ command_args="--nodaemonize --fpm-config $fpm_config"
+ start_stop_daemon_args="$start_stop_daemon_args
+ --user $user ${group:+"--group $group"}"
+}
+
+start_pre() {
+ checkconfig || return 1
+
+ # If unix socket is used (instead of TCP/IP), then ensure that the
+ # directory exists and has correct privileges.
+ local listen="$(conf_get listen)"
+ if [ "${listen:0:1}" = "/" ]; then
+ checkpath -d -o $user:$group "$(dirname "$listen")"
+ fi
+
+ checkpath -d "$(dirname "$pidfile")"
+}
+
+reload() {
+ ebegin "Reloading $name"
+ start-stop-daemon --signal USR2 --pidfile "$pidfile"
+ eend $?
+}
+
+reopen() {
+ ebegin "Reopening $name log files"
+ start-stop-daemon --signal USR1 --pidfile "$pidfile"
+ eend $?
+}
+
+checkconfig() {
+ init_vars
+ ebegin "Checking $fpm_config"
+
+ local out
+ out="$(su -s /bin/sh -c "$command --test --fpm-config $fpm_config" $user 2>&1)" || {
+ printf "%s\n" "$out"
+ eend 1 "failed, please correct errors above"
+ return 1
+ }
+}
+
+configtest() {
+ ewarn "configtest is deprecated, use checkconfig instead"
+ checkconfig
+}
+
+conf_get() {
+ local key="$1"
+ sed -nE "s/^${key}\s*=\s*\"?([^\";]+).*/\1/p" "$fpm_config" | head -n 1
+}
diff --git a/repo/php8/php8-fpm.logrotate b/repo/php8/php8-fpm.logrotate
new file mode 100644
index 0000000..10b5bf3
--- /dev/null
+++ b/repo/php8/php8-fpm.logrotate
@@ -0,0 +1,13 @@
+/var/log/php8/*.log {
+ rotate 7
+ daily
+ missingok
+ notifempty
+ delaycompress
+ compress
+ dateext
+ sharedscripts
+ postrotate
+ /etc/init.d/php-fpm8 --ifstarted --quiet reopen
+ endscript
+}
diff --git a/repo/php8/php8-module.conf b/repo/php8/php8-module.conf
new file mode 100644
index 0000000..2ffe005
--- /dev/null
+++ b/repo/php8/php8-module.conf
@@ -0,0 +1,13 @@
+LoadModule php_module modules/mod_php8.so
+
+DirectoryIndex index.php index.html
+
+<FilesMatch \.php$>
+ SetHandler application/x-httpd-php
+</FilesMatch>
+
+# Uncomment the following to allow .phps files to be handled by the php source filter,
+# and displayed as syntax-highlighted source code
+#<FilesMatch "\.phps$">
+# SetHandler application/x-httpd-php-source
+#</FilesMatch>
diff --git a/repo/php8/php8.xibuild b/repo/php8/php8.xibuild
new file mode 100644
index 0000000..fd93e2a
--- /dev/null
+++ b/repo/php8/php8.xibuild
@@ -0,0 +1,215 @@
+#!/bin/sh
+
+NAME="php8"
+DESC="The PHP8 language runtime engine"
+
+MAKEDEPS="autoconf pcre2 re2c apache2 argon2 aspell bison bzip2 curl enchant2 freetds freetype gdbm gettext gmp icu imap krb5 libedit libical libjpeg-turbo libpng libpq lmdb oniguruma libsodium libwebp libxml2 libxpm libxslt libzip net-snmp openldap sqlite tidyhtml unixodbc zlib"
+
+PKG_VER=8.0.17
+suffix=8
+SOURCE="https://php.net/distributions/php-$PKG_VER.tar.xz"
+
+ADDITIONAL="
+atomic-lsapi.patch
+disabled-tests.list
+fix-tests-devserver.patch
+includedir.patch
+install-pear.patch
+php8-fpm-version-suffix.patch
+php8-fpm.initd
+php8-fpm.logrotate
+php8-module.conf
+sharedir.patch
+xfail-openssl-1.1-test.patch
+"
+
+prepare() {
+ apply_patches
+
+ # https://bugs.php.net/63362 - Not needed but installed headers.
+ # Drop some Windows specific headers to avoid installation,
+ # before build to ensure they are really not needed.
+ rm -f TSRM/tsrm_win32.h \
+ TSRM/tsrm_config.w32.h \
+ Zend/zend_config.w32.h \
+ ext/mysqlnd/config-win.h \
+ ext/standard/winver.h
+
+ # Fix some bogus permissions.
+ find . -name '*.[ch]' -exec chmod 644 {} \;
+
+ # XXX: Delete failing tests.
+ sed -n '/^[^#]/p' "$BUILD_ROOT"/disabled-tests.list | while read -r item; do
+ rm -r $item # do it in this way to apply globbing...
+ done
+
+ autoconf
+}
+
+# Notes:
+# * gd-jis-conv breaks any non-latin font rendering (vakartel).
+# * libxml cannot be build as shared.
+# * -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 (https://www.php.net/manual/en/intro.filesystem.php andypost)
+# * -O2 optimize for apps usage (andypost)
+_build() {
+ export CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+ export CXXFLAGS="$CXXFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+
+ local without_pcre_jit
+ [ "$CARCH" = "s390x" ] && without_pcre_jit="--without-pcre-jit"
+
+ EXTENSION_DIR=$_extension_dir ./configure \
+
+
+ --prefix=/usr \
+ --program-suffix=$suffix \
+ --libdir=$_libdir \
+ --datadir=/usr/share/php8 \
+ --sysconfdir=/etc/php8 \
+ --localstatedir=/var \
+ --with-layout=GNU \
+ --with-pic \
+ --with-config-file-path=/etc/php8 \
+ --with-config-file-scan-dir=$_extension_confd \
+ --disable-short-tags \
+ \
+ --enable-bcmath=shared \
+ --with-bz2=shared \
+ --enable-calendar=shared \
+ --enable-ctype=shared \
+ --with-curl=shared \
+ --enable-dba=shared \
+ --with-dbmaker=shared \
+ --with-gdbm \
+ --with-lmdb \
+ --enable-dom=shared \
+ --with-enchant=shared \
+ --enable-exif=shared \
+ --with-ffi=shared \
+ --enable-fileinfo=shared \
+ --enable-ftp=shared \
+ --enable-gd=shared \
+ --with-freetype \
+ --with-jpeg \
+ --with-webp \
+ --with-xpm \
+ --disable-gd-jis-conv \
+ --with-gettext=shared \
+ --with-gmp=shared \
+ --with-iconv=shared \
+ --with-imap=shared \
+ --with-imap-ssl \
+ --enable-intl=shared \
+ --with-ldap=shared \
+ --with-ldap-sasl \
+ --with-libedit \
+ --with-libxml \
+ --enable-mbstring=shared \
+ --with-mysqli=shared,mysqlnd \
+ --with-mysql-sock=/run/mysqld/mysqld.sock \
+ --enable-mysqlnd=shared \
+ --enable-opcache=shared \
+ --with-openssl=shared \
+ --with-kerberos \
+ --with-system-ciphers \
+ --with-password-argon2 \
+ --enable-pcntl=shared \
+ --with-external-pcre \
+ $without_pcre_jit \
+ --enable-pdo=shared \
+ --with-pdo-dblib=shared,/usr \
+ --with-pdo-mysql=shared,mysqlnd \
+ --with-pdo-odbc=shared,unixODBC,/usr \
+ --with-pdo-pgsql=shared \
+ --with-pdo-sqlite=shared \
+ --with-pgsql=shared \
+ --enable-phar=shared \
+ --enable-posix=shared \
+ --with-pspell=shared \
+ --without-readline \
+ --enable-session=shared \
+ --enable-shmop=shared \
+ --enable-simplexml=shared \
+ --with-snmp=shared \
+ --enable-soap=shared \
+ --with-sodium=shared \
+ --enable-sockets=shared \
+ --with-sqlite3=shared \
+ --enable-sysvmsg=shared \
+ --enable-sysvsem=shared \
+ --enable-sysvshm=shared \
+ --with-tidy=shared \
+ --enable-tokenizer=shared \
+ --with-unixODBC=shared,/usr \
+ --enable-xml=shared \
+ --enable-xmlreader=shared \
+ --enable-xmlwriter=shared \
+ --with-xsl=shared \
+ --with-zip=shared \
+ --with-zlib \
+ "$@"
+ make
+}
+
+build() {
+ # build phpcgi and apache2 SAPIs first
+ # because not fixed https://bugs.php.net/bug.php?id=52419
+ # apache2 module
+ _build --disable-phpdbg \
+ --disable-cli \
+ --with-apxs2
+ mv libs/libphp.so sapi/apache2handler/mod_php$suffix.so
+
+ _build --enable-phpdbg \
+ --with-pear=/usr/share/php8 \
+ --enable-fpm \
+ --enable-litespeed \
+ --enable-embed
+}
+
+check() {
+ # PHP is so stupid that it's not able to resolve dependencies
+ # between extensions and load them in correct order, so we must
+ # help it...
+ # opcache is Zend extension, it's handled specially in Makefile
+ local php_modules=$(_extensions_by_load_order \
+ | grep -vx opcache \
+ | xargs -n 1 printf "'$BUILD_ROOT/modules/%s.la' ")
+ sed -i "/^PHP_TEST_SHARED_EXTENSIONS/,/extension=/ \
+ s|in \$(PHP_MODULES)\"*|in $php_modules|" Makefile
+
+ # XXX: Few tests fail on the named platforms.
+ # Ignore it for now and continue build even on test failures.
+ local allow_fail='no'
+ case "$CARCH" in
+ x86 | s390x ) allow_fail='yes'
+ esac
+
+ TESTS="${TESTS:- --show-diff}" NO_INTERACTION=1 REPORT_EXIT_STATUS=1 \
+ SKIP_SLOW_TESTS=1 SKIP_ONLINE_TESTS=1 TEST_TIMEOUT=10 \
+ TZ='' LANG='' LC_ALL='' \
+ TRAVIS=true SKIP_IO_CAPTURE_TESTS=1 \
+ make test || [ "$allow_fail" = yes ]
+
+ echo 'NOTE: We have skipped quite a lot tests, see disabled-tests.list.'
+}
+
+package() {
+ make -j1 INSTALL_ROOT="$PKG_DEST" install
+
+ install -Dm644 php.ini-production "$PKG_DEST"/etc/php8/php.ini
+
+ local file; for file in pear peardev pecl; do
+ sed -i -e "s|/usr/bin/php|/usr/bin/php$suffix|g" \
+ -e "s|PHP=php|PHP=php$suffix|" \
+ "$PKG_DEST"/usr/bin/$file
+ done
+
+ find "$PKG_DEST" -name '.*' -print0 | xargs -0 rm -rf
+ rmdir "$PKG_DEST"/var/run
+
+ if [ "$_default_php" = yes ]; then
+ ln -s php$suffix "$PKG_DEST"/usr/bin/php
+ fi
+}
+
diff --git a/repo/php8/sharedir.patch b/repo/php8/sharedir.patch
new file mode 100644
index 0000000..7d5c104
--- /dev/null
+++ b/repo/php8/sharedir.patch
@@ -0,0 +1,11 @@
+--- a/php.ini-production
++++ b/php.ini-production
+@@ -742,7 +742,7 @@
+ ;;;;;;;;;;;;;;;;;;;;;;;;;
+
+ ; UNIX: "/path1:/path2"
+-;include_path = ".:/php/includes"
++include_path = ".:/usr/share/php8"
+ ;
+ ; Windows: "\path1;\path2"
+ ;include_path = ".;c:\php\includes"
diff --git a/repo/php8/xfail-openssl-1.1-test.patch b/repo/php8/xfail-openssl-1.1-test.patch
new file mode 100644
index 0000000..f607cc1
--- /dev/null
+++ b/repo/php8/xfail-openssl-1.1-test.patch
@@ -0,0 +1,13 @@
+diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt
+index e4ea264b3b..fd1f7ef9d3 100644
+--- a/ext/openssl/tests/openssl_error_string_basic.phpt
++++ b/ext/openssl/tests/openssl_error_string_basic.phpt
+@@ -2,6 +2,8 @@
+ openssl_error_string() tests
+ --SKIPIF--
+ <?php if (!extension_loaded("openssl")) print "skip"; ?>
++--XFAIL--
++Somehow unstable
+ --FILE--
+ <?php
+ // helper function to check openssl errors