Merge pull request #86614 from talyz/php-buildpecl-pecldeps

php.buildPecl: Make it possible for PECLs to depend on other PECLs, fix apcu_bc and couchbase
This commit is contained in:
Kim Lindberger 2020-05-10 12:37:22 +02:00 committed by GitHub
commit e4efa8bc83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 15 deletions

View File

@ -3,6 +3,7 @@
{ pname { pname
, version , version
, internalDeps ? [] , internalDeps ? []
, peclDeps ? []
, buildInputs ? [] , buildInputs ? []
, nativeBuildInputs ? [] , nativeBuildInputs ? []
, postPhpize ? "" , postPhpize ? ""
@ -16,11 +17,12 @@
stdenv.mkDerivation (args // { stdenv.mkDerivation (args // {
name = "php-${pname}-${version}"; name = "php-${pname}-${version}";
extensionName = pname;
inherit src; inherit src;
nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs; nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs;
buildInputs = [ php ] ++ buildInputs; buildInputs = [ php ] ++ peclDeps ++ buildInputs;
makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags; makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;

View File

@ -67,7 +67,7 @@ let
getDepsRecursively = extensions: getDepsRecursively = extensions:
let let
deps = lib.concatMap deps = lib.concatMap
(ext: ext.internalDeps or []) (ext: (ext.internalDeps or []) ++ (ext.peclDeps or []))
extensions; extensions;
in in
if ! (deps == []) then if ! (deps == []) then
@ -86,12 +86,12 @@ let
(map (ext: (map (ext:
let let
extName = getExtName ext; extName = getExtName ext;
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 = lib.optionals (ext ? internalDeps) deps = map getExtName phpDeps;
(map getExtName ext.internalDeps);
}) })
(enabledExtensions ++ (getDepsRecursively enabledExtensions))); (enabledExtensions ++ (getDepsRecursively enabledExtensions)));
@ -112,7 +112,7 @@ let
phpIni = "${phpWithExtensions}/lib/php.ini"; phpIni = "${phpWithExtensions}/lib/php.ini";
unwrapped = php; unwrapped = php;
tests = nixosTests.php; tests = nixosTests.php;
inherit (php-packages) packages extensions; inherit (php-packages) packages extensions buildPecl;
meta = php.meta // { meta = php.meta // {
outputsToInstall = [ "out" ]; outputsToInstall = [ "out" ];
}; };

View File

@ -320,11 +320,16 @@ in
sha256 = "0ma00syhk2ps9k9p02jz7rii6x3i2p986il23703zz5npd6y9n20"; sha256 = "0ma00syhk2ps9k9p02jz7rii6x3i2p986il23703zz5npd6y9n20";
peclDeps = [ php.extensions.apcu ];
buildInputs = [ buildInputs = [
php.extensions.apcu
pcre' pcre'
]; ];
postInstall = ''
mv $out/lib/php/extensions/apc.so $out/lib/php/extensions/apcu_bc.so
'';
meta.maintainers = lib.teams.php.members; meta.maintainers = lib.teams.php.members;
}; };
@ -341,13 +346,6 @@ in
version = "2.6.1"; version = "2.6.1";
pname = "couchbase"; pname = "couchbase";
buildInputs = [
pkgs.libcouchbase
pkgs.zlib
php.extensions.igbinary
php.extensions.pcs
];
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "couchbase"; owner = "couchbase";
repo = "php-couchbase"; repo = "php-couchbase";
@ -356,7 +354,14 @@ in
}; };
configureFlags = [ "--with-couchbase" ]; configureFlags = [ "--with-couchbase" ];
buildInputs = [
pkgs.libcouchbase
pkgs.zlib
];
internalDeps = [ php.extensions.json ]; internalDeps = [ php.extensions.json ];
peclDeps = [ php.extensions.igbinary ];
patches = [ patches = [
(pkgs.writeText "php-couchbase.patch" '' (pkgs.writeText "php-couchbase.patch" ''
--- a/config.m4 --- a/config.m4
@ -383,7 +388,6 @@ in
]; ];
meta.maintainers = lib.teams.php.members; meta.maintainers = lib.teams.php.members;
meta.broken = isPhp74; # Build error
}; };
event = buildPecl { event = buildPecl {
@ -557,8 +561,10 @@ in
sha256 = "0d4p1gpl8gkzdiv860qzxfz250ryf0wmjgyc8qcaaqgkdyh5jy5p"; sha256 = "0d4p1gpl8gkzdiv860qzxfz250ryf0wmjgyc8qcaaqgkdyh5jy5p";
internalDeps = [ php.extensions.tokenizer ];
meta.maintainers = lib.teams.php.members; meta.maintainers = lib.teams.php.members;
meta.broken = isPhp74; # Build error meta.broken = isPhp73; # Runtime failure on 7.3, build error on 7.4
}; };
pdo_oci = buildPecl rec { pdo_oci = buildPecl rec {