2021-03-30 10:10:56 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2023-01-09 18:15:31 +00:00
|
|
|
, fetchpatch
|
2018-12-10 13:57:03 +00:00
|
|
|
, buildPackages
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2022-11-13 20:31:08 +00:00
|
|
|
, meson
|
|
|
|
, ninja
|
2021-03-30 10:10:56 +00:00
|
|
|
, libusb-compat-0_1
|
|
|
|
, readline
|
|
|
|
, libewf
|
|
|
|
, perl
|
|
|
|
, zlib
|
|
|
|
, openssl
|
|
|
|
, libuv
|
|
|
|
, file
|
|
|
|
, libzip
|
|
|
|
, xxHash
|
2021-04-08 11:06:47 +00:00
|
|
|
, gtk2
|
|
|
|
, vte
|
|
|
|
, gtkdialog
|
|
|
|
, python3
|
|
|
|
, ruby
|
|
|
|
, lua
|
2022-11-13 20:31:08 +00:00
|
|
|
, lz4
|
2021-04-21 07:58:00 +00:00
|
|
|
, capstone
|
2019-02-03 15:33:25 +00:00
|
|
|
, useX11 ? false
|
|
|
|
, rubyBindings ? false
|
|
|
|
, luaBindings ? false
|
2018-08-22 10:45:34 +00:00
|
|
|
}:
|
2014-09-03 19:01:39 +00:00
|
|
|
|
2021-08-20 23:01:13 +00:00
|
|
|
let
|
2022-11-10 21:55:27 +00:00
|
|
|
# FIXME: Compare revision with
|
2023-01-24 22:01:04 +00:00
|
|
|
# https://github.com/radareorg/radare2/blob/master/libr/arch/p/arm/v35/Makefile#L26-L27
|
2021-08-20 23:01:13 +00:00
|
|
|
arm64 = fetchFromGitHub {
|
|
|
|
owner = "radareorg";
|
|
|
|
repo = "vector35-arch-arm64";
|
2023-01-24 22:01:04 +00:00
|
|
|
rev = "55d73c6bbb94448a5c615933179e73ac618cf876";
|
|
|
|
hash = "sha256-pZxxp5xDg8mgkGEx7LaBSoKxNPyggFYA4um9YaO20LU=";
|
2021-08-20 23:01:13 +00:00
|
|
|
};
|
2021-12-07 07:25:15 +00:00
|
|
|
armv7 = fetchFromGitHub {
|
|
|
|
owner = "radareorg";
|
|
|
|
repo = "vector35-arch-armv7";
|
2023-01-24 22:01:04 +00:00
|
|
|
rev = "f270a6cc99644cb8e76055b6fa632b25abd26024";
|
|
|
|
hash = "sha256-YhfgJ7M8ys53jh1clOzj0I2yfJshXQm5zP0L9kMYsmk=";
|
2021-12-07 07:25:15 +00:00
|
|
|
};
|
2021-08-20 23:01:13 +00:00
|
|
|
in
|
2021-04-22 05:47:20 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-03-30 10:10:56 +00:00
|
|
|
pname = "radare2";
|
2023-06-10 14:32:06 +00:00
|
|
|
version = "5.8.8";
|
2018-08-22 10:45:34 +00:00
|
|
|
|
2021-03-30 10:10:56 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "radare";
|
|
|
|
repo = "radare2";
|
2023-03-15 10:06:28 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-06-10 14:32:06 +00:00
|
|
|
hash = "sha256-JGNV5xSyrjcO2ZgOjzDqzfZyALPSCyA3DZx/D8ffmKA=";
|
2021-03-30 10:10:56 +00:00
|
|
|
};
|
2018-08-22 10:45:34 +00:00
|
|
|
|
2021-08-20 23:01:13 +00:00
|
|
|
preBuild = ''
|
2023-01-24 22:01:04 +00:00
|
|
|
pushd ../libr/arch/p/arm/v35
|
2022-12-23 09:50:01 +00:00
|
|
|
cp -r ${arm64} arch-arm64
|
|
|
|
chmod -R +w arch-arm64
|
2021-12-07 07:25:15 +00:00
|
|
|
|
2022-12-23 09:50:01 +00:00
|
|
|
cp -r ${armv7} arch-armv7
|
|
|
|
chmod -R +w arch-armv7
|
|
|
|
popd
|
2021-08-20 23:01:13 +00:00
|
|
|
'';
|
|
|
|
|
2021-11-11 20:40:28 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isDarwin ''
|
2022-11-13 20:31:08 +00:00
|
|
|
install_name_tool -add_rpath $out/lib $out/lib/libr_io.${version}.dylib
|
2021-11-11 20:40:28 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-13 20:31:08 +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-03-30 10:10:56 +00:00
|
|
|
];
|
2018-08-22 10:45:34 +00:00
|
|
|
|
2021-03-30 10:10:56 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
2018-08-22 10:45:34 +00:00
|
|
|
|
2022-11-13 20:36:49 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config meson ninja python3 ];
|
2021-04-21 07:58:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
capstone
|
|
|
|
file
|
|
|
|
readline
|
|
|
|
libusb-compat-0_1
|
|
|
|
libewf
|
|
|
|
perl
|
|
|
|
zlib
|
|
|
|
openssl
|
|
|
|
libuv
|
2022-11-13 20:31:08 +00:00
|
|
|
lz4
|
2022-10-06 16:38:53 +00:00
|
|
|
] ++ lib.optionals useX11 [ gtkdialog vte gtk2 ]
|
|
|
|
++ lib.optionals rubyBindings [ ruby ]
|
|
|
|
++ lib.optionals luaBindings [ lua ];
|
2018-08-22 10:45:34 +00:00
|
|
|
|
2021-03-30 10:10:56 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
# radare2 exposes r_lib which depends on these libraries
|
|
|
|
file # for its list of magic numbers (`libmagic`)
|
|
|
|
libzip
|
|
|
|
xxHash
|
|
|
|
];
|
2019-01-08 20:55:44 +00:00
|
|
|
|
2021-11-11 20:40:28 +00:00
|
|
|
meta = with lib; {
|
2022-11-10 21:55:27 +00:00
|
|
|
description = "UNIX-like reverse engineering framework and command-line tools";
|
|
|
|
homepage = "https://radare.org";
|
2023-03-15 10:06:28 +00:00
|
|
|
changelog = "https://github.com/radareorg/radare2/releases/tag/${version}";
|
2021-11-11 20:40:28 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2022-11-10 21:55:27 +00:00
|
|
|
maintainers = with maintainers; [ azahi raskin makefu mic92 arkivm ];
|
2021-11-11 20:40:28 +00:00
|
|
|
platforms = platforms.unix;
|
2018-08-22 10:45:34 +00:00
|
|
|
};
|
|
|
|
}
|