diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 12f8954c4040..ffc3408d1652 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -763,6 +763,7 @@ in { php81 = handleTest ./php { php = pkgs.php81; }; php82 = handleTest ./php { php = pkgs.php82; }; php83 = handleTest ./php { php = pkgs.php83; }; + php84 = handleTest ./php { php = pkgs.php84; }; phylactery = handleTest ./web-apps/phylactery.nix {}; pict-rs = handleTest ./pict-rs.nix {}; pinnwand = handleTest ./pinnwand.nix {}; diff --git a/pkgs/development/interpreters/php/8.4.nix b/pkgs/development/interpreters/php/8.4.nix new file mode 100644 index 000000000000..9c6fd1d39288 --- /dev/null +++ b/pkgs/development/interpreters/php/8.4.nix @@ -0,0 +1,61 @@ +{ callPackage, fetchurl, ... }@_args: + +let + base = callPackage ./generic.nix ( + _args + // { + version = "8.4.0alpha4"; + phpSrc = fetchurl { + url = "https://downloads.php.net/~saki/php-8.4.0alpha4.tar.xz"; + hash = "sha256-v411aNKrbteDZnkfpai8SqUgWFQbqZJbzPF5mdCr2Og="; + }; + } + ); +in +base.withExtensions ( + { all, ... }: + with all; + [ + bcmath + calendar + curl + ctype + dom + exif + fileinfo + filter + ftp + gd + gettext + gmp + iconv + 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 + ] +) diff --git a/pkgs/development/php-packages/apcu/default.nix b/pkgs/development/php-packages/apcu/default.nix index 9cfe9b96cf34..2e8294d0345b 100644 --- a/pkgs/development/php-packages/apcu/default.nix +++ b/pkgs/development/php-packages/apcu/default.nix @@ -1,6 +1,7 @@ { buildPecl, lib, + fetchpatch, pcre2, fetchFromGitHub, }: @@ -19,6 +20,22 @@ buildPecl { sha256 = "sha256-UDKLLCCnYJj/lCD8ZkkDf2WYZMoIbcP75+0/IXo4vdQ="; }; + patches = [ + # Fix broken test (apc_entry_002) with PHP 8.4 alpha1 + # See https://github.com/krakjoe/apcu/issues/510 + (fetchpatch { + url = "https://github.com/krakjoe/apcu/commit/9dad016db50cc46321afec592ea9b49520c1cf13.patch"; + hash = "sha256-8CPUNhEGCVVSXWYridN1+4N4JzCfXZbmUIsPYs/9jfk="; + }) + + # Fix ZTS detection in tests with PHP 8.4 + # https://github.com/krakjoe/apcu/pull/511 + (fetchpatch { + url = "https://github.com/krakjoe/apcu/commit/15766e615264620427c2db37061ca9614d3b7319.patch"; + hash = "sha256-gbSkx47Uo9E28CfJJj4+3ydcw8cXW9NNN/3FuYYTVPY="; + }) + ]; + buildInputs = [ pcre2 ]; doCheck = true; checkTarget = "test"; diff --git a/pkgs/development/php-packages/imap/default.nix b/pkgs/development/php-packages/imap/default.nix new file mode 100644 index 000000000000..208130e95158 --- /dev/null +++ b/pkgs/development/php-packages/imap/default.nix @@ -0,0 +1,60 @@ +{ + buildPecl, + fetchFromGitHub, + fetchpatch, + lib, + libkrb5, + openssl, + pam, + pcre2, + pkg-config, + uwimap, +}: + +let + version = "1.0.2"; +in +buildPecl { + inherit version; + pname = "imap"; + + src = fetchFromGitHub { + owner = "php"; + repo = "pecl-mail-imap"; + rev = version; + hash = "sha256-QVeimxm3rfWMvMpSgadhMKd24yPdDGVuhXIOs8668do="; + }; + + patches = [ + # Fix compilation with PHP 8.4. + (fetchpatch { + url = "https://github.com/php/pecl-mail-imap/commit/4fc9970a29c205ec328f36edc8c119c158129324.patch"; + hash = "sha256-MxEaEe4YVeP7W5gDSNJb0thwAhxDj/yRr3qvjlJjRL4="; + }) + ]; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ + uwimap + openssl + pam + pcre2 + libkrb5 + ]; + + configureFlags = [ + "--with-imap=${uwimap}" + "--with-imap-ssl" + "--with-kerberos" + ]; + + doCheck = true; + + meta = with lib; { + description = "PHP extension for checking the spelling of a word"; + homepage = "https://pecl.php.net/package/imap"; + license = licenses.php301; + maintainers = teams.php.members; + }; +} diff --git a/pkgs/development/php-packages/pspell/default.nix b/pkgs/development/php-packages/pspell/default.nix new file mode 100644 index 000000000000..fb8609bca3a3 --- /dev/null +++ b/pkgs/development/php-packages/pspell/default.nix @@ -0,0 +1,32 @@ +{ + aspell, + buildPecl, + fetchFromGitHub, + lib, +}: + +let + version = "1.0.1"; +in +buildPecl { + inherit version; + pname = "pspell"; + + src = fetchFromGitHub { + owner = "php"; + repo = "pecl-text-pspell"; + rev = version; + hash = "sha256-IVBuEVsUKah8W+oVpIPT9Iln6MFox0e5/5Y14/Kgcg4="; + }; + + configureFlags = [ "--with-pspell=${aspell}" ]; + + doCheck = true; + + meta = with lib; { + description = "PHP extension for checking the spelling of a word"; + homepage = "https://pecl.php.net/package/pspell"; + license = licenses.php301; + maintainers = teams.php.members; + }; +} diff --git a/pkgs/development/tools/misc/blackfire/php-probe.nix b/pkgs/development/tools/misc/blackfire/php-probe.nix index e31984a2c28f..8ec0fcac05f9 100644 --- a/pkgs/development/tools/misc/blackfire/php-probe.nix +++ b/pkgs/development/tools/misc/blackfire/php-probe.nix @@ -13,6 +13,7 @@ assert lib.assertMsg (!php.ztsSupport) "blackfire only supports non zts versions let phpMajor = lib.versions.majorMinor php.version; + inherit (stdenv.hostPlatform) system; version = "1.92.21"; @@ -63,20 +64,21 @@ let let isLinux = builtins.match ".+-linux" system != null; in - assert !isLinux -> (phpMajor != null); fetchurl { url = "https://packages.blackfire.io/binaries/blackfire-php/${version}/blackfire-php-${if isLinux then "linux" else "darwin"}_${hashes.${system}.system}-php-${builtins.replaceStrings [ "." ] [ "" ] phpMajor}.so"; hash = hashes.${system}.hash.${phpMajor}; }; in + +assert lib.assertMsg (hashes ? ${system}.hash.${phpMajor}) "blackfire does not support PHP version ${phpMajor} on ${system}."; + stdenv.mkDerivation (finalAttrs: { pname = "php-blackfire"; extensionName = "blackfire"; inherit version; src = makeSource { - system = stdenv.hostPlatform.system; - inherit phpMajor; + inherit system phpMajor; }; nativeBuildInputs = lib.optionals stdenv.isLinux [ @@ -114,39 +116,22 @@ stdenv.mkDerivation (finalAttrs: { # All sources for updating by the update script. updateables = let - createName = path: - builtins.replaceStrings [ "." ] [ "_" ] (lib.concatStringsSep "_" path); + createName = { phpMajor, system }: + "php${builtins.replaceStrings [ "." ] [ "" ] phpMajor}_${system}"; - createSourceParams = path: - let - # The path will be either [«system» sha256], or [«system» sha256 «phpMajor» «zts»], - # Let’s skip the sha256. - rest = builtins.tail (builtins.tail path); - in - { - system = - builtins.head path; - phpMajor = - if builtins.length rest == 0 - then null - else builtins.head rest; - }; - - createUpdateable = path: _value: + createUpdateable = sourceParams: lib.nameValuePair - (createName path) + (createName sourceParams) (finalAttrs.finalPackage.overrideAttrs (attrs: { - src = makeSource (createSourceParams path); + src = makeSource sourceParams; })); - - # Filter out all attributes other than hashes. - hashesOnly = lib.filterAttrsRecursive (name: _value: name != "system") hashes; in - builtins.listToAttrs - # Collect all leaf attributes (containing hashes). - (lib.collect - (attrs: attrs ? name) - (lib.mapAttrsRecursive createUpdateable hashesOnly)); + lib.concatMapAttrs ( + system: + { hash, ... }: + + lib.mapAttrs' (phpMajor: _hash: createUpdateable { inherit phpMajor system; }) hash + ) hashes; }; meta = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ea2ba5c73a31..1400a1718b8a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16841,6 +16841,16 @@ with pkgs; phpExtensions = php.extensions; phpPackages = php.packages; + # Import PHP84 interpreter, extensions and packages + php84 = callPackage ../development/interpreters/php/8.4.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 + }; + }; + php84Extensions = recurseIntoAttrs php84.extensions; + php84Packages = recurseIntoAttrs php84.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; diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index de9b83df972e..d6d2af5850d0 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -6,7 +6,6 @@ , phpPackage , autoconf , pkg-config -, aspell , bzip2 , curl , cyrus_sasl @@ -266,6 +265,9 @@ in { imagick = callPackage ../development/php-packages/imagick { }; + # Shadowed by built-in version on PHP < 8.3. + imap = callPackage ../development/php-packages/imap { }; + inotify = callPackage ../development/php-packages/inotify { }; ioncube-loader = callPackage ../development/php-packages/ioncube-loader { }; @@ -324,6 +326,8 @@ in { protobuf = callPackage ../development/php-packages/protobuf { }; + pspell = callPackage ../development/php-packages/pspell { }; + rdkafka = callPackage ../development/php-packages/rdkafka { }; redis = callPackage ../development/php-packages/redis { }; @@ -405,6 +409,14 @@ in { hash = "sha256-sodGODHb4l04P0srn3L8l3K+DjZzCsCNbamfkmIyF+k="; excludes = [ "NEWS" ]; }) + ] ++ lib.optionals (lib.versions.majorMinor php.version == "8.4") [ + # Fix compatibility with libxml2 ≥ 2.13.2 + # https://github.com/php/php-src/issues/15331 + (fetchpatch { + url = "https://github.com/php/php-src/commit/8d7365b6f009ba43e305d6459013ac4fbed7c606.diff?full_index=1"; + hash = "sha256-ct0Ml9kjjcRLryjxMsUQQsDXiDExjpnCnWKf+mYgTsQ="; + excludes = [ "NEWS" ]; + }) ]; } { @@ -452,6 +464,8 @@ in { name = "imap"; buildInputs = [ uwimap openssl pam pcre2 libkrb5 ]; configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" "--with-kerberos" ]; + # Using version from PECL on new PHP versions. + enable = lib.versionOlder php.version "8.3"; } { name = "intl"; @@ -584,7 +598,6 @@ in { doCheck = false; } { name = "posix"; doCheck = false; } - { name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; } { name = "readline"; buildInputs = [ @@ -777,7 +790,7 @@ in { namedExtensions = builtins.map (drv: { name = drv.name; - value = mkExtension drv; + value = mkExtension (builtins.removeAttrs drv [ "enable" ]); }) (builtins.filter (i: i.enable or true) extensionData);