about summary refs log tree commit diff
path: root/pkgs/development/php-packages/phpspy/default.nix
blob: 7bb3009bb17efd63fcd0b5e14e717bdfbdc2ff94 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  lib,
  stdenv,
  fetchFromGitHub,
  gnugrep,
  binutils,
  makeBinaryWrapper,
  php,
  testers,
  phpPackages,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "phpspy";
  version = "0.6.0";

  src = fetchFromGitHub {
    owner = "adsr";
    repo = "phpspy";
    rev = "v${finalAttrs.version}";
    hash = "sha256-iQOeZLHRc5yUgXc6xz52t/6oc07eZfH5ZgzSdJBcaak=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
    makeBinaryWrapper
    php.unwrapped
  ];

  env.USE_ZEND = 1;

  installPhase = ''
    runHook preInstall

    install -Dt "$out/bin" phpspy stackcollapse-phpspy.pl

    runHook postInstall
  '';

  postFixup = ''
    wrapProgram "$out/bin/phpspy" \
      --prefix PATH : "${
        lib.makeBinPath [
          gnugrep
          # for objdump
          binutils
        ]
      }"
  '';

  passthru.tests.version = testers.testVersion {
    version = "v${finalAttrs.version}";
    package = phpPackages.phpspy;
    command = "phpspy -v";
  };

  meta = with lib; {
    description = "Low-overhead sampling profiler for PHP";
    homepage = "https://github.com/adsr/phpspy";
    license = licenses.mit;
    mainProgram = "phpspy";
    maintainers = with maintainers; [ gaelreyrol ];
    platforms = [ "x86_64-linux" ];
  };
})