mirror of
https://github.com/rizinorg/rizin
synced 2026-08-22 20:26:16 -04:00
Add support for binr/blob and fix android build ##meson ##build (#17150)
* Make sure meson can build with `system` = `android`. * Add support for binr/blob in meson build * Add also r_util as dependency * Create sdb_version.py to get the SDBVER value from config.mk * Set unknown sdb version if something fails
This commit is contained in:
parent
80202e6ad5
commit
d6c9bd4542
11 changed files with 99 additions and 49 deletions
|
|
@ -1,10 +1,12 @@
|
|||
/* radare - LGPL - Copyright 2012-2019 - pancake */
|
||||
/* radare - LGPL - Copyright 2012-2020 - pancake */
|
||||
|
||||
#include <r_main.h>
|
||||
#include <r_util.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int rc = 1;
|
||||
RMain *m = r_main_new (argv[0]);
|
||||
const char *prog_name = r_file_basename (argv[0]);
|
||||
RMain *m = r_main_new (prog_name);
|
||||
if (m) {
|
||||
rc = r_main_run (m, argc, argv);
|
||||
r_main_free (m);
|
||||
|
|
|
|||
12
binr/blob/meson.build
Normal file
12
binr/blob/meson.build
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
executable('radare2', 'main.c',
|
||||
include_directories: [platform_inc],
|
||||
dependencies: [
|
||||
r_main_dep,
|
||||
r_util_dep,
|
||||
],
|
||||
install: true,
|
||||
install_rpath: rpath,
|
||||
implicit_include_directories: false
|
||||
)
|
||||
|
||||
meson.add_install_script('meson_install_links.sh')
|
||||
11
binr/blob/meson_install_links.sh
Normal file
11
binr/blob/meson_install_links.sh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p "${DESTDIR}/${MESON_INSTALL_PREFIX}/bin"
|
||||
cd "${DESTDIR}/${MESON_INSTALL_PREFIX}/bin"
|
||||
|
||||
TOOLS="rahash2 rarun2 rasm2 rabin2 ragg2 r2agent radiff2 rafind2 rassign2 rax2 r2"
|
||||
|
||||
for TOOL in $TOOLS ; do
|
||||
ln -sf radare2 $TOOL ;
|
||||
done
|
||||
|
|
@ -52,11 +52,11 @@ r_debug_deps = [
|
|||
r_socket_dep
|
||||
]
|
||||
|
||||
if host_machine.system() == 'linux' or host_machine.system() == 'android'
|
||||
r_debug_sources += ['p/native/linux/linux_debug.c']
|
||||
endif
|
||||
if host_machine.system() == 'linux'
|
||||
r_debug_sources += [
|
||||
'p/native/linux/linux_debug.c',
|
||||
'p/native/linux/linux_coredump.c'
|
||||
]
|
||||
r_debug_sources += ['p/native/linux/linux_coredump.c']
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ if host_machine.system() == 'windows'
|
|||
r_io_deps += w32dbg_wrap_dep
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'linux'
|
||||
if host_machine.system() == 'linux' or host_machine.system() == 'android'
|
||||
r_io_sources += [
|
||||
'p/io_r2k_linux.c',
|
||||
]
|
||||
|
|
|
|||
|
|
@ -13,41 +13,44 @@ r_main_sources = [
|
|||
'rax2.c'
|
||||
]
|
||||
|
||||
r_main_deps = [
|
||||
r_config_dep,
|
||||
r_cons_dep,
|
||||
r_io_dep,
|
||||
r_util_dep,
|
||||
r_flag_dep,
|
||||
r_asm_dep,
|
||||
r_core_dep,
|
||||
r_debug_dep,
|
||||
r_hash_dep,
|
||||
r_bin_dep,
|
||||
r_lang_dep,
|
||||
r_io_dep,
|
||||
r_anal_dep,
|
||||
r_parse_dep,
|
||||
r_bp_dep,
|
||||
r_egg_dep,
|
||||
r_reg_dep,
|
||||
r_search_dep,
|
||||
r_syscall_dep,
|
||||
r_socket_dep,
|
||||
r_fs_dep,
|
||||
r_magic_dep,
|
||||
r_crypto_dep
|
||||
]
|
||||
|
||||
r_main = library('r_main', r_main_sources,
|
||||
include_directories: [platform_inc],
|
||||
c_args: library_cflags,
|
||||
dependencies: [
|
||||
r_config_dep,
|
||||
r_cons_dep,
|
||||
r_io_dep,
|
||||
r_util_dep,
|
||||
r_flag_dep,
|
||||
r_asm_dep,
|
||||
r_core_dep,
|
||||
r_debug_dep,
|
||||
r_hash_dep,
|
||||
r_bin_dep,
|
||||
r_lang_dep,
|
||||
r_io_dep,
|
||||
r_anal_dep,
|
||||
r_parse_dep,
|
||||
r_bp_dep,
|
||||
r_egg_dep,
|
||||
r_reg_dep,
|
||||
r_search_dep,
|
||||
r_syscall_dep,
|
||||
r_socket_dep,
|
||||
r_fs_dep,
|
||||
r_magic_dep,
|
||||
r_crypto_dep
|
||||
],
|
||||
dependencies: r_main_deps,
|
||||
install: true,
|
||||
implicit_include_directories: false,
|
||||
soversion: r2_libversion
|
||||
)
|
||||
|
||||
r_main_dep = declare_dependency(link_with: r_main,
|
||||
include_directories: [platform_inc])
|
||||
include_directories: [platform_inc],
|
||||
dependencies: r_main_deps)
|
||||
|
||||
pkgconfig_mod.generate(r_main,
|
||||
subdirs: 'libr',
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ r_util = library('r_util', r_util_sources,
|
|||
)
|
||||
|
||||
r_util_dep = declare_dependency(link_with: r_util,
|
||||
include_directories: platform_inc)
|
||||
include_directories: platform_inc,
|
||||
dependencies: r_util_deps)
|
||||
|
||||
pkgconfig_mod.generate(r_util,
|
||||
subdirs: 'libr',
|
||||
|
|
|
|||
26
meson.build
26
meson.build
|
|
@ -435,17 +435,21 @@ subdir('libr/main')
|
|||
|
||||
if not meson.is_subproject()
|
||||
rpath = get_option('local') and get_option('default_library') == 'shared' ? '$ORIGIN/../' + get_option('libdir') : ''
|
||||
subdir('binr/rahash2')
|
||||
subdir('binr/rarun2')
|
||||
subdir('binr/rasm2')
|
||||
subdir('binr/rabin2')
|
||||
subdir('binr/radare2')
|
||||
subdir('binr/ragg2')
|
||||
subdir('binr/r2agent')
|
||||
subdir('binr/radiff2')
|
||||
subdir('binr/rafind2')
|
||||
subdir('binr/rasign2')
|
||||
subdir('binr/rax2')
|
||||
if get_option('blob')
|
||||
subdir('binr/blob')
|
||||
else
|
||||
subdir('binr/rahash2')
|
||||
subdir('binr/rarun2')
|
||||
subdir('binr/rasm2')
|
||||
subdir('binr/rabin2')
|
||||
subdir('binr/radare2')
|
||||
subdir('binr/ragg2')
|
||||
subdir('binr/r2agent')
|
||||
subdir('binr/radiff2')
|
||||
subdir('binr/rafind2')
|
||||
subdir('binr/rasign2')
|
||||
subdir('binr/rax2')
|
||||
endif
|
||||
subdir('binr/r2pm')
|
||||
subdir('binr/r2r')
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
option('static_runtime', type: 'boolean', value: false)
|
||||
option('local', type: 'boolean', value: false, description: 'Adds support for local/side-by-side installation (sets rpath if needed)')
|
||||
option('blob', type: 'boolean', value: false, description: 'Compile just one binary which dispatch to the right handlers based on the name used to call it')
|
||||
|
||||
# For Windows
|
||||
option('r2_libdir', type: 'string', value: '')
|
||||
|
|
|
|||
|
|
@ -199,15 +199,20 @@ sdb_dep = declare_dependency(
|
|||
)
|
||||
|
||||
# Create sdb_version.h
|
||||
sdb_version = '1.2.0'
|
||||
r = run_command(py3_exe, 'sys/sdb_version.py', 'sdb/config.mk')
|
||||
if r.returncode() == 0
|
||||
sdb_version = r.stdout().strip().split('\n')[0]
|
||||
else
|
||||
sdb_version = 'unknown'
|
||||
endif
|
||||
run_command(py3_exe, '-c', 'with open("sdb/src/sdb_version.h", "w") as f: f.write("#define SDB_VERSION \"' + sdb_version + '\"")')
|
||||
|
||||
sdb_exe = executable('sdb', 'sdb/src/main.c',
|
||||
sdb_exe = executable('sdb', ['sdb/src/main.c'] + sdb_files,
|
||||
include_directories: [
|
||||
include_directories(['sdb/src'])
|
||||
],
|
||||
link_with: [libr2sdb],
|
||||
implicit_include_directories: false
|
||||
implicit_include_directories: false,
|
||||
native: true,
|
||||
)
|
||||
|
||||
sdb_gen_cmd_script = '''#script
|
||||
|
|
|
|||
11
sys/sdb_version.py
Normal file
11
sys/sdb_version.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
""" Portable python script to read version from configure.acr """
|
||||
|
||||
import sys
|
||||
|
||||
with open(sys.argv[1], 'r') as f:
|
||||
for l in f:
|
||||
if 'SDBVER=' in l:
|
||||
version = l.strip('\n').split('=')[1]
|
||||
sys.stdout.write(version + '\n')
|
||||
Loading…
Add table
Add a link
Reference in a new issue