php: Run nixpkgs-fmt on all php related files

This commit is contained in:
Elis Hirwing 2021-06-26 09:46:46 +02:00
parent 42cadf5a76
commit 94d07b7492
No known key found for this signature in database
GPG key ID: D57EFA625C9A925F
10 changed files with 789 additions and 563 deletions

View file

@ -1,5 +1,5 @@
{ system ? builtins.currentSystem { system ? builtins.currentSystem
, config ? {} , config ? { }
, pkgs ? import ../../.. { inherit system config; } , pkgs ? import ../../.. { inherit system config; }
, php ? pkgs.php , php ? pkgs.php
}: }:
@ -8,7 +8,8 @@ let
php' = php.buildEnv { php' = php.buildEnv {
extensions = { enabled, all }: with all; enabled ++ [ apcu ]; extensions = { enabled, all }: with all; enabled ++ [ apcu ];
}; };
in { in
{
fpm = import ./fpm.nix { inherit system pkgs; php = php'; }; fpm = import ./fpm.nix { inherit system pkgs; php = php'; };
httpd = import ./httpd.nix { inherit system pkgs; php = php'; }; httpd = import ./httpd.nix { inherit system pkgs; php = php'; };
pcre = import ./pcre.nix { inherit system pkgs; php = php'; }; pcre = import ./pcre.nix { inherit system pkgs; php = php'; };

View file

@ -1,4 +1,4 @@
import ../make-test-python.nix ({pkgs, lib, php, ...}: { import ../make-test-python.nix ({ pkgs, lib, php, ... }: {
name = "php-${php.version}-fpm-nginx-test"; name = "php-${php.version}-fpm-nginx-test";
meta.maintainers = lib.teams.php.members; meta.maintainers = lib.teams.php.members;
@ -8,9 +8,11 @@ import ../make-test-python.nix ({pkgs, lib, php, ...}: {
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts."phpfpm" = let virtualHosts."phpfpm" =
let
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();"; testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
in { in
{
root = "${testdir}/web"; root = "${testdir}/web";
locations."~ \\.php$".extraConfig = '' locations."~ \\.php$".extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket}; fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket};

View file

@ -1,4 +1,4 @@
import ../make-test-python.nix ({pkgs, lib, php, ...}: { import ../make-test-python.nix ({ pkgs, lib, php, ... }: {
name = "php-${php.version}-httpd-test"; name = "php-${php.version}-httpd-test";
meta.maintainers = lib.teams.php.members; meta.maintainers = lib.teams.php.members;
@ -6,9 +6,11 @@ import ../make-test-python.nix ({pkgs, lib, php, ...}: {
services.httpd = { services.httpd = {
enable = true; enable = true;
adminAddr = "admin@phpfpm"; adminAddr = "admin@phpfpm";
virtualHosts."phpfpm" = let virtualHosts."phpfpm" =
let
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();"; testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
in { in
{
documentRoot = "${testdir}/web"; documentRoot = "${testdir}/web";
locations."/" = { locations."/" = {
index = "index.php index.html"; index = "index.php index.html";

View file

@ -1,6 +1,7 @@
let let
testString = "can-use-subgroups"; testString = "can-use-subgroups";
in import ../make-test-python.nix ({lib, php, ...}: { in
import ../make-test-python.nix ({ lib, php, ... }: {
name = "php-${php.version}-httpd-pcre-jit-test"; name = "php-${php.version}-httpd-pcre-jit-test";
meta.maintainers = lib.teams.php.members; meta.maintainers = lib.teams.php.members;
@ -12,7 +13,8 @@ in import ../make-test-python.nix ({lib, php, ...}: {
phpPackage = php; phpPackage = php;
enablePHP = true; enablePHP = true;
phpOptions = "pcre.jit = true"; phpOptions = "pcre.jit = true";
extraConfig = let extraConfig =
let
testRoot = pkgs.writeText "index.php" testRoot = pkgs.writeText "index.php"
'' ''
<?php <?php

View file

@ -2,12 +2,12 @@
{ pname { pname
, version , version
, internalDeps ? [] , internalDeps ? [ ]
, peclDeps ? [] , peclDeps ? [ ]
, buildInputs ? [] , buildInputs ? [ ]
, nativeBuildInputs ? [] , nativeBuildInputs ? [ ]
, postPhpize ? "" , postPhpize ? ""
, makeFlags ? [] , makeFlags ? [ ]
, src ? fetchurl { , src ? fetchurl {
url = "http://pecl.php.net/get/${pname}-${version}.tgz"; url = "http://pecl.php.net/get/${pname}-${version}.tgz";
inherit (args) sha256; inherit (args) sha256;

View file

@ -6,10 +6,47 @@ let
sha256 = "0d5ncz97y0271dsmz269wl4721vhq2fn6pmm9rxglc756p36pnha"; sha256 = "0d5ncz97y0271dsmz269wl4721vhq2fn6pmm9rxglc756p36pnha";
}); });
in base.withExtensions ({ all, ... }: with all; ([ in
bcmath calendar curl ctype dom exif fileinfo filter ftp gd base.withExtensions ({ all, ... }: with all; ([
gettext gmp iconv intl json ldap mbstring mysqli mysqlnd opcache bcmath
openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql calendar
posix readline session simplexml sockets soap sodium sqlite3 curl
tokenizer xmlreader xmlwriter zip zlib ctype
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
iconv
intl
json
ldap
mbstring
mysqli
mysqlnd
opcache
openssl
pcntl
pdo
pdo_mysql
pdo_odbc
pdo_pgsql
pdo_sqlite
pgsql
posix
readline
session
simplexml
sockets
soap
sodium
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
] ++ lib.optionals (!stdenv.isDarwin) [ imap ])) ] ++ lib.optionals (!stdenv.isDarwin) [ imap ]))

View file

@ -6,10 +6,46 @@ let
sha256 = "0yazcc9x66xg1gmi3rpgk891g6s3mm7aywcadqfqnx1mdz4z5ckj"; sha256 = "0yazcc9x66xg1gmi3rpgk891g6s3mm7aywcadqfqnx1mdz4z5ckj";
}); });
in base.withExtensions ({ all, ... }: with all; ([ in
bcmath calendar curl ctype dom exif fileinfo filter ftp gd base.withExtensions ({ all, ... }: with all; ([
gettext gmp iconv intl ldap mbstring mysqli mysqlnd opcache bcmath
openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql calendar
posix readline session simplexml sockets soap sodium sqlite3 curl
tokenizer xmlreader xmlwriter zip zlib 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
sqlite3
tokenizer
xmlreader
xmlwriter
zip
zlib
] ++ lib.optionals (!stdenv.isDarwin) [ imap ])) ] ++ lib.optionals (!stdenv.isDarwin) [ imap ]))

View file

@ -3,15 +3,34 @@
let let
generic = generic =
{ callPackage, lib, stdenv, nixosTests, fetchurl, makeWrapper { callPackage
, symlinkJoin, writeText, autoconf, automake, bison, flex, libtool , lib
, pkg-config, re2c, apacheHttpd, libargon2, libxml2, pcre2 , stdenv
, systemd, system-sendmail, valgrind, xcbuild , nixosTests
, fetchurl
, makeWrapper
, symlinkJoin
, writeText
, autoconf
, automake
, bison
, flex
, libtool
, pkg-config
, re2c
, apacheHttpd
, libargon2
, libxml2
, pcre2
, systemd
, system-sendmail
, valgrind
, xcbuild
, version , version
, sha256 , sha256
, extraPatches ? [] , extraPatches ? [ ]
, packageOverrides ? (final: prev: {}) , packageOverrides ? (final: prev: { })
# Sapi flags # Sapi flags
, cgiSupport ? true , cgiSupport ? true
@ -57,7 +76,7 @@ let
builtins.foldl' builtins.foldl'
(enabled: f: (enabled: f:
f { inherit enabled; all = php-packages.extensions; }) f { inherit enabled; all = php-packages.extensions; })
[] [ ]
allExtensionFunctions; allExtensionFunctions;
getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name; getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
@ -67,10 +86,10 @@ let
getDepsRecursively = extensions: getDepsRecursively = extensions:
let let
deps = lib.concatMap deps = lib.concatMap
(ext: (ext.internalDeps or []) ++ (ext.peclDeps or [])) (ext: (ext.internalDeps or [ ]) ++ (ext.peclDeps or [ ]))
extensions; extensions;
in in
if ! (deps == []) then if ! (deps == [ ]) then
deps ++ (getDepsRecursively deps) deps ++ (getDepsRecursively deps)
else else
deps; deps;
@ -83,10 +102,11 @@ let
# fail to load. # fail to load.
extensionTexts = extensionTexts =
lib.listToAttrs lib.listToAttrs
(map (ext: (map
(ext:
let let
extName = getExtName ext; extName = getExtName ext;
phpDeps = (ext.internalDeps or []) ++ (ext.peclDeps or []); phpDeps = (ext.internalDeps or [ ]) ++ (ext.peclDeps or [ ]);
type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension"; type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension";
in in
lib.nameValuePair extName { lib.nameValuePair extName {
@ -137,7 +157,8 @@ let
''; '';
}; };
in in
phpWithExtensions); phpWithExtensions
);
mkWithExtensions = prevArgs: prevExtensionFunctions: extensions: mkWithExtensions = prevArgs: prevExtensionFunctions: extensions:
mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; }; mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; };
@ -224,7 +245,7 @@ let
export EXTENSION_DIR=$out/lib/php/extensions export EXTENSION_DIR=$out/lib/php/extensions
'' ''
# PKG_CONFIG need not be a relative path # PKG_CONFIG need not be a relative path
+ lib.optionalString (! lib.versionAtLeast version "7.4") '' + lib.optionalString (!lib.versionAtLeast version "7.4") ''
for i in $(find . -type f -name "*.m4"); do for i in $(find . -type f -name "*.m4"); do
substituteInPlace $i \ substituteInPlace $i \
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null' --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
@ -264,8 +285,8 @@ let
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
passthru = { passthru = {
buildEnv = mkBuildEnv {} []; buildEnv = mkBuildEnv { } [ ];
withExtensions = mkWithExtensions {} []; withExtensions = mkWithExtensions { } [ ];
inherit ztsSupport; inherit ztsSupport;
}; };
@ -278,4 +299,5 @@ let
outputsToInstall = [ "out" "dev" ]; outputsToInstall = [ "out" "dev" ];
}; };
}; };
in generic in
generic

View file

@ -1,5 +1,15 @@
{ stdenv, buildPecl, lib, pcre2, pkg-config, cyrus_sasl, icu64 { stdenv
, openssl, snappy, zlib, darwin }: , buildPecl
, lib
, pcre2
, pkg-config
, cyrus_sasl
, icu64
, openssl
, snappy
, zlib
, darwin
}:
buildPecl { buildPecl {
pname = "mongodb"; pname = "mongodb";

View file

@ -1,9 +1,49 @@
{ stdenv, lib, pkgs, fetchgit, phpPackage, autoconf, pkg-config, re2c { stdenv
, gettext, bzip2, curl, libxml2, openssl, gmp, icu64, oniguruma, libsodium , lib
, html-tidy, libzip, zlib, pcre2, libxslt, aspell, openldap, cyrus_sasl , pkgs
, uwimap, pam, libiconv, enchant1, libXpm, gd, libwebp, libjpeg, libpng , fetchgit
, freetype, libffi, freetds, postgresql, sqlite, net-snmp, unixODBC, libedit , phpPackage
, readline, rsync, fetchpatch, valgrind , autoconf
, pkg-config
, aspell
, bzip2
, curl
, cyrus_sasl
, enchant1
, fetchpatch
, freetds
, freetype
, gd
, gettext
, gmp
, html-tidy
, icu64
, libXpm
, libedit
, libffi
, libiconv
, libjpeg
, libpng
, libsodium
, libwebp
, libxml2
, libxslt
, libzip
, net-snmp
, oniguruma
, openldap
, openssl
, pam
, pcre2
, postgresql
, re2c
, readline
, rsync
, sqlite
, unixODBC
, uwimap
, valgrind
, zlib
}: }:
lib.makeScope pkgs.newScope (self: with self; { lib.makeScope pkgs.newScope (self: with self; {
@ -129,7 +169,8 @@ lib.makeScope pkgs.newScope (self: with self; {
xdebug = callPackage ../development/php-packages/xdebug { }; xdebug = callPackage ../development/php-packages/xdebug { };
yaml = callPackage ../development/php-packages/yaml { }; yaml = callPackage ../development/php-packages/yaml { };
} // (let } // (
let
# Function to build a single php extension based on the php version. # Function to build a single php extension based on the php version.
# #
# Name passed is the name of the extension and is automatically used # Name passed is the name of the extension and is automatically used
@ -137,12 +178,12 @@ lib.makeScope pkgs.newScope (self: with self; {
# #
# Build inputs is used for extra deps that may be needed. And zendExtension # Build inputs is used for extra deps that may be needed. And zendExtension
# will mark the extension as a zend extension or not. # will mark the extension as a zend extension or not.
mkExtension = { mkExtension =
name { name
, configureFlags ? [ "--enable-${name}" ] , configureFlags ? [ "--enable-${name}" ]
, internalDeps ? [] , internalDeps ? [ ]
, postPhpize ? "" , postPhpize ? ""
, buildInputs ? [] , buildInputs ? [ ]
, zendExtension ? false , zendExtension ? false
, doCheck ? true , doCheck ? true
, ... , ...
@ -205,12 +246,15 @@ lib.makeScope pkgs.newScope (self: with self; {
{ name = "bz2"; buildInputs = [ bzip2 ]; configureFlags = [ "--with-bz2=${bzip2.dev}" ]; } { name = "bz2"; buildInputs = [ bzip2 ]; configureFlags = [ "--with-bz2=${bzip2.dev}" ]; }
{ name = "calendar"; } { name = "calendar"; }
{ name = "ctype"; } { name = "ctype"; }
{ name = "curl"; {
name = "curl";
buildInputs = [ curl ]; buildInputs = [ curl ];
configureFlags = [ "--with-curl=${curl.dev}" ]; configureFlags = [ "--with-curl=${curl.dev}" ];
doCheck = false; } doCheck = false;
}
{ name = "dba"; } { name = "dba"; }
{ name = "dom"; {
name = "dom";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2 ];
patches = [ patches = [
# https://github.com/php/php-src/pull/7030 # https://github.com/php/php-src/pull/7030
@ -228,19 +272,23 @@ lib.makeScope pkgs.newScope (self: with self; {
''; '';
configureFlags = [ "--enable-dom" ] configureFlags = [ "--enable-dom" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
{ name = "enchant"; }
{
name = "enchant";
buildInputs = [ enchant1 ]; buildInputs = [ enchant1 ];
configureFlags = [ "--with-enchant=${enchant1}" ]; configureFlags = [ "--with-enchant=${enchant1}" ];
# enchant1 doesn't build on darwin. # enchant1 doesn't build on darwin.
enable = (!stdenv.isDarwin); enable = (!stdenv.isDarwin);
doCheck = false; } doCheck = false;
}
{ name = "exif"; doCheck = false; } { name = "exif"; doCheck = false; }
{ name = "ffi"; buildInputs = [ libffi ]; enable = lib.versionAtLeast php.version "7.4"; } { name = "ffi"; buildInputs = [ libffi ]; enable = lib.versionAtLeast php.version "7.4"; }
{ name = "fileinfo"; buildInputs = [ pcre2 ]; } { name = "fileinfo"; buildInputs = [ pcre2 ]; }
{ name = "filter"; buildInputs = [ pcre2 ]; } { name = "filter"; buildInputs = [ pcre2 ]; }
{ name = "ftp"; buildInputs = [ openssl ]; } { name = "ftp"; buildInputs = [ openssl ]; }
{ name = "gd"; {
name = "gd";
buildInputs = [ zlib gd ]; buildInputs = [ zlib gd ];
configureFlags = [ configureFlags = [
"--enable-gd" "--enable-gd"
@ -248,8 +296,10 @@ lib.makeScope pkgs.newScope (self: with self; {
"--enable-gd-jis-conv" "--enable-gd-jis-conv"
]; ];
doCheck = false; doCheck = false;
enable = lib.versionAtLeast php.version "7.4"; } enable = lib.versionAtLeast php.version "7.4";
{ name = "gd"; }
{
name = "gd";
buildInputs = [ zlib gd libXpm ]; buildInputs = [ zlib gd libXpm ];
configureFlags = [ configureFlags = [
"--with-gd=${gd.dev}" "--with-gd=${gd.dev}"
@ -262,8 +312,10 @@ lib.makeScope pkgs.newScope (self: with self; {
"--enable-gd-jis-conv" "--enable-gd-jis-conv"
]; ];
doCheck = false; doCheck = false;
enable = lib.versionOlder php.version "7.4"; } enable = lib.versionOlder php.version "7.4";
{ name = "gettext"; }
{
name = "gettext";
buildInputs = [ gettext ]; buildInputs = [ gettext ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [ patches = lib.optionals (lib.versionOlder php.version "7.4") [
(fetchpatch { (fetchpatch {
@ -272,12 +324,16 @@ lib.makeScope pkgs.newScope (self: with self; {
}) })
]; ];
postPhpize = ''substituteInPlace configure --replace 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' ''; postPhpize = ''substituteInPlace configure --replace 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' '';
configureFlags = [ "--with-gettext=${gettext}" ]; } configureFlags = [ "--with-gettext=${gettext}" ];
{ name = "gmp"; }
{
name = "gmp";
buildInputs = [ gmp ]; buildInputs = [ gmp ];
configureFlags = [ "--with-gmp=${gmp.dev}" ]; } configureFlags = [ "--with-gmp=${gmp.dev}" ];
}
{ name = "hash"; enable = lib.versionOlder php.version "7.4"; } { name = "hash"; enable = lib.versionOlder php.version "7.4"; }
{ name = "iconv"; {
name = "iconv";
configureFlags = [ configureFlags = [
"--with-iconv${lib.optionalString stdenv.isDarwin "=${libiconv}"}" "--with-iconv${lib.optionalString stdenv.isDarwin "=${libiconv}"}"
]; ];
@ -288,13 +344,17 @@ lib.makeScope pkgs.newScope (self: with self; {
sha256 = "7GHnEUu+hcsQ4h3itDwk6p46ZKfib9JZ2XpWlXrdn6E="; sha256 = "7GHnEUu+hcsQ4h3itDwk6p46ZKfib9JZ2XpWlXrdn6E=";
}) })
]; ];
doCheck = false; } doCheck = false;
{ name = "imap"; }
{
name = "imap";
buildInputs = [ uwimap openssl pam pcre2 ]; buildInputs = [ uwimap openssl pam pcre2 ];
configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" ]; configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" ];
# uwimap doesn't build on darwin. # uwimap doesn't build on darwin.
enable = (!stdenv.isDarwin); } enable = (!stdenv.isDarwin);
{ name = "intl"; }
{
name = "intl";
buildInputs = [ icu64 ]; buildInputs = [ icu64 ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [ patches = lib.optionals (lib.versionOlder php.version "7.4") [
(fetchpatch { (fetchpatch {
@ -304,7 +364,8 @@ lib.makeScope pkgs.newScope (self: with self; {
]; ];
} }
{ name = "json"; enable = lib.versionOlder php.version "8.0"; } { name = "json"; enable = lib.versionOlder php.version "8.0"; }
{ name = "ldap"; {
name = "ldap";
buildInputs = [ openldap cyrus_sasl ]; buildInputs = [ openldap cyrus_sasl ];
configureFlags = [ configureFlags = [
"--with-ldap" "--with-ldap"
@ -314,15 +375,23 @@ lib.makeScope pkgs.newScope (self: with self; {
] ++ lib.optionals stdenv.isLinux [ ] ++ lib.optionals stdenv.isLinux [
"--with-ldap-sasl=${cyrus_sasl.dev}" "--with-ldap-sasl=${cyrus_sasl.dev}"
]; ];
doCheck = false; } doCheck = false;
{ name = "mbstring"; buildInputs = [ oniguruma ] ++ lib.optionals (lib.versionAtLeast php.version "8.0") [ }
{
name = "mbstring";
buildInputs = [ oniguruma ] ++ lib.optionals (lib.versionAtLeast php.version "8.0") [
pcre2 pcre2
]; doCheck = false; } ];
{ name = "mysqli"; doCheck = false;
}
{
name = "mysqli";
internalDeps = [ php.extensions.mysqlnd ]; internalDeps = [ php.extensions.mysqlnd ];
configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ]; configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ];
doCheck = false; } doCheck = false;
{ name = "mysqlnd"; }
{
name = "mysqlnd";
buildInputs = [ zlib openssl ]; buildInputs = [ zlib openssl ];
# The configure script doesn't correctly add library link # The configure script doesn't correctly add library link
# flags, so we add them to the variable used by the Makefile # flags, so we add them to the variable used by the Makefile
@ -360,11 +429,13 @@ lib.makeScope pkgs.newScope (self: with self; {
postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") '' postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") ''
substituteInPlace configure --replace '$OPENSSL_LIBDIR' '${openssl}/lib' \ substituteInPlace configure --replace '$OPENSSL_LIBDIR' '${openssl}/lib' \
--replace '$OPENSSL_INCDIR' '${openssl.dev}/include' --replace '$OPENSSL_INCDIR' '${openssl.dev}/include'
''; } '';
}
# oci8 (7.4, 7.3, 7.2) # oci8 (7.4, 7.3, 7.2)
# odbc (7.4, 7.3, 7.2) # odbc (7.4, 7.3, 7.2)
{ name = "opcache"; {
buildInputs = [ pcre2 ] ++ lib.optionals (lib.versionAtLeast php.version "8.0" && !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind) [ name = "opcache";
buildInputs = [ pcre2 ] ++ lib.optionals (!stdenv.isDarwin && lib.versionAtLeast php.version "8.0") [
valgrind.dev valgrind.dev
]; ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [ patches = lib.optionals (lib.versionOlder php.version "7.4") [
@ -382,49 +453,66 @@ lib.makeScope pkgs.newScope (self: with self; {
#include "zend_file_cache.h" #include "zend_file_cache.h"
#include "zend_shared_alloc.h" #include "zend_shared_alloc.h"
#include "zend_accelerator_util_funcs.h" #include "zend_accelerator_util_funcs.h"
'') ]; '')
];
zendExtension = true; zendExtension = true;
doCheck = !(lib.versionOlder php.version "7.4"); doCheck = !(lib.versionOlder php.version "7.4");
# Tests launch the builtin webserver. # Tests launch the builtin webserver.
__darwinAllowLocalNetworking = true; } __darwinAllowLocalNetworking = true;
{ name = "openssl"; }
{
name = "openssl";
buildInputs = [ openssl ]; buildInputs = [ openssl ];
configureFlags = [ "--with-openssl" ]; configureFlags = [ "--with-openssl" ];
doCheck = false; } doCheck = false;
}
{ name = "pcntl"; } { name = "pcntl"; }
{ name = "pdo"; doCheck = false; } { name = "pdo"; doCheck = false; }
{ name = "pdo_dblib"; {
name = "pdo_dblib";
internalDeps = [ php.extensions.pdo ]; internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-dblib=${freetds}" ]; configureFlags = [ "--with-pdo-dblib=${freetds}" ];
# Doesn't seem to work on darwin. # Doesn't seem to work on darwin.
enable = (!stdenv.isDarwin); enable = (!stdenv.isDarwin);
doCheck = false; } doCheck = false;
}
# pdo_firebird (7.4, 7.3, 7.2) # pdo_firebird (7.4, 7.3, 7.2)
{ name = "pdo_mysql"; {
name = "pdo_mysql";
internalDeps = with php.extensions; [ pdo mysqlnd ]; internalDeps = with php.extensions; [ pdo mysqlnd ];
configureFlags = [ "--with-pdo-mysql=mysqlnd" "PHP_MYSQL_SOCK=/run/mysqld/mysqld.sock" ]; configureFlags = [ "--with-pdo-mysql=mysqlnd" "PHP_MYSQL_SOCK=/run/mysqld/mysqld.sock" ];
doCheck = false; } doCheck = false;
}
# pdo_oci (7.4, 7.3, 7.2) # pdo_oci (7.4, 7.3, 7.2)
{ name = "pdo_odbc"; {
name = "pdo_odbc";
internalDeps = [ php.extensions.pdo ]; internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ]; configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ];
doCheck = false; } doCheck = false;
{ name = "pdo_pgsql"; }
{
name = "pdo_pgsql";
internalDeps = [ php.extensions.pdo ]; internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-pgsql=${postgresql}" ]; configureFlags = [ "--with-pdo-pgsql=${postgresql}" ];
doCheck = false; } doCheck = false;
{ name = "pdo_sqlite"; }
{
name = "pdo_sqlite";
internalDeps = [ php.extensions.pdo ]; internalDeps = [ php.extensions.pdo ];
buildInputs = [ sqlite ]; buildInputs = [ sqlite ];
configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ]; configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ];
doCheck = false; } doCheck = false;
{ name = "pgsql"; }
{
name = "pgsql";
buildInputs = [ pcre2 ]; buildInputs = [ pcre2 ];
configureFlags = [ "--with-pgsql=${postgresql}" ]; configureFlags = [ "--with-pgsql=${postgresql}" ];
doCheck = false; } doCheck = false;
}
{ name = "posix"; doCheck = false; } { name = "posix"; doCheck = false; }
{ name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; } { name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; }
{ name = "readline"; {
name = "readline";
buildInputs = [ libedit readline ]; buildInputs = [ libedit readline ];
configureFlags = [ "--with-readline=${readline.dev}" ]; configureFlags = [ "--with-readline=${readline.dev}" ];
postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") '' postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") ''
@ -434,23 +522,29 @@ lib.makeScope pkgs.newScope (self: with self; {
} }
{ name = "session"; doCheck = !(lib.versionAtLeast php.version "8.0"); } { name = "session"; doCheck = !(lib.versionAtLeast php.version "8.0"); }
{ name = "shmop"; } { name = "shmop"; }
{ name = "simplexml"; {
name = "simplexml";
buildInputs = [ libxml2 pcre2 ]; buildInputs = [ libxml2 pcre2 ];
configureFlags = [ "--enable-simplexml" ] configureFlags = [ "--enable-simplexml" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
{ name = "snmp"; }
{
name = "snmp";
buildInputs = [ net-snmp openssl ]; buildInputs = [ net-snmp openssl ];
configureFlags = [ "--with-snmp" ]; configureFlags = [ "--with-snmp" ];
# net-snmp doesn't build on darwin. # net-snmp doesn't build on darwin.
enable = (!stdenv.isDarwin); enable = (!stdenv.isDarwin);
doCheck = false; } doCheck = false;
{ name = "soap"; }
{
name = "soap";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2 ];
configureFlags = [ "--enable-soap" ] configureFlags = [ "--enable-soap" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
doCheck = false; } doCheck = false;
}
{ name = "sockets"; doCheck = false; } { name = "sockets"; doCheck = false; }
{ name = "sodium"; buildInputs = [ libsodium ]; } { name = "sodium"; buildInputs = [ libsodium ]; }
{ name = "sqlite3"; buildInputs = [ sqlite ]; } { name = "sqlite3"; buildInputs = [ sqlite ]; }
@ -459,56 +553,72 @@ lib.makeScope pkgs.newScope (self: with self; {
{ name = "sysvshm"; } { name = "sysvshm"; }
{ name = "tidy"; configureFlags = [ "--with-tidy=${html-tidy}" ]; doCheck = false; } { name = "tidy"; configureFlags = [ "--with-tidy=${html-tidy}" ]; doCheck = false; }
{ name = "tokenizer"; } { name = "tokenizer"; }
{ name = "wddx"; {
name = "wddx";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2 ];
internalDeps = [ php.extensions.session ]; internalDeps = [ php.extensions.session ];
configureFlags = [ "--enable-wddx" "--with-libxml-dir=${libxml2.dev}" ]; configureFlags = [ "--enable-wddx" "--with-libxml-dir=${libxml2.dev}" ];
# Removed in php 7.4. # Removed in php 7.4.
enable = lib.versionOlder php.version "7.4"; } enable = lib.versionOlder php.version "7.4";
{ name = "xml"; }
{
name = "xml";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2 ];
configureFlags = [ "--enable-xml" ] configureFlags = [ "--enable-xml" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
doCheck = false; } doCheck = false;
{ name = "xmlreader"; }
{
name = "xmlreader";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2 ];
internalDeps = [ php.extensions.dom ]; internalDeps = [ php.extensions.dom ];
NIX_CFLAGS_COMPILE = [ "-I../.." "-DHAVE_DOM" ]; NIX_CFLAGS_COMPILE = [ "-I../.." "-DHAVE_DOM" ];
configureFlags = [ "--enable-xmlreader" ] configureFlags = [ "--enable-xmlreader" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
{ name = "xmlrpc"; }
{
name = "xmlrpc";
buildInputs = [ libxml2 libiconv ]; buildInputs = [ libxml2 libiconv ];
# xmlrpc was unbundled in 8.0 https://php.watch/versions/8.0/xmlrpc # xmlrpc was unbundled in 8.0 https://php.watch/versions/8.0/xmlrpc
enable = lib.versionOlder php.version "8.0"; enable = lib.versionOlder php.version "8.0";
configureFlags = [ "--with-xmlrpc" ] configureFlags = [ "--with-xmlrpc" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
{ name = "xmlwriter"; }
{
name = "xmlwriter";
buildInputs = [ libxml2 ]; buildInputs = [ libxml2 ];
configureFlags = [ "--enable-xmlwriter" ] configureFlags = [ "--enable-xmlwriter" ]
# Required to build on darwin. # Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
{ name = "xsl"; }
{
name = "xsl";
buildInputs = [ libxslt libxml2 ]; buildInputs = [ libxslt libxml2 ];
doCheck = lib.versionOlder php.version "8.0"; doCheck = lib.versionOlder php.version "8.0";
configureFlags = [ "--with-xsl=${libxslt.dev}" ]; } configureFlags = [ "--with-xsl=${libxslt.dev}" ];
}
{ name = "zend_test"; } { name = "zend_test"; }
{ name = "zip"; {
name = "zip";
buildInputs = [ libzip pcre2 ]; buildInputs = [ libzip pcre2 ];
configureFlags = [ "--with-zip" ] configureFlags = [ "--with-zip" ]
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ] ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]
++ lib.optionals (lib.versionOlder php.version "7.3") [ "--with-libzip" ]; ++ lib.optionals (lib.versionOlder php.version "7.3") [ "--with-libzip" ];
doCheck = false; } doCheck = false;
{ name = "zlib"; }
{
name = "zlib";
buildInputs = [ zlib ]; buildInputs = [ zlib ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [ patches = lib.optionals (lib.versionOlder php.version "7.4") [
# Derived from https://github.com/php/php-src/commit/f16b012116d6c015632741a3caada5b30ef8a699 # Derived from https://github.com/php/php-src/commit/f16b012116d6c015632741a3caada5b30ef8a699
../development/interpreters/php/zlib-darwin-tests.patch ../development/interpreters/php/zlib-darwin-tests.patch
]; ];
configureFlags = [ "--with-zlib" ] configureFlags = [ "--with-zlib" ]
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ];
}
]; ];
# Convert the list of attrs: # Convert the list of attrs:
@ -519,11 +629,15 @@ lib.makeScope pkgs.newScope (self: with self; {
# which we later use listToAttrs to make all attrs available by name. # which we later use listToAttrs to make all attrs available by name.
# #
# Also filter out extensions based on the enable property. # Also filter out extensions based on the enable property.
namedExtensions = builtins.map (drv: { namedExtensions = builtins.map
(drv: {
name = drv.name; name = drv.name;
value = mkExtension drv; value = mkExtension drv;
}) (builtins.filter (i: i.enable or true) extensionData); })
(builtins.filter (i: i.enable or true) extensionData);
# Produce the final attribute set of all extensions defined. # Produce the final attribute set of all extensions defined.
in builtins.listToAttrs namedExtensions); in
builtins.listToAttrs namedExtensions
);
}) })