diff options
author | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-04-09 11:53:42 +0200 |
---|---|---|
committer | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-09-13 15:00:03 +0200 |
commit | b36ad2f51797d82ddd4479835c0edd71b3386865 (patch) | |
tree | 930c61b8b3a433d632c7e88ef2ac6bc67c8cfcf3 /pkgs/build-support/php/build-pecl.nix | |
parent | 27e3b694e7153ba8e5780fba6cf8f7ef447c1062 (diff) |
php: add new builder `buildComposerProject`
Diffstat (limited to 'pkgs/build-support/php/build-pecl.nix')
-rw-r--r-- | pkgs/build-support/php/build-pecl.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/build-support/php/build-pecl.nix b/pkgs/build-support/php/build-pecl.nix new file mode 100644 index 0000000000000..389447e066fa2 --- /dev/null +++ b/pkgs/build-support/php/build-pecl.nix @@ -0,0 +1,46 @@ +{ stdenv, lib, php, autoreconfHook, fetchurl, re2c, nix-update-script }: + +{ pname +, version +, internalDeps ? [ ] +, peclDeps ? [ ] +, buildInputs ? [ ] +, nativeBuildInputs ? [ ] +, postPhpize ? "" +, makeFlags ? [ ] +, src ? fetchurl { + url = "https://pecl.php.net/get/${pname}-${version}.tgz"; + inherit (args) sha256; + } +, passthru ? { } +, ... +}@args: + +stdenv.mkDerivation (args // { + name = "php-${pname}-${version}"; + extensionName = pname; + + inherit src; + + nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs; + buildInputs = [ php ] ++ peclDeps ++ buildInputs; + + 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} + ''; + checkPhase = "NO_INTERACTON=yes make test"; + + 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 {}; + }; +}) |