Change build order as long as now bin depends on fs ##build

* Add bin.zip for meson builds
* bin.fs now uses the fs apis
This commit is contained in:
pancake 2022-09-15 00:23:21 +02:00
parent f1ea6b9c52
commit 18220d39df
12 changed files with 168 additions and 151 deletions

View File

@ -2,7 +2,7 @@ include ../config.mk
include ../../global.mk
NAME=r_bin
R2DEPS=r_util r_io r_socket r_magic r_hash r_syscall r_cons r_crypto
R2DEPS=r_util r_io r_socket r_magic r_hash r_syscall r_cons r_crypto r_fs
.PHONY: pre

View File

@ -3,8 +3,6 @@
#define R_LOG_ORIGIN "bin"
#include <r_bin.h>
#include <r_util.h>
#include <r_lib.h>
#include <config.h>
#include "i/private.h"

View File

@ -10,138 +10,138 @@ r_bin_sources = [
'bfilter.c',
'bfile.c',
'bobj.c',
join_paths('p','bin_any.c'),
join_paths('p','bin_art.c'),
join_paths('p','bin_avr.c'),
join_paths('p','bin_bf.c'),
join_paths('p','bin_bflt.c'),
join_paths('p','bin_bios.c'),
join_paths('p','bin_bootimg.c'),
join_paths('p','bin_cgc.c'),
join_paths('p','bin_coff.c'),
join_paths('p','bin_off.c'), # goff ibm
join_paths('p','bin_dbginfo_dex.c'),
join_paths('p','bin_dbginfo_elf.c'),
join_paths('p','bin_dbginfo_elf64.c'),
join_paths('p','bin_dex.c'),
join_paths('p','bin_dmp64.c'),
join_paths('p','bin_dol.c'),
join_paths('p','bin_dyldcache.c'),
join_paths('p','bin_elf.c'),
join_paths('p','bin_elf64.c'),
join_paths('p','bin_fs.c'),
join_paths('p','bin_java.c'),
join_paths('p','bin_ldr_linux.c'),
join_paths('p','bin_le.c'),
join_paths('p','bin_mach0.c'),
join_paths('p','bin_mach064.c'),
join_paths('p','bin_mbn.c'),
join_paths('p','bin_mdmp.c'),
join_paths('p','bin_menuet.c'),
join_paths('p','bin_mz.c'),
join_paths('p','bin_ne.c'),
join_paths('p','bin_nes.c'),
join_paths('p','bin_hunk.c'),
join_paths('p','bin_nin3ds.c'),
join_paths('p','bin_ninds.c'),
join_paths('p','bin_ningb.c'),
join_paths('p','bin_ningba.c'),
join_paths('p','bin_nro.c'),
join_paths('p','bin_nso.c'),
join_paths('p','bin_omf.c'),
join_paths('p','bin_p9.c'),
join_paths('p','bin_pe.c'),
join_paths('p','bin_pe64.c'),
join_paths('p','bin_pebble.c'),
join_paths('p','bin_prg.c'),
join_paths('p','bin_psxexe.c'),
join_paths('p','bin_pyc.c'),
join_paths('p','bin_qnx.c'),
join_paths('p','bin_rel.c'),
join_paths('p','bin_s390.c'),
join_paths('p','bin_sfc.c'),
join_paths('p','bin_smd.c'),
join_paths('p','bin_sms.c'),
join_paths('p','bin_symbols.c'),
join_paths('p','bin_te.c'),
join_paths('p','bin_vsf.c'),
join_paths('p','bin_wad.c'),
join_paths('p','bin_wasm.c'),
join_paths('p','bin_write_elf.c'),
join_paths('p','bin_write_elf64.c'),
join_paths('p','bin_write_mach0.c'),
join_paths('p','bin_write_mach064.c'),
join_paths('p','bin_write_pe.c'),
join_paths('p','bin_write_pe64.c'),
join_paths('p','bin_xbe.c'),
join_paths('p','bin_xnu_kernelcache.c'),
join_paths('p','bin_xtr_dyldcache.c'),
join_paths('p','bin_xtr_fatmach0.c'),
join_paths('p','bin_xtr_pemixed.c'),
join_paths('p','bin_xtr_sep64.c'),
join_paths('p','bin_xtr_xalz.c'),
join_paths('p','bin_z64.c'),
join_paths('p','bin_zimg.c'),
join_paths('format','bflt','bflt.c'),
join_paths('format','coff','coff.c'),
join_paths('format','dex','dex.c'),
join_paths('format','dmp','dmp64.c'),
join_paths('format','elf','elf.c'),
join_paths('format','elf','elf64.c'),
join_paths('format','elf','elf64_write.c'),
join_paths('format','elf','elf_write.c'),
join_paths('format','mach0','coresymbolication.c'),
join_paths('format','mach0','dyldcache.c'),
join_paths('format','mach0','fatmach0.c'),
join_paths('format','mach0','mach0.c'),
join_paths('format','mach0','mach064.c'),
join_paths('format','xnu','r_cf_dict.c'),
join_paths('format','mdmp','mdmp.c'),
join_paths('format','mdmp','mdmp_pe.c'),
join_paths('format','mdmp','mdmp_pe64.c'),
join_paths('format','le','le.c'),
join_paths('format','ne','ne.c'),
join_paths('format','mz','mz.c'),
join_paths('format','nxo','nxo.c'),
join_paths('format','objc','mach064_classes.c'),
join_paths('format','objc','mach0_classes.c'),
join_paths('format','omf','omf.c'),
join_paths('format','p9','p9bin.c'),
join_paths('format','pe','pe.c'),
join_paths('format','pe','pe64.c'),
join_paths('format','pe','pe64_write.c'),
join_paths('format','pe','pe_write.c'),
join_paths('format','pe','pemixed.c'),
join_paths('format','pyc','marshal.c'),
join_paths('format','pyc','pyc.c'),
join_paths('format','pyc','pyc_magic.c'),
join_paths('format','te','te.c'),
join_paths('format','wasm','wasm.c'),
join_paths('format','zimg','zimg.c'),
join_paths('format/pdb','dbi.c'),
join_paths('format/pdb','fpo.c'),
join_paths('format/pdb','gdata.c'),
join_paths('format/pdb','omap.c'),
join_paths('format/pdb','pdb.c'),
join_paths('format/pdb','pdb_downloader.c'),
join_paths('format/pdb','stream_file.c'),
join_paths('format/pdb','stream_pe.c'),
join_paths('format/pdb','tpi.c'),
join_paths('mangling','cxx.c'),
join_paths('mangling','pascal.c'),
join_paths('mangling','cxx','cp-demangle.c'),
join_paths('mangling','demangler.c'),
join_paths('mangling','rust.c'),
join_paths('mangling','java.c'),
join_paths('mangling','microsoft_demangle.c'),
join_paths('mangling','msvc.c'),
join_paths('mangling','objc.c'),
join_paths('mangling','swift-sd.c'),
join_paths('mangling','swift.c')
# plugins
'p/bin_any.c',
'p/bin_art.c',
'p/bin_avr.c',
'p/bin_bf.c',
'p/bin_bflt.c',
'p/bin_bios.c',
'p/bin_bootimg.c',
'p/bin_cgc.c',
'p/bin_coff.c',
'p/bin_off.c', # goff ibm
'p/bin_dbginfo_dex.c',
'p/bin_dbginfo_elf.c',
'p/bin_dbginfo_elf64.c',
'p/bin_dex.c',
'p/bin_dmp64.c',
'p/bin_dol.c',
'p/bin_dyldcache.c',
'p/bin_elf.c',
'p/bin_elf64.c',
'p/bin_fs.c',
'p/bin_java.c',
'p/bin_ldr_linux.c',
'p/bin_le.c',
'p/bin_mach0.c',
'p/bin_mach064.c',
'p/bin_mbn.c',
'p/bin_mdmp.c',
'p/bin_menuet.c',
'p/bin_mz.c',
'p/bin_ne.c',
'p/bin_nes.c',
'p/bin_hunk.c',
'p/bin_nin3ds.c',
'p/bin_ninds.c',
'p/bin_ningb.c',
'p/bin_ningba.c',
'p/bin_nro.c',
'p/bin_nso.c',
'p/bin_omf.c',
'p/bin_p9.c',
'p/bin_pe.c',
'p/bin_pe64.c',
'p/bin_pebble.c',
'p/bin_prg.c',
'p/bin_psxexe.c',
'p/bin_pyc.c',
'p/bin_qnx.c',
'p/bin_rel.c',
'p/bin_s390.c',
'p/bin_sfc.c',
'p/bin_smd.c',
'p/bin_sms.c',
'p/bin_symbols.c',
'p/bin_te.c',
'p/bin_vsf.c',
'p/bin_wad.c',
'p/bin_wasm.c',
'p/bin_write_elf.c',
'p/bin_write_elf64.c',
'p/bin_write_mach0.c',
'p/bin_write_mach064.c',
'p/bin_write_pe.c',
'p/bin_write_pe64.c',
'p/bin_xbe.c',
'p/bin_xnu_kernelcache.c',
'p/bin_xtr_dyldcache.c',
'p/bin_xtr_fatmach0.c',
'p/bin_xtr_pemixed.c',
'p/bin_xtr_sep64.c',
'p/bin_xtr_xalz.c',
'p/bin_z64.c',
'p/bin_zimg.c',
# implementation
'format/bflt/bflt.c',
'format/coff/coff.c',
'format/dex/dex.c',
'format/dmp/dmp64.c',
'format/elf/elf.c',
'format/elf/elf64.c',
'format/elf/elf64_write.c',
'format/elf/elf_write.c',
'format/mach0/coresymbolication.c',
'format/mach0/dyldcache.c',
'format/mach0/fatmach0.c',
'format/mach0/mach0.c',
'format/mach0/mach064.c',
'format/xnu/r_cf_dict.c',
'format/mdmp/mdmp.c',
'format/mdmp/mdmp_pe.c',
'format/mdmp/mdmp_pe64.c',
'format/le/le.c',
'format/ne/ne.c',
'format/mz/mz.c',
'format/nxo/nxo.c',
'format/objc/mach064_classes.c',
'format/objc/mach0_classes.c',
'format/omf/omf.c',
'format/p9/p9bin.c',
'format/pe/pe.c',
'format/pe/pe64.c',
'format/pe/pe64_write.c',
'format/pe/pe_write.c',
'format/pe/pemixed.c',
'format/pyc/marshal.c',
'format/pyc/pyc.c',
'format/pyc/pyc_magic.c',
'format/te/te.c',
'format/wasm/wasm.c',
'format/zimg/zimg.c',
# pdb microsoft format
'format/pdb/dbi.c',
'format/pdb/fpo.c',
'format/pdb/gdata.c',
'format/pdb/omap.c',
'format/pdb/pdb.c',
'format/pdb/pdb_downloader.c',
'format/pdb/stream_file.c',
'format/pdb/stream_pe.c',
'format/pdb/tpi.c',
# symbol name manglers
'mangling/cxx.c',
'mangling/cxx/cp-demangle.c',
'mangling/pascal.c',
'mangling/demangler.c',
'mangling/rust.c',
'mangling/java.c',
'mangling/microsoft_demangle.c',
'mangling/msvc.c',
'mangling/objc.c',
'mangling/swift-sd.c',
'mangling/swift.c'
]
r_bin_sources += r_bin_d_sources
@ -155,6 +155,7 @@ r_bin = library('r_bin', r_bin_sources,
r_util_dep,
r_cons_dep,
r_io_dep,
r_fs_dep,
r_hash_dep,
r_magic_dep,
r_socket_dep,
@ -180,6 +181,7 @@ r_bin_static = static_library('r_bin_static', r_bin_sources,
r_util_static_dep,
r_cons_static_dep,
r_io_static_dep,
r_fs_static_dep,
r_hash_static_dep,
r_magic_static_dep,
r_socket_static_dep,
@ -204,6 +206,7 @@ pkgconfig_mod.generate(r_bin,
libraries: pkgcfg_sanitize_libs,
requires: pkgconfig_magic_requires + [
'r_util',
'r_fs',
'r_io',
'r_socket',
'r_syscall'

View File

@ -1,17 +1,17 @@
/* radare - LGPL - Copyright 2011-2019 - pancake */
/* radare - LGPL - Copyright 2011-2022 - pancake */
#include <r_types.h>
#include <r_util.h>
#include <r_lib.h>
#include <r_bin.h>
#include "../../fs/types.h"
#include <r_fs.h>
static char *fsname(RBuffer *b) {
ut8 buf[1024];
int i, j;
for (i = 0; fstypes[i].name; i++) {
RFSType *f = &fstypes[i];
for (i = 0; ; i++) {
const RFSType *f = r_fs_type_index (i);
if (!f || !f->name) {
break;
}
if (r_buf_read_at (b, f->bufoff, buf, sizeof (buf)) != sizeof (buf)) {
break;

View File

@ -1,5 +1,7 @@
/* radare2 - LGPL - Copyright 2011-2022 - pancake */
#define R_LOG_ORIGIN "fs"
#include <r_fs.h>
#include <config.h>
@ -31,6 +33,13 @@ static const RFSType fstypes[] = {
{ NULL }
};
R_API R_MUSTUSE const RFSType* r_fs_type_index(int i) {
if (i < 0 || i >= R_ARRAY_SIZE (fstypes)) {
return NULL;
}
return &fstypes[i];
}
R_API R_MUSTUSE RFS* r_fs_new(void) {
int i;
RFSPlugin* static_plugin;

View File

@ -1,4 +1,6 @@
/* radare - LGPL - Copyright 2011-2019 - pancake */
/* radare - LGPL - Copyright 2011-2022 - pancake */
#define R_LOG_ORIGIN "fs.file"
#include <r_fs.h>

View File

@ -1,8 +1,8 @@
/* radare2 - LGPL - Copyright 2018-2022 - pancake */
#include <r_fs.h>
#define R_LOG_ORIGIN "fs.shell"
#define PROMPT_PATH_BUFSIZE 1024
#include <r_fs.h>
static bool handlePipes(RFS *fs, char *msg, const ut8 *data, const char *cwd) {
char *red = strchr (msg, '>');
@ -264,6 +264,8 @@ static bool r_fs_shell_command(RFSShell *shell, RFS *fs, const char *buf) {
return true;
}
#define PROMPT_PATH_BUFSIZE 1024
R_API bool r_fs_shell(RFSShell* shell, RFS* fs, const char* root) {
r_return_val_if_fail (shell && fs, false);
if (R_STR_ISNOTEMPTY (root)) {

View File

@ -4,10 +4,11 @@ r_fs_sources = [
'fs_shell.c',
'p/fs_io.c',
'p/fs_posix.c',
'p/fs_zip.c',
'p/fs_r2.c',
]
r_fs_deps = [ r_util_dep ]
r_fs_deps = [ r_util_dep, zip_dep ]
r_fs_cflags = [ library_cflags ]
if get_option('blob')
r_fs_static_deps = [ r_util_static_dep ]

View File

@ -154,6 +154,8 @@ R_API RList *r_fs_find_name(RFS* fs, const char *name, const char *glob);
R_API RList *r_fs_find_off(RFS* fs, const char *name, ut64 off);
R_API RList *r_fs_partitions(RFS* fs, const char *ptype, ut64 delta);
R_API R_MUSTUSE const RFSType *r_fs_type_index(int i);
R_API char *r_fs_name(RFS *fs, ut64 offset);
R_API bool r_fs_check(RFS *fs, const char *p);
R_API bool r_fs_shell(RFSShell *shell, RFS *fs, const char *root);

View File

@ -5,8 +5,8 @@ LIBS0=util
LIBS1=socket hash reg cons magic bp search config
LIBS2=syscall lang crypto flag
LIBS3=parse io
LIBS4=fs asm bin
LIBS5=anal egg
LIBS4=asm fs
LIBS5=anal egg bin
LIBS6=debug
LIBS7=core
LIBS8=main

View File

@ -9,7 +9,7 @@ bin_plugins = [ 'any' ]
bin_ldr_plugins = [ 'ldr_linux' ]
bin_xtr_plugins = [ 'xtr_sep64' ]
io_plugins = [ 'malloc', 'xattr', 'fd', 'default', 'null', 'rbuf', 'r2pipe' , 'r2pipe']
fs_plugins = [ 'r2', 'posix', 'io' ]
fs_plugins = [ 'r2', 'posix', 'io', 'zip' ]
bp_plugins = [ 'bf' ]
crypto_plugins = [ 'xor', 'punycode' ]
core_plugins = [ 'a2f' ]

View File

@ -589,6 +589,7 @@ subdir('libr/search')
subdir('libr/magic')
subdir('libr/flag')
subdir('libr/reg')
subdir('libr/fs')
subdir('libr/bin')
subdir('libr/config')
subdir('libr/parse')
@ -596,7 +597,6 @@ subdir('libr/lang')
subdir('libr/asm')
subdir('libr/anal')
subdir('libr/egg')
subdir('libr/fs')
subdir('libr/debug')
subdir('libr/core')
subdir('libr/cons/d')
@ -610,7 +610,6 @@ if meson.is_subproject()
dependencies: [
r_anal_dep,
r_asm_dep,
r_bin_dep,
r_bp_dep,
r_config_dep,
r_cons_dep,
@ -621,6 +620,7 @@ if meson.is_subproject()
r_egg_dep,
r_flag_dep,
r_fs_dep,
r_bin_dep,
r_hash_dep,
r_io_dep,
r_lang_dep,