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,21 +8,23 @@ import ../make-test-python.nix ({pkgs, lib, php, ...}: {
services.nginx = { services.nginx = {
enable = true; enable = true;
virtualHosts."phpfpm" = let virtualHosts."phpfpm" =
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();"; let
in { testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
root = "${testdir}/web"; in
locations."~ \\.php$".extraConfig = '' {
fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket}; root = "${testdir}/web";
fastcgi_index index.php; locations."~ \\.php$".extraConfig = ''
include ${pkgs.nginx}/conf/fastcgi_params; fastcgi_pass unix:${config.services.phpfpm.pools.foobar.socket};
include ${pkgs.nginx}/conf/fastcgi.conf; fastcgi_index index.php;
''; include ${pkgs.nginx}/conf/fastcgi_params;
locations."/" = { include ${pkgs.nginx}/conf/fastcgi.conf;
tryFiles = "$uri $uri/ index.php"; '';
index = "index.php index.html index.htm"; locations."/" = {
tryFiles = "$uri $uri/ index.php";
index = "index.php index.html index.htm";
};
}; };
};
}; };
services.phpfpm.pools."foobar" = { services.phpfpm.pools."foobar" = {

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,14 +6,16 @@ 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" =
testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();"; let
in { testdir = pkgs.writeTextDir "web/index.php" "<?php phpinfo();";
documentRoot = "${testdir}/web"; in
locations."/" = { {
index = "index.php index.html"; documentRoot = "${testdir}/web";
locations."/" = {
index = "index.php index.html";
};
}; };
};
phpPackage = php; phpPackage = php;
enablePHP = true; enablePHP = true;
}; };

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,14 +13,15 @@ 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 =
testRoot = pkgs.writeText "index.php" let
'' testRoot = pkgs.writeText "index.php"
<?php ''
preg_match('/(${testString})/', '${testString}', $result); <?php
var_dump($result); preg_match('/(${testString})/', '${testString}', $result);
''; var_dump($result);
in '';
in
'' ''
Alias / ${testRoot}/ Alias / ${testRoot}/

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,17 +3,36 @@
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
, cliSupport ? true , cliSupport ? true
, fpmSupport ? true , fpmSupport ? true
@ -21,7 +40,7 @@ let
, pharSupport ? true , pharSupport ? true
, phpdbgSupport ? true , phpdbgSupport ? true
# Misc flags # Misc flags
, apxs2Support ? !stdenv.isDarwin , apxs2Support ? !stdenv.isDarwin
, argon2Support ? true , argon2Support ? true
, cgotoSupport ? false , cgotoSupport ? false
@ -43,101 +62,103 @@ let
# expected. # expected.
mkBuildEnv = prevArgs: prevExtensionFunctions: lib.makeOverridable ( mkBuildEnv = prevArgs: prevExtensionFunctions: lib.makeOverridable (
{ extensions ? ({ enabled, ... }: enabled), extraConfig ? "", ... }@innerArgs: { extensions ? ({ enabled, ... }: enabled), extraConfig ? "", ... }@innerArgs:
let let
allArgs = args // prevArgs // innerArgs; allArgs = args // prevArgs // innerArgs;
filteredArgs = builtins.removeAttrs allArgs [ "extensions" "extraConfig" ]; filteredArgs = builtins.removeAttrs allArgs [ "extensions" "extraConfig" ];
php = generic filteredArgs; php = generic filteredArgs;
php-packages = (callPackage ../../../top-level/php-packages.nix { php-packages = (callPackage ../../../top-level/php-packages.nix {
phpPackage = phpWithExtensions; phpPackage = phpWithExtensions;
}).overrideScope' packageOverrides; }).overrideScope' packageOverrides;
allExtensionFunctions = prevExtensionFunctions ++ [ extensions ]; allExtensionFunctions = prevExtensionFunctions ++ [ extensions ];
enabledExtensions = enabledExtensions =
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;
# Recursively get a list of all internal dependencies # Recursively get a list of all internal dependencies
# for a list of extensions. # for a list of extensions.
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;
# Generate extension load configuration snippets from the # Generate extension load configuration snippets from the
# extension parameter. This is an attrset suitable for use # extension parameter. This is an attrset suitable for use
# with textClosureList, which is used to put the strings in # with textClosureList, which is used to put the strings in
# the right order - if a plugin which is dependent on # the right order - if a plugin which is dependent on
# another plugin is placed before its dependency, it will # another plugin is placed before its dependency, it will
# 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 {
text = "${type}=${ext}/lib/php/extensions/${extName}.so"; text = "${type}=${ext}/lib/php/extensions/${extName}.so";
deps = map getExtName phpDeps; deps = map getExtName phpDeps;
}) })
(enabledExtensions ++ (getDepsRecursively enabledExtensions))); (enabledExtensions ++ (getDepsRecursively enabledExtensions)));
extNames = map getExtName enabledExtensions; extNames = map getExtName enabledExtensions;
extraInit = writeText "php-extra-init-${version}.ini" '' extraInit = writeText "php-extra-init-${version}.ini" ''
${lib.concatStringsSep "\n" ${lib.concatStringsSep "\n"
(lib.textClosureList extensionTexts extNames)} (lib.textClosureList extensionTexts extNames)}
${extraConfig} ${extraConfig}
''; '';
phpWithExtensions = symlinkJoin { phpWithExtensions = symlinkJoin {
name = "php-with-extensions-${version}"; name = "php-with-extensions-${version}";
inherit (php) version; inherit (php) version;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
passthru = php.passthru // { passthru = php.passthru // {
buildEnv = mkBuildEnv allArgs allExtensionFunctions; buildEnv = mkBuildEnv allArgs allExtensionFunctions;
withExtensions = mkWithExtensions allArgs allExtensionFunctions; withExtensions = mkWithExtensions allArgs allExtensionFunctions;
phpIni = "${phpWithExtensions}/lib/php.ini"; phpIni = "${phpWithExtensions}/lib/php.ini";
unwrapped = php; unwrapped = php;
# Select the right php tests for the php version # Select the right php tests for the php version
tests = nixosTests."php${lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor php.version)}"; tests = nixosTests."php${lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor php.version)}";
inherit (php-packages) extensions buildPecl; inherit (php-packages) extensions buildPecl;
packages = php-packages.tools; packages = php-packages.tools;
meta = php.meta // { meta = php.meta // {
outputsToInstall = [ "out" ]; outputsToInstall = [ "out" ];
};
}; };
paths = [ php ];
postBuild = ''
ln -s ${extraInit} $out/lib/php.ini
if test -e $out/bin/php; then
wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/php-fpm; then
wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/phpdbg; then
wrapProgram $out/bin/phpdbg --set PHP_INI_SCAN_DIR $out/lib
fi
'';
}; };
in paths = [ php ];
phpWithExtensions); postBuild = ''
ln -s ${extraInit} $out/lib/php.ini
if test -e $out/bin/php; then
wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/php-fpm; then
wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib
fi
if test -e $out/bin/phpdbg; then
wrapProgram $out/bin/phpdbg --set PHP_INI_SCAN_DIR $out/lib
fi
'';
};
in
phpWithExtensions
);
mkWithExtensions = prevArgs: prevExtensionFunctions: extensions: mkWithExtensions = prevArgs: prevExtensionFunctions: extensions:
mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; }; mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; };
@ -182,13 +203,13 @@ let
# Enable sapis # Enable sapis
++ lib.optional (!cgiSupport) "--disable-cgi" ++ lib.optional (!cgiSupport) "--disable-cgi"
++ lib.optional (!cliSupport) "--disable-cli" ++ lib.optional (!cliSupport) "--disable-cli"
++ lib.optional fpmSupport "--enable-fpm" ++ lib.optional fpmSupport "--enable-fpm"
++ lib.optional pearSupport [ "--with-pear" "--enable-xml" "--with-libxml" ] ++ lib.optional pearSupport [ "--with-pear" "--enable-xml" "--with-libxml" ]
++ lib.optionals (pearSupport && (lib.versionOlder version "7.4")) [ ++ lib.optionals (pearSupport && (lib.versionOlder version "7.4")) [
"--enable-libxml" "--enable-libxml"
"--with-libxml-dir=${libxml2.dev}" "--with-libxml-dir=${libxml2.dev}"
] ]
++ lib.optional pharSupport "--enable-phar" ++ lib.optional pharSupport "--enable-phar"
++ lib.optional (!phpdbgSupport) "--disable-phpdbg" ++ lib.optional (!phpdbgSupport) "--disable-phpdbg"
@ -211,33 +232,33 @@ let
hardeningDisable = [ "bindnow" ]; hardeningDisable = [ "bindnow" ];
preConfigure = preConfigure =
# Don't record the configure flags since this causes unnecessary # Don't record the configure flags since this causes unnecessary
# runtime dependencies # runtime dependencies
'' ''
for i in main/build-defs.h.in scripts/php-config.in; do for i in main/build-defs.h.in scripts/php-config.in; do
substituteInPlace $i \ substituteInPlace $i \
--replace '@CONFIGURE_COMMAND@' '(omitted)' \ --replace '@CONFIGURE_COMMAND@' '(omitted)' \
--replace '@CONFIGURE_OPTIONS@' "" \ --replace '@CONFIGURE_OPTIONS@' "" \
--replace '@PHP_LDFLAGS@' "" --replace '@PHP_LDFLAGS@' ""
done done
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'
done done
'' + '' '' + ''
./buildconf --copy --force ./buildconf --copy --force
if test -f $src/genfiles; then if test -f $src/genfiles; then
./genfiles ./genfiles
fi fi
'' + lib.optionalString stdenv.isDarwin '' '' + lib.optionalString stdenv.isDarwin ''
substituteInPlace configure --replace "-lstdc++" "-lc++" substituteInPlace configure --replace "-lstdc++" "-lc++"
''; '';
postInstall = '' postInstall = ''
test -d $out/etc || mkdir $out/etc test -d $out/etc || mkdir $out/etc
@ -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,401 +169,475 @@ 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 } // (
# Function to build a single php extension based on the php version. let
# # Function to build a single php extension based on the php version.
# Name passed is the name of the extension and is automatically used #
# to add the configureFlag "--enable-${name}", which can be overriden. # Name passed is the name of the extension and is automatically used
# # to add the configureFlag "--enable-${name}", which can be overriden.
# Build inputs is used for extra deps that may be needed. And zendExtension #
# will mark the extension as a zend extension or not. # Build inputs is used for extra deps that may be needed. And zendExtension
mkExtension = { # will mark the extension as a zend extension or not.
name mkExtension =
, configureFlags ? [ "--enable-${name}" ] { name
, internalDeps ? [] , configureFlags ? [ "--enable-${name}" ]
, postPhpize ? "" , internalDeps ? [ ]
, buildInputs ? [] , postPhpize ? ""
, zendExtension ? false , buildInputs ? [ ]
, doCheck ? true , zendExtension ? false
, ... , doCheck ? true
}@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // { , ...
pname = "php-${name}"; }@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
extensionName = name; pname = "php-${name}";
extensionName = name;
inherit (php.unwrapped) version src; inherit (php.unwrapped) version src;
sourceRoot = "php-${php.version}/ext/${name}"; sourceRoot = "php-${php.version}/ext/${name}";
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ php.unwrapped autoconf pkg-config re2c ]; nativeBuildInputs = [ php.unwrapped autoconf pkg-config re2c ];
inherit configureFlags internalDeps buildInputs inherit configureFlags internalDeps buildInputs
zendExtension doCheck; zendExtension doCheck;
prePatch = "pushd ../.."; prePatch = "pushd ../..";
postPatch = "popd"; postPatch = "popd";
preConfigure = '' preConfigure = ''
nullglobRestore=$(shopt -p nullglob) nullglobRestore=$(shopt -p nullglob)
shopt -u nullglob # To make ?-globbing work shopt -u nullglob # To make ?-globbing work
# Some extensions have a config0.m4 or config9.m4 # Some extensions have a config0.m4 or config9.m4
if [ -f config?.m4 ]; then if [ -f config?.m4 ]; then
mv config?.m4 config.m4 mv config?.m4 config.m4
fi fi
$nullglobRestore $nullglobRestore
phpize phpize
${postPhpize} ${postPhpize}
${lib.concatMapStringsSep "\n" ${lib.concatMapStringsSep "\n"
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}") (dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
internalDeps} internalDeps}
''; '';
checkPhase = "runHook preCheck; NO_INTERACTON=yes make test; runHook postCheck"; checkPhase = "runHook preCheck; NO_INTERACTON=yes make test; runHook postCheck";
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
installPhase = '' installPhase = ''
mkdir -p $out/lib/php/extensions mkdir -p $out/lib/php/extensions
cp modules/${name}.so $out/lib/php/extensions/${name}.so cp modules/${name}.so $out/lib/php/extensions/${name}.so
mkdir -p $dev/include mkdir -p $dev/include
${rsync}/bin/rsync -r --filter="+ */" \ ${rsync}/bin/rsync -r --filter="+ */" \
--filter="+ *.h" \ --filter="+ *.h" \
--filter="- *" \ --filter="- *" \
--prune-empty-dirs \ --prune-empty-dirs \
. $dev/include/ . $dev/include/
''; '';
meta = { meta = {
description = "PHP upstream extension: ${name}"; description = "PHP upstream extension: ${name}";
inherit (php.meta) maintainers homepage license; inherit (php.meta) maintainers homepage license;
}; };
}); });
# This list contains build instructions for different modules that one may # This list contains build instructions for different modules that one may
# want to build. # want to build.
# #
# These will be passed as arguments to mkExtension above. # These will be passed as arguments to mkExtension above.
extensionData = [ extensionData = [
{ name = "bcmath"; } { name = "bcmath"; }
{ 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"; {
buildInputs = [ curl ]; name = "curl";
configureFlags = [ "--with-curl=${curl.dev}" ]; buildInputs = [ curl ];
doCheck = false; } configureFlags = [ "--with-curl=${curl.dev}" ];
{ name = "dba"; } doCheck = false;
{ name = "dom"; }
buildInputs = [ libxml2 ]; { name = "dba"; }
patches = [ {
# https://github.com/php/php-src/pull/7030 name = "dom";
(fetchpatch { buildInputs = [ libxml2 ];
url = "https://github.com/php/php-src/commit/4cc261aa6afca2190b1b74de39c3caa462ec6f0b.patch"; patches = [
sha256 = "11qsdiwj1zmpfc2pgh6nr0sn7qa1nyjg4jwf69cgwnd57qfjcy4k"; # https://github.com/php/php-src/pull/7030
excludes = [ "ext/dom/tests/bug43364.phpt" "ext/dom/tests/bug80268.phpt" ]; (fetchpatch {
}) url = "https://github.com/php/php-src/commit/4cc261aa6afca2190b1b74de39c3caa462ec6f0b.patch";
]; sha256 = "11qsdiwj1zmpfc2pgh6nr0sn7qa1nyjg4jwf69cgwnd57qfjcy4k";
# For some reason `patch` fails to remove these files correctly. excludes = [ "ext/dom/tests/bug43364.phpt" "ext/dom/tests/bug80268.phpt" ];
# Since `postPatch` is already used in `mkExtension`, we have to make it here. })
preCheck = '' ];
rm tests/bug43364.phpt # For some reason `patch` fails to remove these files correctly.
rm tests/bug80268.phpt # Since `postPatch` is already used in `mkExtension`, we have to make it here.
''; preCheck = ''
configureFlags = [ "--enable-dom" ] rm tests/bug43364.phpt
# Required to build on darwin. rm tests/bug80268.phpt
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } '';
{ name = "enchant"; configureFlags = [ "--enable-dom" ]
buildInputs = [ enchant1 ]; # Required to build on darwin.
configureFlags = [ "--with-enchant=${enchant1}" ]; ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
# enchant1 doesn't build on darwin. }
enable = (!stdenv.isDarwin); {
doCheck = false; } name = "enchant";
{ name = "exif"; doCheck = false; } buildInputs = [ enchant1 ];
{ name = "ffi"; buildInputs = [ libffi ]; enable = lib.versionAtLeast php.version "7.4"; } configureFlags = [ "--with-enchant=${enchant1}" ];
{ name = "fileinfo"; buildInputs = [ pcre2 ]; } # enchant1 doesn't build on darwin.
{ name = "filter"; buildInputs = [ pcre2 ]; } enable = (!stdenv.isDarwin);
{ name = "ftp"; buildInputs = [ openssl ]; } doCheck = false;
{ name = "gd"; }
buildInputs = [ zlib gd ]; { name = "exif"; doCheck = false; }
configureFlags = [ { name = "ffi"; buildInputs = [ libffi ]; enable = lib.versionAtLeast php.version "7.4"; }
"--enable-gd" { name = "fileinfo"; buildInputs = [ pcre2 ]; }
"--with-external-gd=${gd.dev}" { name = "filter"; buildInputs = [ pcre2 ]; }
"--enable-gd-jis-conv" { name = "ftp"; buildInputs = [ openssl ]; }
]; {
doCheck = false; name = "gd";
enable = lib.versionAtLeast php.version "7.4"; } buildInputs = [ zlib gd ];
{ name = "gd"; configureFlags = [
buildInputs = [ zlib gd libXpm ]; "--enable-gd"
configureFlags = [ "--with-external-gd=${gd.dev}"
"--with-gd=${gd.dev}" "--enable-gd-jis-conv"
"--with-freetype-dir=${freetype.dev}" ];
"--with-jpeg-dir=${libjpeg.dev}" doCheck = false;
"--with-png-dir=${libpng.dev}" enable = lib.versionAtLeast php.version "7.4";
"--with-webp-dir=${libwebp}" }
"--with-xpm-dir=${libXpm.dev}" {
"--with-zlib-dir=${zlib.dev}" name = "gd";
"--enable-gd-jis-conv" buildInputs = [ zlib gd libXpm ];
]; configureFlags = [
doCheck = false; "--with-gd=${gd.dev}"
enable = lib.versionOlder php.version "7.4"; } "--with-freetype-dir=${freetype.dev}"
{ name = "gettext"; "--with-jpeg-dir=${libjpeg.dev}"
buildInputs = [ gettext ]; "--with-png-dir=${libpng.dev}"
patches = lib.optionals (lib.versionOlder php.version "7.4") [ "--with-webp-dir=${libwebp}"
(fetchpatch { "--with-xpm-dir=${libXpm.dev}"
url = "https://github.com/php/php-src/commit/632b6e7aac207194adc3d0b41615bfb610757f41.patch"; "--with-zlib-dir=${zlib.dev}"
sha256 = "0xn3ivhc4p070vbk5yx0mzj2n7p04drz3f98i77amr51w0vzv046"; "--enable-gd-jis-conv"
}) ];
]; doCheck = false;
postPhpize = ''substituteInPlace configure --replace 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' ''; enable = lib.versionOlder php.version "7.4";
configureFlags = [ "--with-gettext=${gettext}" ]; } }
{ name = "gmp"; {
buildInputs = [ gmp ]; name = "gettext";
configureFlags = [ "--with-gmp=${gmp.dev}" ]; } buildInputs = [ gettext ];
{ name = "hash"; enable = lib.versionOlder php.version "7.4"; } patches = lib.optionals (lib.versionOlder php.version "7.4") [
{ name = "iconv"; (fetchpatch {
configureFlags = [ url = "https://github.com/php/php-src/commit/632b6e7aac207194adc3d0b41615bfb610757f41.patch";
"--with-iconv${lib.optionalString stdenv.isDarwin "=${libiconv}"}" sha256 = "0xn3ivhc4p070vbk5yx0mzj2n7p04drz3f98i77amr51w0vzv046";
]; })
patches = lib.optionals (lib.versionOlder php.version "8.0") [ ];
# Header path defaults to FHS location, preventing the configure script from detecting errno support. postPhpize = ''substituteInPlace configure --replace 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' '';
(fetchpatch { configureFlags = [ "--with-gettext=${gettext}" ];
url = "https://github.com/fossar/nix-phps/raw/263861a8c9bdafd7abe44db6db4ef0179643680c/pkgs/iconv-header-path.patch"; }
sha256 = "7GHnEUu+hcsQ4h3itDwk6p46ZKfib9JZ2XpWlXrdn6E="; {
}) name = "gmp";
]; buildInputs = [ gmp ];
doCheck = false; } configureFlags = [ "--with-gmp=${gmp.dev}" ];
{ name = "imap"; }
buildInputs = [ uwimap openssl pam pcre2 ]; { name = "hash"; enable = lib.versionOlder php.version "7.4"; }
configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" ]; {
# uwimap doesn't build on darwin. name = "iconv";
enable = (!stdenv.isDarwin); } configureFlags = [
{ name = "intl"; "--with-iconv${lib.optionalString stdenv.isDarwin "=${libiconv}"}"
buildInputs = [ icu64 ]; ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [ patches = lib.optionals (lib.versionOlder php.version "8.0") [
(fetchpatch { # Header path defaults to FHS location, preventing the configure script from detecting errno support.
url = "https://github.com/php/php-src/commit/93a9b56c90c334896e977721bfb3f38b1721cec6.patch"; (fetchpatch {
sha256 = "055l40lpyhb0rbjn6y23qkzdhvpp7inbnn6x13cpn4inmhjqfpg4"; url = "https://github.com/fossar/nix-phps/raw/263861a8c9bdafd7abe44db6db4ef0179643680c/pkgs/iconv-header-path.patch";
}) sha256 = "7GHnEUu+hcsQ4h3itDwk6p46ZKfib9JZ2XpWlXrdn6E=";
]; })
} ];
{ name = "json"; enable = lib.versionOlder php.version "8.0"; } doCheck = false;
{ name = "ldap"; }
buildInputs = [ openldap cyrus_sasl ]; {
configureFlags = [ name = "imap";
"--with-ldap" buildInputs = [ uwimap openssl pam pcre2 ];
"LDAP_DIR=${openldap.dev}" configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" ];
"LDAP_INCDIR=${openldap.dev}/include" # uwimap doesn't build on darwin.
"LDAP_LIBDIR=${openldap.out}/lib" enable = (!stdenv.isDarwin);
] ++ lib.optionals stdenv.isLinux [ }
"--with-ldap-sasl=${cyrus_sasl.dev}" {
]; name = "intl";
doCheck = false; } buildInputs = [ icu64 ];
{ name = "mbstring"; buildInputs = [ oniguruma ] ++ lib.optionals (lib.versionAtLeast php.version "8.0") [ patches = lib.optionals (lib.versionOlder php.version "7.4") [
pcre2 (fetchpatch {
]; doCheck = false; } url = "https://github.com/php/php-src/commit/93a9b56c90c334896e977721bfb3f38b1721cec6.patch";
{ name = "mysqli"; sha256 = "055l40lpyhb0rbjn6y23qkzdhvpp7inbnn6x13cpn4inmhjqfpg4";
internalDeps = [ php.extensions.mysqlnd ]; })
configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ]; ];
doCheck = false; } }
{ name = "mysqlnd"; { name = "json"; enable = lib.versionOlder php.version "8.0"; }
buildInputs = [ zlib openssl ]; {
# The configure script doesn't correctly add library link name = "ldap";
# flags, so we add them to the variable used by the Makefile buildInputs = [ openldap cyrus_sasl ];
# when linking. configureFlags = [
MYSQLND_SHARED_LIBADD = "-lssl -lcrypto"; "--with-ldap"
# The configure script builds a config.h which is never "LDAP_DIR=${openldap.dev}"
# included. Let's include it in the main header file "LDAP_INCDIR=${openldap.dev}/include"
# included by all .c-files. "LDAP_LIBDIR=${openldap.out}/lib"
patches = [ ] ++ lib.optionals stdenv.isLinux [
(pkgs.writeText "mysqlnd_config.patch" '' "--with-ldap-sasl=${cyrus_sasl.dev}"
--- a/ext/mysqlnd/mysqlnd.h ];
+++ b/ext/mysqlnd/mysqlnd.h doCheck = false;
@@ -1,3 +1,6 @@ }
+#ifdef HAVE_CONFIG_H {
+#include "config.h" name = "mbstring";
+#endif buildInputs = [ oniguruma ] ++ lib.optionals (lib.versionAtLeast php.version "8.0") [
/* pcre2
+----------------------------------------------------------------------+ ];
| Copyright (c) The PHP Group | doCheck = false;
'') }
] ++ lib.optionals (lib.versionOlder php.version "7.4.8") [ {
(pkgs.writeText "mysqlnd_fix_compression.patch" '' name = "mysqli";
--- a/ext/mysqlnd/mysqlnd.h internalDeps = [ php.extensions.mysqlnd ];
+++ b/ext/mysqlnd/mysqlnd.h configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ];
@@ -48,7 +48,7 @@ doCheck = false;
#define MYSQLND_DBG_ENABLED 0 }
#endif {
name = "mysqlnd";
buildInputs = [ zlib openssl ];
# The configure script doesn't correctly add library link
# flags, so we add them to the variable used by the Makefile
# when linking.
MYSQLND_SHARED_LIBADD = "-lssl -lcrypto";
# The configure script builds a config.h which is never
# included. Let's include it in the main header file
# included by all .c-files.
patches = [
(pkgs.writeText "mysqlnd_config.patch" ''
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -1,3 +1,6 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
'')
] ++ lib.optionals (lib.versionOlder php.version "7.4.8") [
(pkgs.writeText "mysqlnd_fix_compression.patch" ''
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -48,7 +48,7 @@
#define MYSQLND_DBG_ENABLED 0
#endif
-#if defined(MYSQLND_COMPRESSION_WANTED) && defined(HAVE_ZLIB) -#if defined(MYSQLND_COMPRESSION_WANTED) && defined(HAVE_ZLIB)
+#if defined(MYSQLND_COMPRESSION_WANTED) +#if defined(MYSQLND_COMPRESSION_WANTED)
#define MYSQLND_COMPRESSION_ENABLED 1 #define MYSQLND_COMPRESSION_ENABLED 1
#endif #endif
'') '')
]; ];
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) }
# odbc (7.4, 7.3, 7.2) # oci8 (7.4, 7.3, 7.2)
{ name = "opcache"; # odbc (7.4, 7.3, 7.2)
buildInputs = [ pcre2 ] ++ lib.optionals (lib.versionAtLeast php.version "8.0" && !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind) [ {
valgrind.dev name = "opcache";
]; buildInputs = [ pcre2 ] ++ lib.optionals (!stdenv.isDarwin && lib.versionAtLeast php.version "8.0") [
patches = lib.optionals (lib.versionOlder php.version "7.4") [ valgrind.dev
(pkgs.writeText "zend_file_cache_config.patch" '' ];
--- a/ext/opcache/zend_file_cache.c patches = lib.optionals (lib.versionOlder php.version "7.4") [
+++ b/ext/opcache/zend_file_cache.c (pkgs.writeText "zend_file_cache_config.patch" ''
@@ -27,9 +27,9 @@ --- a/ext/opcache/zend_file_cache.c
#include "ext/standard/md5.h" +++ b/ext/opcache/zend_file_cache.c
#endif @@ -27,9 +27,9 @@
#include "ext/standard/md5.h"
#endif
+#include "ZendAccelerator.h" +#include "ZendAccelerator.h"
#ifdef HAVE_OPCACHE_FILE_CACHE #ifdef HAVE_OPCACHE_FILE_CACHE
-#include "ZendAccelerator.h" -#include "ZendAccelerator.h"
#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; ];
doCheck = !(lib.versionOlder php.version "7.4"); zendExtension = true;
# Tests launch the builtin webserver. doCheck = !(lib.versionOlder php.version "7.4");
__darwinAllowLocalNetworking = true; } # Tests launch the builtin webserver.
{ name = "openssl"; __darwinAllowLocalNetworking = true;
buildInputs = [ openssl ]; }
configureFlags = [ "--with-openssl" ]; {
doCheck = false; } name = "openssl";
{ name = "pcntl"; } buildInputs = [ openssl ];
{ name = "pdo"; doCheck = false; } configureFlags = [ "--with-openssl" ];
{ name = "pdo_dblib"; doCheck = false;
internalDeps = [ php.extensions.pdo ]; }
configureFlags = [ "--with-pdo-dblib=${freetds}" ]; { name = "pcntl"; }
# Doesn't seem to work on darwin. { name = "pdo"; doCheck = false; }
enable = (!stdenv.isDarwin); {
doCheck = false; } name = "pdo_dblib";
# pdo_firebird (7.4, 7.3, 7.2) internalDeps = [ php.extensions.pdo ];
{ name = "pdo_mysql"; configureFlags = [ "--with-pdo-dblib=${freetds}" ];
internalDeps = with php.extensions; [ pdo mysqlnd ]; # Doesn't seem to work on darwin.
configureFlags = [ "--with-pdo-mysql=mysqlnd" "PHP_MYSQL_SOCK=/run/mysqld/mysqld.sock" ]; enable = (!stdenv.isDarwin);
doCheck = false; } doCheck = false;
# pdo_oci (7.4, 7.3, 7.2) }
{ name = "pdo_odbc"; # pdo_firebird (7.4, 7.3, 7.2)
internalDeps = [ php.extensions.pdo ]; {
configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ]; name = "pdo_mysql";
doCheck = false; } internalDeps = with php.extensions; [ pdo mysqlnd ];
{ name = "pdo_pgsql"; configureFlags = [ "--with-pdo-mysql=mysqlnd" "PHP_MYSQL_SOCK=/run/mysqld/mysqld.sock" ];
internalDeps = [ php.extensions.pdo ]; doCheck = false;
configureFlags = [ "--with-pdo-pgsql=${postgresql}" ]; }
doCheck = false; } # pdo_oci (7.4, 7.3, 7.2)
{ name = "pdo_sqlite"; {
internalDeps = [ php.extensions.pdo ]; name = "pdo_odbc";
buildInputs = [ sqlite ]; internalDeps = [ php.extensions.pdo ];
configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ]; configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ];
doCheck = false; } doCheck = false;
{ name = "pgsql"; }
buildInputs = [ pcre2 ]; {
configureFlags = [ "--with-pgsql=${postgresql}" ]; name = "pdo_pgsql";
doCheck = false; } internalDeps = [ php.extensions.pdo ];
{ name = "posix"; doCheck = false; } configureFlags = [ "--with-pdo-pgsql=${postgresql}" ];
{ name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; } doCheck = false;
{ name = "readline"; }
buildInputs = [ libedit readline ]; {
configureFlags = [ "--with-readline=${readline.dev}" ]; name = "pdo_sqlite";
postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") '' internalDeps = [ php.extensions.pdo ];
substituteInPlace configure --replace 'as_fn_error $? "Please reinstall libedit - I cannot find readline.h" "$LINENO" 5' ':' buildInputs = [ sqlite ];
''; configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ];
doCheck = false; doCheck = false;
} }
{ name = "session"; doCheck = !(lib.versionAtLeast php.version "8.0"); } {
{ name = "shmop"; } name = "pgsql";
{ name = "simplexml"; buildInputs = [ pcre2 ];
buildInputs = [ libxml2 pcre2 ]; configureFlags = [ "--with-pgsql=${postgresql}" ];
configureFlags = [ "--enable-simplexml" ] doCheck = false;
# Required to build on darwin. }
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "posix"; doCheck = false; }
{ name = "snmp"; { name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; }
buildInputs = [ net-snmp openssl ]; {
configureFlags = [ "--with-snmp" ]; name = "readline";
# net-snmp doesn't build on darwin. buildInputs = [ libedit readline ];
enable = (!stdenv.isDarwin); configureFlags = [ "--with-readline=${readline.dev}" ];
doCheck = false; } postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") ''
{ name = "soap"; substituteInPlace configure --replace 'as_fn_error $? "Please reinstall libedit - I cannot find readline.h" "$LINENO" 5' ':'
buildInputs = [ libxml2 ]; '';
configureFlags = [ "--enable-soap" ] doCheck = false;
# Required to build on darwin. }
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; { name = "session"; doCheck = !(lib.versionAtLeast php.version "8.0"); }
doCheck = false; } { name = "shmop"; }
{ name = "sockets"; doCheck = false; } {
{ name = "sodium"; buildInputs = [ libsodium ]; } name = "simplexml";
{ name = "sqlite3"; buildInputs = [ sqlite ]; } buildInputs = [ libxml2 pcre2 ];
{ name = "sysvmsg"; } configureFlags = [ "--enable-simplexml" ]
{ name = "sysvsem"; } # Required to build on darwin.
{ name = "sysvshm"; } ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
{ name = "tidy"; configureFlags = [ "--with-tidy=${html-tidy}" ]; doCheck = false; } }
{ name = "tokenizer"; } {
{ name = "wddx"; name = "snmp";
buildInputs = [ libxml2 ]; buildInputs = [ net-snmp openssl ];
internalDeps = [ php.extensions.session ]; configureFlags = [ "--with-snmp" ];
configureFlags = [ "--enable-wddx" "--with-libxml-dir=${libxml2.dev}" ]; # net-snmp doesn't build on darwin.
# Removed in php 7.4. enable = (!stdenv.isDarwin);
enable = lib.versionOlder php.version "7.4"; } doCheck = false;
{ name = "xml"; }
buildInputs = [ libxml2 ]; {
configureFlags = [ "--enable-xml" ] name = "soap";
# Required to build on darwin. buildInputs = [ libxml2 ];
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; configureFlags = [ "--enable-soap" ]
doCheck = false; } # Required to build on darwin.
{ name = "xmlreader"; ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
buildInputs = [ libxml2 ]; doCheck = false;
internalDeps = [ php.extensions.dom ]; }
NIX_CFLAGS_COMPILE = [ "-I../.." "-DHAVE_DOM" ]; { name = "sockets"; doCheck = false; }
configureFlags = [ "--enable-xmlreader" ] { name = "sodium"; buildInputs = [ libsodium ]; }
# Required to build on darwin. { name = "sqlite3"; buildInputs = [ sqlite ]; }
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } { name = "sysvmsg"; }
{ name = "xmlrpc"; { name = "sysvsem"; }
buildInputs = [ libxml2 libiconv ]; { name = "sysvshm"; }
# xmlrpc was unbundled in 8.0 https://php.watch/versions/8.0/xmlrpc { name = "tidy"; configureFlags = [ "--with-tidy=${html-tidy}" ]; doCheck = false; }
enable = lib.versionOlder php.version "8.0"; { name = "tokenizer"; }
configureFlags = [ "--with-xmlrpc" ] {
# Required to build on darwin. name = "wddx";
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } buildInputs = [ libxml2 ];
{ name = "xmlwriter"; internalDeps = [ php.extensions.session ];
buildInputs = [ libxml2 ]; configureFlags = [ "--enable-wddx" "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [ "--enable-xmlwriter" ] # Removed in php 7.4.
# Required to build on darwin. enable = lib.versionOlder php.version "7.4";
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ]; } }
{ name = "xsl"; {
buildInputs = [ libxslt libxml2 ]; name = "xml";
doCheck = lib.versionOlder php.version "8.0"; buildInputs = [ libxml2 ];
configureFlags = [ "--with-xsl=${libxslt.dev}" ]; } configureFlags = [ "--enable-xml" ]
{ name = "zend_test"; } # Required to build on darwin.
{ name = "zip"; ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
buildInputs = [ libzip pcre2 ]; doCheck = false;
configureFlags = [ "--with-zip" ] }
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ] {
++ lib.optionals (lib.versionOlder php.version "7.3") [ "--with-libzip" ]; name = "xmlreader";
doCheck = false; } buildInputs = [ libxml2 ];
{ name = "zlib"; internalDeps = [ php.extensions.dom ];
buildInputs = [ zlib ]; NIX_CFLAGS_COMPILE = [ "-I../.." "-DHAVE_DOM" ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [ configureFlags = [ "--enable-xmlreader" ]
# Derived from https://github.com/php/php-src/commit/f16b012116d6c015632741a3caada5b30ef8a699 # Required to build on darwin.
../development/interpreters/php/zlib-darwin-tests.patch ++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
]; }
configureFlags = [ "--with-zlib" ] {
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]; } name = "xmlrpc";
]; buildInputs = [ libxml2 libiconv ];
# xmlrpc was unbundled in 8.0 https://php.watch/versions/8.0/xmlrpc
enable = lib.versionOlder php.version "8.0";
configureFlags = [ "--with-xmlrpc" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
}
{
name = "xmlwriter";
buildInputs = [ libxml2 ];
configureFlags = [ "--enable-xmlwriter" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
}
{
name = "xsl";
buildInputs = [ libxslt libxml2 ];
doCheck = lib.versionOlder php.version "8.0";
configureFlags = [ "--with-xsl=${libxslt.dev}" ];
}
{ name = "zend_test"; }
{
name = "zip";
buildInputs = [ libzip pcre2 ];
configureFlags = [ "--with-zip" ]
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]
++ lib.optionals (lib.versionOlder php.version "7.3") [ "--with-libzip" ];
doCheck = false;
}
{
name = "zlib";
buildInputs = [ zlib ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [
# Derived from https://github.com/php/php-src/commit/f16b012116d6c015632741a3caada5b30ef8a699
../development/interpreters/php/zlib-darwin-tests.patch
];
configureFlags = [ "--with-zlib" ]
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ];
}
];
# Convert the list of attrs: # Convert the list of attrs:
# [ { name = <name>; ... } ... ] # [ { name = <name>; ... } ... ]
# to a list of # to a list of
# [ { name = <name>; value = <extension drv>; } ... ] # [ { name = <name>; value = <extension drv>; } ... ]
# #
# 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
name = drv.name; (drv: {
value = mkExtension drv; name = drv.name;
}) (builtins.filter (i: i.enable or true) extensionData); value = mkExtension drv;
})
(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
);
}) })