about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/lief
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/lief')
-rw-r--r--nixpkgs/pkgs/development/libraries/lief/default.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/lief/default.nix b/nixpkgs/pkgs/development/libraries/lief/default.nix
new file mode 100644
index 000000000000..44f82f15852a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/lief/default.nix
@@ -0,0 +1,55 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python
+, cmake
+, ninja
+}:
+
+let
+  pyEnv = python.withPackages (ps: [ ps.setuptools ps.tomli ps.pip ps.setuptools ]);
+in
+stdenv.mkDerivation rec {
+  pname = "lief";
+  version = "0.13.2";
+
+  src = fetchFromGitHub {
+    owner = "lief-project";
+    repo = "LIEF";
+    rev = version;
+    sha256 = "sha256-lH4SqwPB2Jp/wUI2Cll67PQbHbwMqpNuLy/ei8roiHg=";
+  };
+
+  outputs = [ "out" "py" ];
+
+  nativeBuildInputs = [
+    cmake
+    ninja
+  ];
+
+  # Not a propagatedBuildInput because only the $py output needs it; $out is
+  # just the library itself (e.g. C/C++ headers).
+  buildInputs = [
+    python
+  ];
+
+  postBuild = ''
+    pushd /build/source/api/python
+    ${pyEnv.interpreter} setup.py build --parallel=$NIX_BUILD_CORES
+    popd
+  '';
+
+  postInstall = ''
+    pushd /build/source/api/python
+    ${pyEnv.interpreter} setup.py install --skip-build --root=/ --prefix=$py
+    popd
+  '';
+
+  meta = with lib; {
+    description = "Library to Instrument Executable Formats";
+    homepage = "https://lief.quarkslab.com/";
+    license = [ licenses.asl20 ];
+    platforms = with platforms; linux ++ darwin;
+    maintainers = with maintainers; [ lassulus genericnerdyusername ];
+  };
+}