From 0361dd09cbd87d44c414d2e711166db681039deb Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 15 May 2017 01:17:29 +0200 Subject: [PATCH] Fixes for the readme, and properly setup capstone for meson --- README.md | 40 ++++++++++++++++++++++------------------ libr/asm/asm.c | 4 ++-- libr/asm/meson.build | 16 ++++++++++++++++ 3 files changed, 40 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d8dbf79c8f..d6cd0a50af 100644 --- a/README.md +++ b/README.md @@ -60,12 +60,12 @@ To build the bindings you need latest valabind, g++ and swig2. The easiest way to install radare2 from git is by running the following command: - $ sys/install.sh + $ sys/install.sh If you want to install radare2 in the home directory without using root privileges and sudo, simply run: - $ sys/user.sh + $ sys/user.sh # Building with meson + ninja @@ -73,9 +73,9 @@ The sys/install.sh method uses acr+make to build r2 from sources, which is the d and recommended way, but there's also a work-in-progress support for Meson. Here's how to build r2 with meson and ninja (supports linux, mac and windows) - $ make meson # will run make meson-config automatically - $ make meson-symstall # symstall the meson build into PREFIX (/usr) - $ make meson-uninstall # uninstall the meson installation + $ make meson # will run make meson-config automatically + $ make meson-symstall # symstall the meson build into PREFIX (/usr) + $ make meson-uninstall # uninstall the meson installation At the moment, the meson build system doesnt supports much configuration options and it is not able to build all the plugins, it has been tested to work on the following hosts: @@ -91,8 +91,8 @@ is not able to build all the plugins, it has been tested to work on the followin In case of a polluted filesystem you can uninstall the current version or remove all previous installations: - $ make uninstall - $ make purge + $ make uninstall + $ make purge # Package manager @@ -100,19 +100,19 @@ Radare2 has its own package manager - r2pm. It's packages repository is on [GitHub too](https://github.com/radare/radare2-pm). To start to use it for the first time you need to initialize packages: - $ r2pm init + $ r2pm init And to refresh packages before installation/updating a new one: - $ r2pm update + $ r2pm update To install package use the command - $ r2pm install [package name] + $ r2pm install [package name] To update package use the command - $ r2pm update [package name] + $ r2pm update [package name] # Bindings @@ -125,7 +125,7 @@ to swig interfaces, nodejs-ffi or other and then compiled. The easiest way to install the python bindings is to run: - $ r2pm install python + $ r2pm install python In addition there are `r2pipe` bindings, which are an API interface to interact with the prompt, passing commands @@ -133,10 +133,10 @@ and receivent the output as a string, many commands support JSON output, so it's integrated easily with many languages in order to deserialize it into native objects. - $ npm install r2pipe # NodeJS - $ gem install r2pipe # Ruby - $ pip install r2pipe # Python - $ opam install radare2 # OCaml + $ npm install r2pipe # NodeJS + $ gem install r2pipe # Ruby + $ pip install r2pipe # Python + $ opam install radare2 # OCaml And also for Go, Rust, Swift, D, .NET, Java, NewLisp, Perl, Haskell, Vala, OCaml, and many more to come! @@ -174,13 +174,13 @@ radare2 comes with an embedded webserver that serves a pure html/js interface that sends ajax queries to the core and aims to implement an usable UI for phones, tablets and desktops. - $ r2 -c=H /bin/ls + $ r2 -c=H /bin/ls To use the webserver on Windows, you require a cmd instance with administrator rights. To start the webserver use command in the project root. - > radare2.exe -c=H rax2.exe + > radare2.exe -c=H rax2.exe # Pointers @@ -188,4 +188,8 @@ Website: http://www.radare.org/ IRC: irc.freenode.net #radare +Telegram: https://t.me/radare + +Matrix: @radare2:matrix.org + Twitter: @radareorg diff --git a/libr/asm/asm.c b/libr/asm/asm.c index 80a4f239d7..b35dfa9894 100644 --- a/libr/asm/asm.c +++ b/libr/asm/asm.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2009-2016 - pancake, nibble */ +/* radare - LGPL - Copyright 2009-2017 - pancake, nibble */ #include #include @@ -558,7 +558,7 @@ R_API RAsmCode* r_asm_mdisassemble(RAsm *a, const ut8 *buf, int len) { return r_asm_code_free (acode); } memcpy (acode->buf, buf, len); - if (!(acode->buf_hex = malloc (2 * len+1))) { + if (!(acode->buf_hex = calloc (2, len + 1))) { return r_asm_code_free (acode); } r_hex_bin2str (buf, len, acode->buf_hex); diff --git a/libr/asm/meson.build b/libr/asm/meson.build index 4f85631644..69c4b6d143 100644 --- a/libr/asm/meson.build +++ b/libr/asm/meson.build @@ -64,6 +64,22 @@ cs_files=[ ] capstone = static_library('capstone', cs_files, + c_args: [ + '-DCAPSTONE_X86_ATT_DISABLE_NO', + '-DCAPSTONE_X86_REDUCE_NO', + '-DCAPSTONE_USE_SYS_DYN_MEM', + '-DCAPSTONE_DIET_NO', + '-DCAPSTONE_HAS_ARM', + '-DCAPSTONE_HAS_ARM64', + '-DCAPSTONE_HAS_M68K', + '-DCAPSTONE_HAS_MIPS', + '-DCAPSTONE_HAS_POWERPC', + '-DCAPSTONE_HAS_SPARC', + '-DCAPSTONE_HAS_SYSZ', + '-DCAPSTONE_HAS_X86', + '-DCAPSTONE_HAS_XCORE', + '-DCAPSTONE_HAS_TMS320C64X', + ], include_directories: include_directories([ '../../shlr/capstone/include' ]))