Remove build warnings spotted in termux and improve install instructions

This commit is contained in:
pancake 2023-01-08 18:56:21 +01:00 committed by pancake
parent 5750f88391
commit 25865cb778
8 changed files with 54 additions and 60 deletions

View File

@ -1,58 +1,61 @@
Termux
======
# Termux
Termux is a terminal emulator that ships a base linux environment using the Debian package system
but compiling everything to run on native Android. The result is a fully functional shell on
Android devices for x86, arm and arm64.
Termux is a terminal emulator that ships a base linux environment using the
Debian package system but compiling everything to run on native Android. The
result is a fully functional shell on Android devices for x86, arm and arm64.
Installation
------------
## Installation
The Termux maintainer of the radare2 package updates the package really fast after every release
which happens every 6 weeks. So in this case, as long as it's supposed to run on embedded devices
it is ok to just install the package from Termux unless you really want to track git master or
develop for this platform.
The Termux maintainer of the radare2 package updates the package really fast
after every release which happens every 6 weeks. So in this case, as long as
it's supposed to run on embedded devices it is ok to just install the
package from Termux unless you really want to track git master or develop
for this platform.
sudo apt install radare2
```sh
sudo apt install radare2
```
Building from git
-----------------
## Building from git
The packages required to build are:
The packages required to build r2 and most of the dependencies are:
sudo apt install git make patch clang
sudo apt install make git python build-essential patch wget
Now you can clone the repo and build:
git clone --depth 1 https://github.com/radareorg/radare2
cd radare2
sys/termux.sh
```sh
git clone --depth 1 https://github.com/radareorg/radare2
cd radare2
sys/termux.sh
```
Building with meson
-------------------
## Building with meson
If you want to build with meson:
It is also possible to install r2 with meson (muon/samu are also compatible):
sudo apt install python
sudo pip install meson
sudo r2pm -i ninja
```sh
sudo pip install meson ninja
```
And then you can run the build:
And then you can run the build and install with meson
make meson
```sh
make meson
make meson-symstall PREFIX=/data/data/com.termux/files/usr
```
To install:
## Updating
make meson-symstall PREFIX=/data/data/com.termux/files/usr
Updating
--------
To update the repo and rebuild you can do a full and clean rebuild by just running sys/termux.sh
or opt for typing `make` or `make meson` and it will just build what has changed, is something
fails please do a clean build like this:
git reset --hard
git clean -xdf
sys/termux.sh
To update the repo and rebuild you can do a full and clean rebuild by
just running `sys/termux.sh`, but `sys/install.sh` should be fine, if
there's any issue make a clean clone, uninstall and build from scratch.
```sh
make purge # eliminate all previous installations
git reset --hard
git clean -xdf
git co master
git pull
sys/termux.sh
```

View File

@ -2075,7 +2075,6 @@ static int bin_imports(RCore *r, PJ *pj, int mode, int va, const char *name) {
RListIter *iter;
r_strf_buffer (64);
bool lit = info ? info->has_lit: false;
int i = 0;
if (!info) {
if (IS_MODE_JSON (mode)) {
@ -2170,7 +2169,6 @@ static int bin_imports(RCore *r, PJ *pj, int mode, int va, const char *name) {
}
R_FREE (symname);
R_FREE (libname);
i++;
}
if (IS_MODE_JSON (mode)) {
@ -2368,7 +2366,7 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
bool printHere = (args && *args == '.');
bool none = true;
int i = 0, lastfs = 's';
int lastfs = 's';
RTable *table = r_core_table (r, "symbols");
bool bin_demangle = r_config_get_i (r->config, "bin.demangle");
if (IS_MODE_JSON (mode)) {
@ -2412,7 +2410,6 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
r_table_set_columnsf (table, "dXXssdss", "nth", "paddr","vaddr","bind", "type", "size", "lib", "name");
}
size_t count = 0;
r_list_foreach (symbols, iter, symbol) {
if (!symbol->name) {
continue;
@ -2433,7 +2430,6 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
continue;
}
SymName sn = {0};
count ++;
snInit (r, &sn, symbol, lang);
char *r_symbol_name = r_str_escape_utf8 (sn.name, false, true);
@ -2596,7 +2592,6 @@ static int bin_symbols(RCore *r, PJ *pj, int mode, ut64 laddr, int va, ut64 at,
}
next:
snFini (&sn);
i++;
free (r_symbol_name);
if (exponly && firstexp) {
firstexp = false;

View File

@ -49,17 +49,14 @@ static int cmd_macro(void *data, const char *_input) {
r_core_cmd_help (core, help_msg_lparen);
break;
default: {
int mustcall = 0;
int i, j = 0;
int i, mustcall = 0;
buf = strdup (input);
for (i = 0; buf[i]; i++) {
switch (buf[i]) {
case '(':
j++;
break;
case ')':
j--;
if (buf[i + 1] == '(') {
buf[i + 1] = 0;
mustcall = i + 2;

View File

@ -3820,8 +3820,7 @@ static bool cmd_print_blocks(RCore *core, const char *input) {
r_cons_printf ("0x%08"PFMT64x " [", from);
}
bool use_color = r_config_get_i (core->config, "scr.color");
int len = 0;
const bool use_color = r_config_get_i (core->config, "scr.color");
int i;
for (i = 0; i < ((to - from) / piece); i++) {
ut64 at = from + (piece * i);
@ -3861,7 +3860,6 @@ static bool cmd_print_blocks(RCore *core, const char *input) {
pj_ks (pj, "perm", r_str_rwx_i (as->block[p].perm));
}
pj_end (pj);
len++;
break;
case 'h':
if ((as->block[p].flags)

View File

@ -5,7 +5,7 @@
R_API int r_core_log_list(RCore *core, int n, int nth, char fmt) {
r_return_val_if_fail (core && core->log, 0);
int printed = 0;
int count = 0, i, idx, id = core->log->first;
int count = 0, idx, id = core->log->first;
RStrpool *sp = core->log->sp;
char *str = sp->str;
PJ *pj = NULL;
@ -14,7 +14,7 @@ R_API int r_core_log_list(RCore *core, int n, int nth, char fmt) {
pj = r_core_pj_new (core);
pj_a (pj);
}
for (i = idx = 0; str && *str; i++, id++) {
for (idx = 0; str && *str; id++) {
if ((n && n <= id) || !n) {
switch (fmt) {
case 'j':

View File

@ -5593,7 +5593,6 @@ static void __init_menu_color_settings_layout(void *_core, const char *parent) {
static void __init_menu_disasm_settings_layout(void *_core, const char *parent) {
RCore *core = (RCore *)_core;
int i = 0;
RList *list = __sorted_list (core, menus_settings_disassembly, COUNT (menus_settings_disassembly));
char *pos;
RListIter* iter;
@ -5608,7 +5607,6 @@ static void __init_menu_disasm_settings_layout(void *_core, const char *parent)
r_strbuf_append (rsb, r_config_get (core->config, pos));
__add_menu (core, parent, r_strbuf_get (rsb), __config_toggle_cb);
}
i++;
}
r_list_free (list);
r_strbuf_free (rsb);

View File

@ -504,10 +504,8 @@ R_API int r_core_pseudo_code(RCore *core, const char *input) {
//n_bb --;
} while (n_bb > 0);
RListIter *iter;
size_t orphan = 0;
r_list_foreach (fcn->bbs, iter, bb) {
if (!r_list_contains (visited, bb)) {
orphan ++;
char *s = r_core_cmd_strf (core, "pdb@0x%08"PFMT64x"@e:asm.offset=0", bb->addr);
s = r_str_replace (s, ";", "//", true);
char *os = r_str_prefix_all (s, indentstr);

View File

@ -102,7 +102,12 @@ fi
if [ "$(id -u)" = 0 ]; then
SUDO=""
else
[ -n "${NOSUDO}" ] && SUDO="echo NOTE: sudo not found. Please run as root: "
if [ -d /system/bin ]; then
# This is an android
SUDO=""
else
[ -n "${NOSUDO}" ] && SUDO="echo NOTE: sudo not found. Please run as root: "
fi
fi
if [ "${USE_SU}" = 1 ]; then