phpPackages: Move phpPackages to php.packages

This means php packages can now refer to other php packages by looking
them up in the php.packages attribute and gets rid of the internal
recursive set previously defined in php-packages.nix. This also means
that in applications where previously both the php package and the
corresponding version of the phpPackages package set had to be
specified, the php package will now suffice.

This also adds the phpWithExtensions parameter to the
php-packages.nix, which can be used by extensions that need a fully
featured PHP executable.
This commit is contained in:
talyz 2020-03-28 22:37:22 +01:00
parent 14bfb844d6
commit b1106a1851
No known key found for this signature in database
GPG Key ID: 2DED2151F4671A2B
3 changed files with 62 additions and 40 deletions

View File

@ -144,13 +144,17 @@ let
};
};
generic' = { version, sha256, ... }@args:
generic' = { version, sha256, self, selfWithExtensions, ... }@args:
let
php = generic args;
php = generic (builtins.removeAttrs args [ "self" "selfWithExtensions" ]);
packages = callPackage ../../../top-level/php-packages.nix {
php = self;
phpWithExtensions = selfWithExtensions;
};
buildEnv = { exts ? (_: []), extraConfig ? "" }:
let
getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
extList = exts (callPackage ../../../top-level/php-packages.nix { inherit php; });
extList = exts packages;
# Generate extension load configuration snippets from
# exts. This is an attrset suitable for use with
@ -182,7 +186,9 @@ let
name = "php-with-extensions-${version}";
inherit version;
nativeBuildInputs = [ makeWrapper ];
passthru.buildEnv = buildEnv;
passthru = {
inherit buildEnv packages;
};
paths = [ php ];
postBuild = ''
wrapProgram $out/bin/php \
@ -193,12 +199,16 @@ let
};
in
php.overrideAttrs (_: {
passthru.buildEnv = buildEnv;
passthru = {
inherit buildEnv packages;
};
});
php72base = generic' {
version = "7.2.28";
sha256 = "18sjvl67z5a2x5s2a36g6ls1r3m4hbrsw52hqr2qsgfvg5dkm5bw";
self = php72base;
selfWithExtensions = php72;
# https://bugs.php.net/bug.php?id=76826
extraPatches = lib.optional stdenv.isDarwin ./php72-darwin-isfinite.patch;
@ -207,6 +217,8 @@ let
php73base = generic' {
version = "7.3.15";
sha256 = "0g84hws15s8gh8iq4h6q747dyfazx47vh3da3whz8d80x83ibgld";
self = php73base;
selfWithExtensions = php73;
# https://bugs.php.net/bug.php?id=76826
extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
@ -215,6 +227,8 @@ let
php74base = generic' {
version = "7.4.3";
sha256 = "wVF7pJV4+y3MZMc6Ptx21PxQfEp6xjmYFYTMfTtMbRQ=";
self = php74base;
selfWithExtensions = php74;
};
defaultPhpExtensions = {
@ -226,10 +240,11 @@ let
tokenizer xmlreader xmlwriter zip zlib
] ++ lib.optionals (!stdenv.isDarwin) [ imap ]);
};
in {
inherit php72base php73base php74base;
php74 = php74base.buildEnv defaultPhpExtensions;
php73 = php73base.buildEnv defaultPhpExtensions;
php72 = php72base.buildEnv defaultPhpExtensions;
in {
inherit php72base php73base php74base php72 php73 php74;
}

View File

@ -9371,19 +9371,11 @@ in
pachyderm = callPackage ../applications/networking/cluster/pachyderm { };
php = php74;
phpPackages = php74Packages;
php72Packages = recurseIntoAttrs (callPackage ./php-packages.nix {
php = php72base;
});
php73Packages = recurseIntoAttrs (callPackage ./php-packages.nix {
php = php73base;
});
php74Packages = recurseIntoAttrs (callPackage ./php-packages.nix {
php = php74base;
});
php72Packages = recurseIntoAttrs php72.packages;
php73Packages = recurseIntoAttrs php73.packages;
php74Packages = recurseIntoAttrs php74.packages;
inherit (callPackages ../development/interpreters/php {
stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv;

View File

@ -1,25 +1,28 @@
{ stdenv, lib, pkgs, fetchgit, php, autoconf, pkgconfig, re2c, gettext
, bzip2, curl, libxml2, openssl, gmp, icu, oniguruma, libsodium, html-tidy
, libzip, zlib, pcre, pcre2, libxslt, aspell, openldap, cyrus_sasl, uwimap
, pam, libiconv, enchant1, libXpm, gd, libwebp, libjpeg, libpng, freetype
, libffi, freetds, postgresql, sqlite, net-snmp, unixODBC, libedit, readline
{ stdenv, lib, pkgs, fetchgit, php, phpWithExtensions, autoconf, pkgconfig, re2c
, gettext, bzip2, curl, libxml2, openssl, gmp, icu, oniguruma, libsodium
, html-tidy, libzip, zlib, pcre, pcre2, libxslt, aspell, openldap, cyrus_sasl
, uwimap, pam, libiconv, enchant1, libXpm, gd, libwebp, libjpeg, libpng
, freetype, libffi, freetds, postgresql, sqlite, net-snmp, unixODBC, libedit
, readline, rsync
}:
let
self = with self; {
buildPecl = import ../build-support/build-pecl.nix {
inherit php;
inherit (pkgs) stdenv autoreconfHook fetchurl re2c;
};
buildPecl = import ../build-support/build-pecl.nix {
inherit php lib;
inherit (pkgs) stdenv autoreconfHook fetchurl re2c;
};
# Wrap mkDerivation to prepend pname with "php-" to make names consistent
# with how buildPecl does it and make the file easier to overview.
mkDerivation = { pname, ... }@args: pkgs.stdenv.mkDerivation (args // {
pname = "php-${pname}";
});
# Wrap mkDerivation to prepend pname with "php-" to make names consistent
# with how buildPecl does it and make the file easier to overview.
mkDerivation = { pname, ... }@args: pkgs.stdenv.mkDerivation (args // {
pname = "php-${pname}";
});
isPhp73 = pkgs.lib.versionAtLeast php.version "7.3";
isPhp74 = pkgs.lib.versionAtLeast php.version "7.4";
in
{
inherit buildPecl;
apcu = buildPecl {
version = "5.1.18";
@ -41,7 +44,10 @@ let
sha256 = "0ma00syhk2ps9k9p02jz7rii6x3i2p986il23703zz5npd6y9n20";
buildInputs = [ apcu (if isPhp73 then pkgs.pcre2 else pkgs.pcre) ];
buildInputs = [
php.packages.apcu
(if isPhp73 then pkgs.pcre2 else pkgs.pcre)
];
};
ast = buildPecl {
@ -111,7 +117,12 @@ let
version = "2.6.1";
pname = "couchbase";
buildInputs = [ pkgs.libcouchbase pkgs.zlib igbinary pcs ];
buildInputs = [
pkgs.libcouchbase
pkgs.zlib
php.packages.igbinary
php.packages.pcs
];
src = pkgs.fetchFromGitHub {
owner = "couchbase";
@ -139,8 +150,8 @@ let
igbinary_inc_path="$phpincludedir"
elif test -f "$phpincludedir/ext/igbinary/igbinary.h"; then
igbinary_inc_path="$phpincludedir"
+ elif test -f "${igbinary.dev}/include/ext/igbinary/igbinary.h"; then
+ igbinary_inc_path="${igbinary.dev}/include"
+ elif test -f "${php.packages.igbinary.dev}/include/ext/igbinary/igbinary.h"; then
+ igbinary_inc_path="${php.packages.igbinary.dev}/include"
fi
if test "$igbinary_inc_path" = ""; then
AC_MSG_WARN([Cannot find igbinary.h])
@ -353,7 +364,11 @@ let
sha256 = "16nv8yyk2z3l213dg067l6di4pigg5rd8yswr5xgd18jwbys2vnw";
};
buildInputs = [ pkgs.makeWrapper composer box ];
buildInputs = [
pkgs.makeWrapper
php.packages.composer
php.packages.box
];
buildPhase = ''
composer dump-autoload
@ -1024,4 +1039,4 @@ let
# Produce the final attribute set of all extensions defined.
in builtins.listToAttrs namedExtensions;
}; in self
}