summary refs log tree commit diff
diff options
context:
space:
mode:
authorgnidorah <gnidorah@users.noreply.github.com>2017-10-08 09:03:54 +0300
committergnidorah <gnidorah@users.noreply.github.com>2017-10-08 09:03:54 +0300
commit977c8e673c4938fff42b24d80f724e67c6202f4e (patch)
treef09b6931705d91400af78a7f5cba1fa580b23c98
parent82af1cbf2cf572a5248d2d4b9d091dac65490f4b (diff)
downloadnixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.tar
nixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.tar.gz
nixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.tar.bz2
nixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.tar.lz
nixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.tar.xz
nixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.tar.zst
nixlib-977c8e673c4938fff42b24d80f724e67c6202f4e.zip
hotpatch: init at 0.2
-rw-r--r--pkgs/development/libraries/hotpatch/default.nix37
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/development/libraries/hotpatch/default.nix b/pkgs/development/libraries/hotpatch/default.nix
new file mode 100644
index 000000000000..df3581cc8095
--- /dev/null
+++ b/pkgs/development/libraries/hotpatch/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "hotpatch-0.2";
+
+  src = fetchFromGitHub {
+    owner = "vikasnkumar";
+    repo = "hotpatch";
+    rev = "4b65e3f275739ea5aa798d4ad083c4cb10e29149";
+    sha256 = "169vdh55wsbn6fl58lpzqx64v6ifzh7krykav33x1d9hsk98qjqh";
+  };
+
+  enableParallelBuilding = true;
+  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
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Hot patching executables on Linux using .so file injection";
+    homepage = src.meta.homepage;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.gnidorah ];
+    platforms = ["i686-linux" "x86_64-linux"];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6d017f39cb56..43a1acd76852 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2593,6 +2593,8 @@ with pkgs;
 
   host = bind.host;
 
+  hotpatch = callPackage ../development/libraries/hotpatch { };
+
   hotspot = libsForQt56.callPackage ../development/tools/analysis/hotspot { };
 
   hping = callPackage ../tools/networking/hping { };