forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / development / libraries / lief / default.nix
blob1cb0da700732f99671d221641b5abadb8f16d8a6
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , python
5 , cmake
6 , ninja
7 }:
9 let
10   pyEnv = python.withPackages (ps: [ ps.setuptools ps.tomli ps.pip ps.setuptools ]);
12 stdenv.mkDerivation rec {
13   pname = "lief";
14   version = "0.15.1";
16   src = fetchFromGitHub {
17     owner = "lief-project";
18     repo = "LIEF";
19     rev = version;
20     sha256 = "sha256-2W/p6p7YXqSNaVs8yPAnLQhbBVIQWEbUVnhx9edV5gI=";
21   };
23   outputs = [ "out" "py" ];
25   nativeBuildInputs = [
26     cmake
27     ninja
28   ];
30   # Not in propagatedBuildInputs because only the $py output needs it; $out is
31   # just the library itself (e.g. C/C++ headers).
32   buildInputs = with python.pkgs; [
33     python
34     build
35     pathspec
36     pip
37     pydantic
38     scikit-build-core
39   ];
41   env.CXXFLAGS = toString (lib.optional stdenv.hostPlatform.isDarwin [ "-faligned-allocation" "-fno-aligned-new" "-fvisibility=hidden" ]);
43   postBuild = ''
44     pushd ../api/python
45     ${pyEnv.interpreter} -m build --no-isolation --wheel --skip-dependency-check --config-setting=--parallel=$NIX_BUILD_CORES
46     popd
47   '';
49   postInstall = ''
50     pushd ../api/python
51     ${pyEnv.interpreter} -m pip install --prefix $py dist/*.whl
52     popd
53   '';
55   meta = with lib; {
56     description = "Library to Instrument Executable Formats";
57     homepage = "https://lief.quarkslab.com/";
58     license = [ licenses.asl20 ];
59     platforms = with platforms; linux ++ darwin;
60     maintainers = with maintainers; [ lassulus genericnerdyusername ];
61   };