Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 php,
5 autoreconfHook,
6 fetchurl,
7 re2c,
8 nix-update-script,
9}:
10
11{
12 pname,
13 version,
14 internalDeps ? [ ],
15 peclDeps ? [ ],
16 buildInputs ? [ ],
17 nativeBuildInputs ? [ ],
18 postPhpize ? "",
19 makeFlags ? [ ],
20 src ? fetchurl (
21 {
22 url = "https://pecl.php.net/get/${pname}-${version}.tgz";
23 }
24 // lib.filterAttrs (
25 attrName: _:
26 lib.elem attrName [
27 "sha256"
28 "hash"
29 ]
30 ) args
31 ),
32 passthru ? { },
33 ...
34}@args:
35
36stdenv.mkDerivation (
37 args
38 // {
39 name = "php-${pname}-${version}";
40 extensionName = pname;
41
42 inherit src;
43
44 strictDeps = true;
45 nativeBuildInputs = [
46 php
47 autoreconfHook
48 re2c
49 ]
50 ++ nativeBuildInputs;
51 buildInputs = [ php ] ++ peclDeps ++ buildInputs;
52
53 makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;
54
55 autoreconfPhase = ''
56 phpize
57 ${postPhpize}
58 ${lib.concatMapStringsSep "\n" (
59 dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}"
60 ) internalDeps}
61 '';
62 checkPhase = "NO_INTERACTON=yes make test";
63
64 passthru = passthru // {
65 # Thes flags were introduced for `nix-update` so that it can update
66 # PHP extensions correctly.
67 # See the corresponding PR: https://github.com/Mic92/nix-update/pull/123
68 isPhpExtension = true;
69 updateScript = passthru.updateScript or (nix-update-script { });
70 };
71 }
72)