Skip to content

Commit

Permalink
Fixes for the readme, and properly setup capstone for meson
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 14, 2017
1 parent 99c90aa commit 0361dd0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 20 deletions.
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ 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

The sys/install.sh method uses acr+make to build r2 from sources, which is the default
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:
Expand All @@ -91,28 +91,28 @@ 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

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

Expand All @@ -125,18 +125,18 @@ 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
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!
Expand Down Expand Up @@ -174,18 +174,22 @@ 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

Website: http://www.radare.org/

IRC: irc.freenode.net #radare

Telegram: https://t.me/radare

Matrix: @radare2:matrix.org

Twitter: @radareorg
4 changes: 2 additions & 2 deletions libr/asm/asm.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2016 - pancake, nibble */
/* radare - LGPL - Copyright 2009-2017 - pancake, nibble */

#include <stdio.h>
#include <r_types.h>
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions libr/asm/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]))
Expand Down

0 comments on commit 0361dd0

Please sign in to comment.