php.packages: Use derivations for internalDeps in mkExtension

Make mkExtension put headers in the dev output and use them, instead of
a different part of the current source tree, when referring to another
extension by using internalDeps.

This means external extensions can be built against the internal ones.
This commit is contained in:
talyz 2020-03-28 23:03:35 +01:00
parent b1106a1851
commit 90dcab948c
No known key found for this signature in database
GPG Key ID: 2DED2151F4671A2B
2 changed files with 18 additions and 9 deletions

View File

@ -171,7 +171,8 @@ let
in
lib.nameValuePair extName {
text = "${type}=${ext}/lib/php/extensions/${extName}.so";
deps = lib.optionals (ext ? internalDeps) ext.internalDeps;
deps = lib.optionals (ext ? internalDeps)
(map getExtName ext.internalDeps);
})
extList);

View File

@ -733,6 +733,7 @@ in
, ...
}@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
pname = "php-${name}";
extensionName = name;
inherit (php) version src;
sourceRoot = "php-${php.version}/ext/${name}";
@ -755,13 +756,20 @@ in
phpize
${postPhpize}
${lib.concatMapStringsSep "\n"
(dep: "mkdir -p ext; ln -s ../../${dep} ext/")
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
internalDeps}
'';
checkPhase = "echo n | make test";
outputs = [ "out" "dev" ];
installPhase = ''
mkdir -p $out/lib/php/extensions
cp modules/${name}.so $out/lib/php/extensions/${name}.so
mkdir -p $dev/include
${rsync}/bin/rsync -r --filter="+ */" \
--filter="+ *.h" \
--filter="- *" \
--prune-empty-dirs \
. $dev/include/
'';
});
@ -853,7 +861,7 @@ in
doCheck = false; }
{ name = "mbstring"; buildInputs = [ oniguruma ]; doCheck = false; }
{ name = "mysqli";
internalDeps = [ "mysqlnd" ];
internalDeps = [ php.packages.exts.mysqlnd ];
configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ];
doCheck = false; }
{ name = "mysqlnd";
@ -914,27 +922,27 @@ in
{ name = "pcntl"; }
{ name = "pdo"; doCheck = false; }
{ name = "pdo_dblib";
internalDeps = [ "pdo" ];
internalDeps = [ php.packages.exts.pdo ];
configureFlags = [ "--with-pdo-dblib=${freetds}" ];
# Doesn't seem to work on darwin.
enable = (!stdenv.isDarwin);
doCheck = false; }
# pdo_firebird (7.4, 7.3, 7.2)
{ name = "pdo_mysql";
internalDeps = [ "mysqlnd" "pdo" ];
internalDeps = with php.packages.exts; [ pdo mysqlnd ];
configureFlags = [ "--with-pdo-mysql=mysqlnd" ];
doCheck = false; }
# pdo_oci (7.4, 7.3, 7.2)
{ name = "pdo_odbc";
internalDeps = [ "pdo" ];
internalDeps = [ php.packages.exts.pdo ];
configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ];
doCheck = false; }
{ name = "pdo_pgsql";
internalDeps = [ "pdo" ];
internalDeps = [ php.packages.exts.pdo ];
configureFlags = [ "--with-pdo-pgsql=${postgresql}" ];
doCheck = false; }
{ name = "pdo_sqlite";
internalDeps = [ "pdo" ];
internalDeps = [ php.packages.exts.pdo ];
buildInputs = [ sqlite ];
configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ];
doCheck = false; }
@ -982,7 +990,7 @@ in
{ name = "tokenizer"; }
{ name = "wddx";
buildInputs = [ libxml2 ];
internalDeps = [ "session" ];
internalDeps = [ php.extensions.session ];
configureFlags = [ "--enable-wddx" "--with-libxml-dir=${libxml2.dev}" ];
# Removed in php 7.4.
enable = lib.versionOlder php.version "7.4"; }