2023-01-11 07:51:40 +00:00
|
|
|
{ stdenv, lib, php, autoreconfHook, fetchurl, re2c, nix-update-script }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
{ pname
|
|
|
|
, version
|
2021-06-28 23:13:55 +00:00
|
|
|
, internalDeps ? [ ]
|
|
|
|
, peclDeps ? [ ]
|
|
|
|
, buildInputs ? [ ]
|
|
|
|
, nativeBuildInputs ? [ ]
|
2020-04-24 23:36:52 +00:00
|
|
|
, postPhpize ? ""
|
2021-06-28 23:13:55 +00:00
|
|
|
, makeFlags ? [ ]
|
2020-04-24 23:36:52 +00:00
|
|
|
, src ? fetchurl {
|
2022-11-21 17:40:18 +00:00
|
|
|
url = "https://pecl.php.net/get/${pname}-${version}.tgz";
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit (args) sha256;
|
|
|
|
}
|
2023-01-11 07:51:40 +00:00
|
|
|
, passthru ? { }
|
2020-04-24 23:36:52 +00:00
|
|
|
, ...
|
|
|
|
}@args:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
|
|
|
name = "php-${pname}-${version}";
|
2020-05-15 21:57:56 +00:00
|
|
|
extensionName = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs;
|
2020-05-15 21:57:56 +00:00
|
|
|
buildInputs = [ php ] ++ peclDeps ++ buildInputs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;
|
|
|
|
|
|
|
|
autoreconfPhase = ''
|
|
|
|
phpize
|
|
|
|
${postPhpize}
|
|
|
|
${lib.concatMapStringsSep "\n"
|
|
|
|
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
|
|
|
|
internalDeps}
|
|
|
|
'';
|
2021-06-04 09:07:49 +00:00
|
|
|
checkPhase = "NO_INTERACTON=yes make test";
|
2023-01-11 07:51:40 +00:00
|
|
|
|
|
|
|
passthru = passthru // {
|
|
|
|
# Thes flags were introduced for `nix-update` so that it can update
|
|
|
|
# PHP extensions correctly.
|
|
|
|
# See the corresponding PR: https://github.com/Mic92/nix-update/pull/123
|
|
|
|
isPhpExtension = true;
|
|
|
|
updateScript = nix-update-script {};
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|