2021-04-25 03:57:28 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python
|
|
|
|
, cmake
|
2023-10-09 19:29:22 +00:00
|
|
|
, ninja
|
2021-04-25 03:57:28 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
let
|
2023-10-09 19:29:22 +00:00
|
|
|
pyEnv = python.withPackages (ps: [ ps.setuptools ps.tomli ps.pip ps.setuptools ]);
|
2021-04-25 03:57:28 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lief";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.15.1";
|
2021-04-25 03:57:28 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lief-project";
|
|
|
|
repo = "LIEF";
|
|
|
|
rev = version;
|
2024-09-19 14:19:46 +00:00
|
|
|
sha256 = "sha256-2W/p6p7YXqSNaVs8yPAnLQhbBVIQWEbUVnhx9edV5gI=";
|
2021-04-25 03:57:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "py" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2023-10-09 19:29:22 +00:00
|
|
|
ninja
|
2021-04-25 03:57:28 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# Not a propagatedBuildInput because only the $py output needs it; $out is
|
|
|
|
# just the library itself (e.g. C/C++ headers).
|
2024-07-27 06:49:29 +00:00
|
|
|
buildInputs = with python.pkgs; [
|
2021-04-25 03:57:28 +00:00
|
|
|
python
|
2024-07-27 06:49:29 +00:00
|
|
|
build
|
|
|
|
pathspec
|
|
|
|
pip
|
|
|
|
pydantic
|
|
|
|
scikit-build-core
|
2021-04-25 03:57:28 +00:00
|
|
|
];
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
env.CXXFLAGS = toString (lib.optional stdenv.hostPlatform.isDarwin [ "-faligned-allocation" "-fno-aligned-new" "-fvisibility=hidden" ]);
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postBuild = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
pushd ../api/python
|
2024-07-27 06:49:29 +00:00
|
|
|
${pyEnv.interpreter} -m build --no-isolation --wheel --skip-dependency-check --config-setting=--parallel=$NIX_BUILD_CORES
|
2023-10-09 19:29:22 +00:00
|
|
|
popd
|
2021-04-25 03:57:28 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postInstall = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
pushd ../api/python
|
2024-07-27 06:49:29 +00:00
|
|
|
${pyEnv.interpreter} -m pip install --prefix $py dist/*.whl
|
2023-10-09 19:29:22 +00:00
|
|
|
popd
|
2021-04-25 03:57:28 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Library to Instrument Executable Formats";
|
|
|
|
homepage = "https://lief.quarkslab.com/";
|
|
|
|
license = [ licenses.asl20 ];
|
2023-03-04 12:14:45 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = with maintainers; [ lassulus genericnerdyusername ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|