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";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.13.2";
|
2021-04-25 03:57:28 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lief-project";
|
|
|
|
repo = "LIEF";
|
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "sha256-lH4SqwPB2Jp/wUI2Cll67PQbHbwMqpNuLy/ei8roiHg=";
|
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).
|
|
|
|
buildInputs = [
|
|
|
|
python
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
env.CXXFLAGS = toString (lib.optional stdenv.isDarwin [ "-faligned-allocation" "-fno-aligned-new" "-fvisibility=hidden" ]);
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postBuild = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
pushd ../api/python
|
2023-10-09 19:29:22 +00:00
|
|
|
${pyEnv.interpreter} setup.py build --parallel=$NIX_BUILD_CORES
|
|
|
|
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
|
2021-04-25 03:57:28 +00:00
|
|
|
${pyEnv.interpreter} setup.py install --skip-build --root=/ --prefix=$py
|
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
|
|
|
};
|
|
|
|
}
|