php83: init at 8.3.0alpha2 (#239151)

* php83: init at 8.3.0alpha2

* phpExtensions.blackfire: disable for php 8.3

* phpExtensions.apcu: patch for 8.3 only
This commit is contained in:
Pol Dellaiera 2023-06-26 20:51:23 +02:00 committed by GitHub
parent 7f8a16b9f5
commit 5f85fe1e8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 23 deletions

@ -597,6 +597,7 @@ in {
php = handleTest ./php {};
php81 = handleTest ./php { php = pkgs.php81; };
php82 = handleTest ./php { php = pkgs.php82; };
php83 = handleTest ./php { php = pkgs.php83; };
phylactery = handleTest ./web-apps/phylactery.nix {};
pict-rs = handleTest ./pict-rs.nix {};
pinnwand = handleTest ./pinnwand.nix {};

@ -0,0 +1,57 @@
{ callPackage, fetchurl, ... }@_args:
let
base = (callPackage ./generic.nix (_args // {
version = "8.3.0alpha2";
hash = null;
})).overrideAttrs (oldAttrs: {
src = fetchurl {
url = "https://downloads.php.net/~eric/php-8.3.0alpha2.tar.xz";
hash = "sha256-YLCxgiDcsBisOmAodf0h8HyaCIh+4i1Q7QZw/h4KR5I=";
};
});
in
base.withExtensions ({ all, ... }: with all; ([
bcmath
calendar
curl
ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
imap
intl
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sysvsem
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
]))

@ -0,0 +1,14 @@
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index a6f3e64db6..c3047233db 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -14,6 +14,9 @@
+----------------------------------------------------------------------+
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include "php.h"
#include "libmagic/magic.h"

@ -1,4 +1,4 @@
{ buildPecl, lib, pcre2, fetchFromGitHub }:
{ buildPecl, lib, pcre2, fetchFromGitHub, php, fetchpatch }:
let
version = "5.1.22";
@ -13,6 +13,13 @@ in buildPecl {
sha256 = "sha256-L4a+/kWT95a1Km+FzFNiAaBw8enU6k4ZiCFRErjj9o8=";
};
patches = lib.optionals (lib.versionAtLeast php.version "8.3") [
(fetchpatch {
url = "https://github.com/krakjoe/apcu/commit/c9a29161c68c0faf71046e8f03f6a90900023ded.patch";
hash = "sha256-B0ZKk9TJy2+sYGs7TEX2KxUiOVawIb+RXNgToU1Fz5I=";
})
];
buildInputs = [ pcre2 ];
doCheck = true;
checkTarget = "test";

@ -17338,6 +17338,16 @@ with pkgs;
phpExtensions = php.extensions;
phpPackages = php.packages;
# Import PHP83 interpreter, extensions and packages
php83 = callPackage ../development/interpreters/php/8.3.nix {
stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;
pcre2 = pcre2.override {
withJitSealloc = false; # See https://bugs.php.net/bug.php?id=78927 and https://bugs.php.net/bug.php?id=78630
};
};
php83Extensions = recurseIntoAttrs php83.extensions;
php83Packages = recurseIntoAttrs php83.packages;
# Import PHP82 interpreter, extensions and packages
php82 = callPackage ../development/interpreters/php/8.2.nix {
stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv;

@ -1,7 +1,6 @@
{ stdenv
, lib
, pkgs
, fetchgit
, phpPackage
, autoconf
, pkg-config
@ -10,22 +9,16 @@
, curl
, cyrus_sasl
, enchant2
, fetchpatch
, freetds
, freetype
, gd
, gettext
, gmp
, html-tidy
, icu64
, libXpm
, libffi
, libiconv
, libjpeg
, libkrb5
, libpng
, libsodium
, libwebp
, libxml2
, libxslt
, libzip
@ -46,6 +39,7 @@
, uwimap
, valgrind
, zlib
, fetchpatch
}:
lib.makeScope pkgs.newScope (self: with self; {
@ -84,15 +78,15 @@ lib.makeScope pkgs.newScope (self: with self; {
# will mark the extension as a zend extension or not.
mkExtension = lib.makeOverridable
({ name
, configureFlags ? [ "--enable-${extName}" ]
, internalDeps ? [ ]
, postPhpize ? ""
, buildInputs ? [ ]
, zendExtension ? false
, doCheck ? true
, extName ? name
, ...
}@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
, configureFlags ? [ "--enable-${extName}" ]
, internalDeps ? [ ]
, postPhpize ? ""
, buildInputs ? [ ]
, zendExtension ? false
, doCheck ? true
, extName ? name
, ...
}@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
pname = "php-${name}";
extensionName = extName;
@ -216,8 +210,6 @@ lib.makeScope pkgs.newScope (self: with self; {
ast = callPackage ../development/php-packages/ast { };
blackfire = pkgs.callPackage ../development/tools/misc/blackfire/php-probe.nix { inherit php; };
couchbase = callPackage ../development/php-packages/couchbase { };
datadog_trace = callPackage ../development/php-packages/datadog_trace { };
@ -282,7 +274,7 @@ lib.makeScope pkgs.newScope (self: with self; {
redis = callPackage ../development/php-packages/redis { };
relay = callPackage ../development/php-packages/relay { inherit php; };
relay = callPackage ../development/php-packages/relay { inherit php; };
smbclient = callPackage ../development/php-packages/smbclient { };
@ -332,7 +324,16 @@ lib.makeScope pkgs.newScope (self: with self; {
}
{ name = "exif"; doCheck = false; }
{ name = "ffi"; buildInputs = [ libffi ]; }
{ name = "fileinfo"; buildInputs = [ pcre2 ]; }
{
name = "fileinfo";
buildInputs = [ pcre2 ];
patches = lib.optionals (lib.versionAtLeast php.version "8.3") [
# Fix the extension unable to be loaded due to missing `get_module` function.
# `ZEND_GET_MODULE` macro that creates it is conditional on `COMPILE_DL_FILEINFO` being defined.
# https://github.com/php/php-src/issues/11408#issuecomment-1602106200
../development/interpreters/php/fix-fileinfo-ext-php83.patch
];
}
{ name = "filter"; buildInputs = [ pcre2 ]; }
{ name = "ftp"; buildInputs = [ openssl ]; }
{
@ -519,7 +520,18 @@ lib.makeScope pkgs.newScope (self: with self; {
'';
doCheck = false;
}
{ name = "session"; doCheck = false; }
{ name = "session";
doCheck = false;
patches = lib.optionals (lib.versionAtLeast php.version "8.3") [
# Fix GH-11529: Crash after dealing with an Apache request
# To be removed in next alpha
# See https://github.com/php/php-src/issues/11529
(fetchpatch {
url = "https://github.com/php/php-src/commit/8d4370954ec610164a4503431bb0c52da6954aa7.patch";
hash = "sha256-w1uF9lRdfhz9I0gux0J4cvMzNS93uSHL1fYG23VLDPc=";
})
];
}
{ name = "shmop"; }
{
name = "simplexml";
@ -625,5 +637,7 @@ lib.makeScope pkgs.newScope (self: with self; {
# Produce the final attribute set of all extensions defined.
in
builtins.listToAttrs namedExtensions
);
) // lib.optionalAttrs (!(lib.versionAtLeast php.version "8.3")) {
blackfire = callPackage ../development/tools/misc/blackfire/php-probe.nix { inherit php; };
};
})