radare2: fix cross-build

Only the make-based build support cross-compilation.
Also use less vendored libraries
This commit is contained in:
Jörg Thalheim 2018-12-10 13:57:03 +00:00
parent efa57f8820
commit 900a01ad47
No known key found for this signature in database
GPG Key ID: CA4106B8D7CC79FA

View File

@ -1,10 +1,11 @@
{stdenv, fetchFromGitHub {stdenv, fetchFromGitHub
, buildPackages
, callPackage , callPackage
, ninja, meson , pkgconfig , pkgconfig
, libusb, readline, libewf, perl, zlib, openssl , libusb, readline, libewf, perl, zlib, openssl
, libuv , libuv, file, libzip, xxHash
, gtk2 ? null, vte ? null, gtkdialog ? null , gtk2 ? null, vte ? null, gtkdialog ? null
, python ? null , python3 ? null
, ruby ? null , ruby ? null
, lua ? null , lua ? null
, useX11, rubyBindings, pythonBindings, luaBindings , useX11, rubyBindings, pythonBindings, luaBindings
@ -12,7 +13,7 @@
assert useX11 -> (gtk2 != null && vte != null && gtkdialog != null); assert useX11 -> (gtk2 != null && vte != null && gtkdialog != null);
assert rubyBindings -> ruby != null; assert rubyBindings -> ruby != null;
assert pythonBindings -> python != null; assert pythonBindings -> python3 != null;
let let
@ -49,39 +50,42 @@ let
if ! grep -F "CS_TIP=${cs_tip}" shlr/Makefile; then echo "CS_TIP mismatch"; exit 1; fi if ! grep -F "CS_TIP=${cs_tip}" shlr/Makefile; then echo "CS_TIP mismatch"; exit 1; fi
# When using meson, it expects capstone source relative to build directory # When using meson, it expects capstone source relative to build directory
mkdir -p build/shlr mkdir -p build/shlr
ln -s ${capstone} build/shlr/capstone cp -r ${capstone} shlr/capstone
chmod -R +w shlr/capstone
''; '';
postInstall = '' postInstall = ''
ln -s $out/bin/radare2 $out/bin/r2
install -D -m755 $src/binr/r2pm/r2pm $out/bin/r2pm install -D -m755 $src/binr/r2pm/r2pm $out/bin/r2pm
''; '';
mesonFlags = [ WITHOUT_PULL="1";
"-Dr2_version_commit=${version_commit}" makeFlags = [
"-Dr2_gittap=${gittap}" "GITTAP=${gittap}"
"-Dr2_gittip=${gittip}" "GITTIP=${gittip}"
# 2.8.0 expects this, but later it becomes an option with default=false. "RANLIB=${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.bintools.targetPrefix}ranlib"
"-Dcapstone_in_builddir=true" ];
configureFlags = [
"-Duse_sys_openssl=true" "--with-sysmagic"
"-Duse_sys_zlib=true" "--with-syszip"
"--with-sysxxhash"
"--with-openssl"
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ pkgconfig ninja meson ]; nativeBuildInputs = [ pkgconfig ];
buildInputs = [ readline libusb libewf perl zlib openssl libuv ] buildInputs = [ file libzip xxHash readline libusb libewf perl zlib openssl libuv ]
++ optional useX11 [gtkdialog vte gtk2] ++ optional useX11 [ gtkdialog vte gtk2 ]
++ optional rubyBindings [ruby] ++ optional rubyBindings [ ruby ]
++ optional pythonBindings [python] ++ optional pythonBindings [ python3 ]
++ optional luaBindings [lua]; ++ optional luaBindings [ lua ];
meta = { meta = {
description = "unix-like reverse engineering framework and commandline tools"; description = "unix-like reverse engineering framework and commandline tools";
homepage = http://radare.org/; homepage = http://radare.org/;
license = stdenv.lib.licenses.gpl2Plus; license = stdenv.lib.licenses.gpl2Plus;
maintainers = with stdenv.lib.maintainers; [raskin makefu mic92]; maintainers = with stdenv.lib.maintainers; [ raskin makefu mic92 ];
platforms = with stdenv.lib.platforms; linux; platforms = with stdenv.lib.platforms; linux;
inherit version; inherit version;
}; };