2021-04-08 16:26:57 +00:00
|
|
|
|
{ lib
|
|
|
|
|
, stdenv
|
|
|
|
|
, fetchurl
|
|
|
|
|
, pkg-config
|
|
|
|
|
, libusb-compat-0_1
|
|
|
|
|
, readline
|
|
|
|
|
, libewf
|
|
|
|
|
, perl
|
|
|
|
|
, zlib
|
|
|
|
|
, openssl
|
|
|
|
|
, libuv
|
|
|
|
|
, file
|
|
|
|
|
, libzip
|
|
|
|
|
, lz4
|
|
|
|
|
, xxHash
|
|
|
|
|
, meson
|
2022-10-30 15:09:59 +00:00
|
|
|
|
, python3
|
2021-04-08 16:26:57 +00:00
|
|
|
|
, cmake
|
|
|
|
|
, ninja
|
|
|
|
|
, capstone
|
|
|
|
|
, tree-sitter
|
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "rizin";
|
2022-09-22 12:36:57 +00:00
|
|
|
|
version = "0.4.1";
|
2021-04-08 16:26:57 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-04-12 18:23:04 +00:00
|
|
|
|
url = "https://github.com/rizinorg/rizin/releases/download/v${version}/rizin-src-v${version}.tar.xz";
|
2022-09-22 12:36:57 +00:00
|
|
|
|
sha256 = "sha256-Zp2Va5l4IKNuQjzzXUgqqZhJJUuWWM72hERZkS39v7g=";
|
2021-04-08 16:26:57 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
mesonFlags = [
|
2021-04-12 18:23:04 +00:00
|
|
|
|
"-Duse_sys_capstone=enabled"
|
|
|
|
|
"-Duse_sys_magic=enabled"
|
|
|
|
|
"-Duse_sys_libzip=enabled"
|
|
|
|
|
"-Duse_sys_zlib=enabled"
|
|
|
|
|
"-Duse_sys_xxhash=enabled"
|
|
|
|
|
"-Duse_sys_lz4=enabled"
|
|
|
|
|
"-Duse_sys_openssl=enabled"
|
|
|
|
|
"-Duse_sys_tree_sitter=enabled"
|
2021-04-08 16:26:57 +00:00
|
|
|
|
];
|
|
|
|
|
|
2022-09-22 12:36:57 +00:00
|
|
|
|
nativeBuildInputs = [
|
|
|
|
|
pkg-config
|
|
|
|
|
meson
|
2022-10-30 15:09:59 +00:00
|
|
|
|
(python3.withPackages (pp: with pp; [
|
|
|
|
|
pyyaml
|
|
|
|
|
]))
|
2022-09-22 12:36:57 +00:00
|
|
|
|
ninja
|
|
|
|
|
cmake
|
|
|
|
|
];
|
2021-04-12 18:23:04 +00:00
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
|
# meson's find_library seems to not use our compiler wrapper if static parameter
|
2021-04-12 18:23:04 +00:00
|
|
|
|
# is either true/false... We work around by also providing LIBRARY_PATH
|
|
|
|
|
preConfigure = ''
|
|
|
|
|
LIBRARY_PATH=""
|
|
|
|
|
for b in ${toString (map lib.getLib buildInputs)}; do
|
|
|
|
|
if [[ -d "$b/lib" ]]; then
|
|
|
|
|
LIBRARY_PATH="$b/lib''${LIBRARY_PATH:+:}$LIBRARY_PATH"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
export LIBRARY_PATH
|
2022-09-22 12:36:57 +00:00
|
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
|
substituteInPlace binrz/rizin/macos_sign.sh \
|
|
|
|
|
--replace 'codesign' '# codesign'
|
2021-04-12 18:23:04 +00:00
|
|
|
|
'';
|
2021-04-08 16:26:57 +00:00
|
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
|
file
|
|
|
|
|
libzip
|
|
|
|
|
capstone
|
|
|
|
|
readline
|
|
|
|
|
libusb-compat-0_1
|
|
|
|
|
libewf
|
|
|
|
|
perl
|
|
|
|
|
zlib
|
|
|
|
|
lz4
|
|
|
|
|
openssl
|
|
|
|
|
libuv
|
|
|
|
|
tree-sitter
|
|
|
|
|
xxHash
|
|
|
|
|
];
|
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
|
postPatch = ''
|
|
|
|
|
# find_installation without arguments uses Meson’s Python interpreter,
|
|
|
|
|
# which does not have any extra modules.
|
|
|
|
|
# https://github.com/mesonbuild/meson/pull/9904
|
|
|
|
|
substituteInPlace meson.build \
|
|
|
|
|
--replace "import('python').find_installation()" "find_program('python3')"
|
|
|
|
|
'';
|
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
|
meta = {
|
|
|
|
|
description = "UNIX-like reverse engineering framework and command-line toolset.";
|
|
|
|
|
homepage = "https://rizin.re/";
|
|
|
|
|
license = lib.licenses.gpl3Plus;
|
|
|
|
|
maintainers = with lib.maintainers; [ raskin makefu mic92 ];
|
2022-09-22 12:36:57 +00:00
|
|
|
|
platforms = with lib.platforms; unix;
|
2021-04-08 16:26:57 +00:00
|
|
|
|
};
|
|
|
|
|
}
|