1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 gnugrep,
7 binutils,
8 makeBinaryWrapper,
9 php,
10 testers,
11 phpPackages,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "phpspy";
16 version = "0.7.0";
17
18 src = fetchFromGitHub {
19 owner = "adsr";
20 repo = "phpspy";
21 rev = "v${finalAttrs.version}";
22 hash = "sha256-QphoDdnSFPVRvEro0WDUC/yRsOf4I5p5BpHq32olqJI=";
23 fetchSubmodules = true;
24 };
25
26 patches = [
27 (fetchpatch {
28 url = "https://github.com/adsr/phpspy/commit/8854e60ac38cfd2455d4a3d797f283eb3940cb7b.patch";
29 hash = "sha256-IMO9GV0Z8PDEAVhLevg5jGh/PHcbNq3f3fMGFaKoLL4=";
30 })
31 ];
32
33 nativeBuildInputs = [
34 makeBinaryWrapper
35 php.unwrapped
36 ];
37
38 env.USE_ZEND = 1;
39
40 installPhase = ''
41 runHook preInstall
42
43 install -Dt "$out/bin" phpspy stackcollapse-phpspy.pl
44
45 runHook postInstall
46 '';
47
48 postFixup = ''
49 wrapProgram "$out/bin/phpspy" \
50 --prefix PATH : "${
51 lib.makeBinPath [
52 gnugrep
53 # for objdump
54 binutils
55 ]
56 }"
57 '';
58
59 passthru.tests.version = testers.testVersion {
60 version = "v${finalAttrs.version}";
61 package = phpPackages.phpspy;
62 command = "phpspy -v";
63 };
64
65 meta = with lib; {
66 description = "Low-overhead sampling profiler for PHP";
67 homepage = "https://github.com/adsr/phpspy";
68 license = licenses.mit;
69 mainProgram = "phpspy";
70 maintainers = with maintainers; [ gaelreyrol ];
71 platforms = [ "x86_64-linux" ];
72 };
73})