2022-12-29 13:07:39 +00:00
|
|
|
{ stdenv, lib, php, autoreconfHook, fetchurl, re2c, nix-update-script }:
|
2014-03-24 12:37:36 +00:00
|
|
|
|
2019-04-20 15:09:05 +01:00
|
|
|
{ pname
|
|
|
|
, version
|
2021-06-26 08:46:46 +01:00
|
|
|
, internalDeps ? [ ]
|
|
|
|
, peclDeps ? [ ]
|
|
|
|
, buildInputs ? [ ]
|
|
|
|
, nativeBuildInputs ? [ ]
|
2020-03-28 22:20:38 +00:00
|
|
|
, postPhpize ? ""
|
2021-06-26 08:46:46 +01:00
|
|
|
, makeFlags ? [ ]
|
2014-07-03 15:52:02 +01:00
|
|
|
, src ? fetchurl {
|
2022-10-27 10:41:05 +01:00
|
|
|
url = "https://pecl.php.net/get/${pname}-${version}.tgz";
|
2014-07-03 15:52:02 +01:00
|
|
|
inherit (args) sha256;
|
|
|
|
}
|
2022-12-29 13:07:39 +00:00
|
|
|
, passthru ? { }
|
2014-07-03 15:52:02 +01:00
|
|
|
, ...
|
|
|
|
}@args:
|
|
|
|
|
|
|
|
stdenv.mkDerivation (args // {
|
2021-03-04 14:26:36 +00:00
|
|
|
name = "php-${pname}-${version}";
|
2020-05-02 22:13:53 +01:00
|
|
|
extensionName = pname;
|
2014-07-03 15:19:57 +01:00
|
|
|
|
2021-03-04 14:26:36 +00:00
|
|
|
inherit src;
|
2014-07-03 15:52:02 +01:00
|
|
|
|
2019-06-06 20:16:58 +01:00
|
|
|
nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs;
|
2020-05-02 22:13:53 +01:00
|
|
|
buildInputs = [ php ] ++ peclDeps ++ buildInputs;
|
2014-03-24 12:37:36 +00:00
|
|
|
|
2014-07-03 15:52:02 +01:00
|
|
|
makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;
|
2014-03-24 12:37:36 +00:00
|
|
|
|
2020-03-28 22:20:38 +00:00
|
|
|
autoreconfPhase = ''
|
|
|
|
phpize
|
|
|
|
${postPhpize}
|
|
|
|
${lib.concatMapStringsSep "\n"
|
|
|
|
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
|
|
|
|
internalDeps}
|
|
|
|
'';
|
2021-05-27 17:13:16 +01:00
|
|
|
checkPhase = "NO_INTERACTON=yes make test";
|
2022-12-29 13:07:39 +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 {};
|
|
|
|
};
|
2014-03-24 12:37:36 +00:00
|
|
|
})
|