2021-04-08 16:26:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPackages
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2022-11-21 17:40:18 +00:00
|
|
|
, meson
|
|
|
|
, ninja
|
2021-04-08 16:26:57 +00:00
|
|
|
, libusb-compat-0_1
|
|
|
|
, readline
|
|
|
|
, libewf
|
|
|
|
, perl
|
|
|
|
, zlib
|
|
|
|
, openssl
|
|
|
|
, libuv
|
|
|
|
, file
|
|
|
|
, libzip
|
|
|
|
, xxHash
|
|
|
|
, gtk2
|
|
|
|
, vte
|
|
|
|
, gtkdialog
|
|
|
|
, python3
|
|
|
|
, ruby
|
|
|
|
, lua
|
2022-11-21 17:40:18 +00:00
|
|
|
, lz4
|
2021-04-22 02:08:21 +00:00
|
|
|
, capstone
|
2020-04-24 23:36:52 +00:00
|
|
|
, useX11 ? false
|
|
|
|
, rubyBindings ? false
|
|
|
|
, luaBindings ? false
|
|
|
|
}:
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
let
|
2022-11-21 17:40:18 +00:00
|
|
|
# FIXME: Compare revision with
|
|
|
|
# https://github.com/radareorg/radare2/blob/master/libr/asm/arch/arm/v35arm64/Makefile#L26-L27
|
2021-08-22 07:53:02 +00:00
|
|
|
arm64 = fetchFromGitHub {
|
|
|
|
owner = "radareorg";
|
|
|
|
repo = "vector35-arch-arm64";
|
2022-11-21 17:40:18 +00:00
|
|
|
rev = "c9e7242972837ac11fc94db05fabcb801a8269c9";
|
|
|
|
hash = "sha256-HFQj23GlLAyyzMGnPq40XaPv5qPDHdDlQOo0Hprc9Cs=";
|
2021-08-22 07:53:02 +00:00
|
|
|
};
|
2021-12-19 01:06:50 +00:00
|
|
|
armv7 = fetchFromGitHub {
|
|
|
|
owner = "radareorg";
|
|
|
|
repo = "vector35-arch-armv7";
|
|
|
|
rev = "dde39f69ffea19fc37e681874b12cb4707bc4f30";
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
hash = "sha256-bnWQc0dScM9rhIdzf+iVXvMqYWq/bguEAUQPaZRgdlU=";
|
2021-12-19 01:06:50 +00:00
|
|
|
};
|
2021-08-22 07:53:02 +00:00
|
|
|
in
|
2021-04-25 03:57:28 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-04-08 16:26:57 +00:00
|
|
|
pname = "radare2";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "5.7.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "radare";
|
|
|
|
repo = "radare2";
|
2021-04-25 03:57:28 +00:00
|
|
|
rev = version;
|
2022-11-21 17:40:18 +00:00
|
|
|
hash = "sha256-+/9SeILuDCUaYwPhhN6z3vQFicd1Bh8N/yicZTybR5o=";
|
2021-04-08 16:26:57 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
preBuild = ''
|
2022-11-21 17:40:18 +00:00
|
|
|
cp -r ${arm64} ../libr/asm/arch/arm/v35arm64/arch-arm64
|
|
|
|
chmod -R +w ../libr/asm/arch/arm/v35arm64/arch-arm64
|
2021-12-19 01:06:50 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
cp -r ${armv7} ../libr/asm/arch/arm/v35arm64/arch-armv7
|
|
|
|
chmod -R +w ../libr/asm/arch/arm/v35arm64/arch-armv7
|
2021-08-22 07:53:02 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isDarwin ''
|
2022-11-21 17:40:18 +00:00
|
|
|
install_name_tool -add_rpath $out/lib $out/lib/libr_io.${version}.dylib
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Duse_sys_capstone=true"
|
|
|
|
"-Duse_sys_magic=true"
|
|
|
|
"-Duse_sys_zip=true"
|
|
|
|
"-Duse_sys_xxhash=true"
|
|
|
|
"-Duse_sys_lz4=true"
|
|
|
|
"-Dr2_gittap=${version}"
|
2021-04-08 16:26:57 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config meson ninja python3 ];
|
2021-04-22 02:08:21 +00:00
|
|
|
buildInputs = [
|
|
|
|
capstone
|
|
|
|
file
|
|
|
|
readline
|
|
|
|
libusb-compat-0_1
|
|
|
|
libewf
|
|
|
|
perl
|
|
|
|
zlib
|
|
|
|
openssl
|
|
|
|
libuv
|
2022-11-21 17:40:18 +00:00
|
|
|
lz4
|
2022-10-30 15:09:59 +00:00
|
|
|
] ++ lib.optionals useX11 [ gtkdialog vte gtk2 ]
|
|
|
|
++ lib.optionals rubyBindings [ ruby ]
|
|
|
|
++ lib.optionals luaBindings [ lua ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
# radare2 exposes r_lib which depends on these libraries
|
|
|
|
file # for its list of magic numbers (`libmagic`)
|
|
|
|
libzip
|
|
|
|
xxHash
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
meta = with lib; {
|
2022-11-21 17:40:18 +00:00
|
|
|
description = "UNIX-like reverse engineering framework and command-line tools";
|
|
|
|
homepage = "https://radare.org";
|
2021-12-06 16:07:01 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2022-11-21 17:40:18 +00:00
|
|
|
maintainers = with maintainers; [ azahi raskin makefu mic92 arkivm ];
|
2021-12-06 16:07:01 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|