about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/hotpatch/default.nix
blob: 7dcf09c5c5b2b2f6a30389f7c3aa4a1f17e996f4 (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
{ lib, stdenv, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
  pname = "hotpatch";
  version = "0.2";

  src = fetchFromGitHub {
    owner = "vikasnkumar";
    repo = "hotpatch";
    rev = "4b65e3f275739ea5aa798d4ad083c4cb10e29149";
    sha256 = "169vdh55wsbn6fl58lpzqx64v6ifzh7krykav33x1d9hsk98qjqh";
  };

  doCheck = true;

  nativeBuildInputs = [ cmake ];

  preConfigure = ''
    substituteInPlace test/loader.c \
      --replace \"/lib64/ld-linux-x86-64.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --replace \"/lib/ld-linux-x86-64.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --replace \"/lib/ld-linux.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --replace \"/lib32/ld-linux.so.2 \""$(cat $NIX_CC/nix-support/dynamic-linker)"
  '';

  checkPhase = ''
    LD_LIBRARY_PATH=$(pwd)/src make test
  '';

  patches = [ ./no-loader-test.patch ];

  meta = with lib; {
    description = "Hot patching executables on Linux using .so file injection";
    mainProgram = "hotpatcher";
    homepage = src.meta.homepage;
    license = licenses.bsd3;
    maintainers = [ ];
    platforms = ["i686-linux" "x86_64-linux"];
  };
}