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
|
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
|
2021-04-22 02:08:21 +00:00
|
|
|
, capstone
|
2020-04-24 23:36:52 +00:00
|
|
|
, useX11 ? false
|
|
|
|
, rubyBindings ? false
|
|
|
|
, pythonBindings ? false
|
|
|
|
, luaBindings ? false
|
|
|
|
}:
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
let
|
2021-08-25 08:27:29 +00:00
|
|
|
# FIXME: Compare revision with https://github.com/radareorg/radare2/blob/master/libr/asm/arch/arm/v35arm64/Makefile#L20
|
2021-08-22 07:53:02 +00:00
|
|
|
arm64 = fetchFromGitHub {
|
|
|
|
owner = "radareorg";
|
|
|
|
repo = "vector35-arch-arm64";
|
2021-10-17 09:34:42 +00:00
|
|
|
rev = "3c5eaba46dab72ecb7d5f5b865a13fdeee95b464";
|
|
|
|
sha256 = "sha256-alcGEi+D8CptXzfznnuxQKCvU2mbzn2sQge5jSqLVpg=";
|
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";
|
2021-10-17 09:34:42 +00:00
|
|
|
version = "5.4.2";
|
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;
|
2021-10-17 09:34:42 +00:00
|
|
|
sha256 = "sha256-5GvJ7J+pAL8GIZ4Tv09wdGyihfMm1bUABhmf7ozQoxc=";
|
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 = ''
|
|
|
|
cp -r ${arm64} libr/asm/arch/arm/v35arm64/arch-arm64
|
|
|
|
chmod -R +w libr/asm/arch/arm/v35arm64/arch-arm64
|
|
|
|
'';
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
postInstall = ''
|
|
|
|
install -D -m755 $src/binr/r2pm/r2pm $out/bin/r2pm
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
WITHOUT_PULL = "1";
|
|
|
|
makeFlags = [
|
2021-04-25 03:57:28 +00:00
|
|
|
"GITTAP=${version}"
|
2021-04-08 16:26:57 +00:00
|
|
|
"RANLIB=${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.bintools.targetPrefix}ranlib"
|
|
|
|
];
|
|
|
|
configureFlags = [
|
|
|
|
"--with-sysmagic"
|
|
|
|
"--with-syszip"
|
|
|
|
"--with-sysxxhash"
|
2021-04-22 02:08:21 +00:00
|
|
|
"--with-syscapstone"
|
2021-04-08 16:26:57 +00:00
|
|
|
"--with-openssl"
|
|
|
|
];
|
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
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2021-04-22 02:08:21 +00:00
|
|
|
buildInputs = [
|
|
|
|
capstone
|
|
|
|
file
|
|
|
|
readline
|
|
|
|
libusb-compat-0_1
|
|
|
|
libewf
|
|
|
|
perl
|
|
|
|
zlib
|
|
|
|
openssl
|
|
|
|
libuv
|
2021-04-25 03:57:28 +00:00
|
|
|
] ++ lib.optional useX11 [ gtkdialog vte gtk2 ]
|
|
|
|
++ lib.optional rubyBindings [ ruby ]
|
|
|
|
++ lib.optional pythonBindings [ python3 ]
|
|
|
|
++ lib.optional 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-04-08 16:26:57 +00:00
|
|
|
meta = {
|
|
|
|
description = "unix-like reverse engineering framework and commandline tools";
|
|
|
|
homepage = "http://radare.org/";
|
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
maintainers = with lib.maintainers; [ raskin makefu mic92 ];
|
|
|
|
platforms = with lib.platforms; linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|