mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-26 22:50:48 +00:00
Build fs.squashfs with the make build system too ##fs
This commit is contained in:
parent
2434c5d501
commit
95501f36ad
@ -14,6 +14,10 @@ DOCDIR=@DOCDIR@
|
||||
DATADIR=@DATADIR@
|
||||
INCLUDEDIR=@INCLUDEDIR@
|
||||
|
||||
R2_USE_SQSH=@USE_SQSH@
|
||||
SQSH_CFLAGS=@SQSH_CFLAGS@
|
||||
SQSH_LDFLAGS=@SQSH_LDFLAGS@
|
||||
|
||||
HAVE_LIB_GMP=@HAVE_LIB_GMP@
|
||||
USE_RPATH=@USE_RPATH@
|
||||
HAVE_JEMALLOC=@HAVE_JEMALLOC@
|
||||
|
27
configure
vendored
27
configure
vendored
@ -35,6 +35,7 @@ USE_CS5=0
|
||||
USE_CS4=0
|
||||
WITH_CAPSTONE=0
|
||||
WITHOUT_SYSCAPSTONE=1
|
||||
WITH_SQSH=1
|
||||
WITH_SYSLZ4=0
|
||||
USE_ZIP=0
|
||||
USE_XXHASH=0
|
||||
@ -210,6 +211,7 @@ Optional Features:
|
||||
--with-capstone4 build v4 branch of capstone
|
||||
--with-syscapstone force to use system-wide capstone
|
||||
--without-syscapstone avoid the system-wide capstone
|
||||
--without-sqsh ensure squashfs support is not included, even if library is found
|
||||
--with-syslz4 force to use system's liblz4
|
||||
--with-syszip force to use system's libzip and zlib
|
||||
--with-sysxxhash force to use system's xxhash
|
||||
@ -300,8 +302,8 @@ echo "DESCRIPTION: The UNIX-like reverse engineering toolkit"
|
||||
echo "LANGS: c"
|
||||
echo "REQUIRED: libdl"
|
||||
echo "OPTIONAL: libmagic libz libzip libxxhash libssl liblibuv>=1.0.0"
|
||||
echo "PKGCONFIG: capstone liblz4 openssl libuv"
|
||||
echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-loadlibs --enable-threadsafety --without-dylink --without-fork --without-ptrace-wrap --without-gperf --without-capstone --with-libr --with-static-themes --with-capstone-next --with-capstone5 --with-capstone4 --with-syscapstone --without-syscapstone --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-ssl --with-ssl-crypto --with-libuv --with-new-abi --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2 --disable-debug-stuff"
|
||||
echo "PKGCONFIG: capstone libsqsh liblz4 openssl libuv"
|
||||
echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-loadlibs --enable-threadsafety --without-dylink --without-fork --without-ptrace-wrap --without-gperf --without-capstone --with-libr --with-static-themes --with-capstone-next --with-capstone5 --with-capstone4 --with-syscapstone --without-syscapstone --without-sqsh --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-ssl --with-ssl-crypto --with-libuv --with-new-abi --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2 --disable-debug-stuff"
|
||||
exit 0
|
||||
;;
|
||||
--cache-file)
|
||||
@ -370,6 +372,7 @@ echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disabl
|
||||
"--with-capstone4") USE_CS4="1"; ;;
|
||||
"--with-syscapstone") WITH_CAPSTONE="1"; ;;
|
||||
"--without-syscapstone") WITHOUT_SYSCAPSTONE="0"; ;;
|
||||
"--without-sqsh") WITH_SQSH="0"; ;;
|
||||
"--with-syslz4") WITH_SYSLZ4="1"; ;;
|
||||
"--with-syszip") USE_ZIP="1"; ;;
|
||||
"--with-sysxxhash") USE_XXHASH="1"; ;;
|
||||
@ -402,7 +405,7 @@ parse_options "$1"
|
||||
shift
|
||||
done
|
||||
|
||||
ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG R2_BUILDSYSTEM HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC HAVE_LINUX_CAN_H USE_MAGIC USE_LIB_MAGIC LIBMAGIC WANT_THREADS LOADLIBS R_CRITICAL_ENABLED WANT_DYLINK HAVE_FORK WANT_PTRACE_WRAP WANT_GPERF WANT_CAPSTONE WITH_LIBR WITH_STATIC_THEMES USE_CSNEXT USE_CS5 USE_CS4 WITH_CAPSTONE WITHOUT_SYSCAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE LZ4_CFLAGS LZ4_LDFLAGS HAVE_PKGCFG_LIBLZ4 WITH_SYSLZ4 USE_SYSLZ4 HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP HAVE_LIB_XXHASH USE_XXHASH USE_LIB_XXHASH LIBXXHASH WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_DECL___GLIBC__ HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO HAVE_EXPLICIT_MEMSET HAVE_CLOCK_NANOSLEEP HAVE_SIGACTION HAVE_CLOCK_GETTIME CLOCK_LDFLAGS SUPPORT_GNU99 HAVE_LIB_GMP WANT_SSL WANT_SSL_CRYPTO HAVE_OPENSSL SSL_CFLAGS SSL_LDFLAGS HAVE_LIB_SSL HAVE_PKGCFG_OPENSSL WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_NEW_ABI USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL WANT_DEBUGSTUFF"
|
||||
ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG R2_BUILDSYSTEM HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC HAVE_LINUX_CAN_H USE_MAGIC USE_LIB_MAGIC LIBMAGIC WANT_THREADS LOADLIBS R_CRITICAL_ENABLED WANT_DYLINK HAVE_FORK WANT_PTRACE_WRAP WANT_GPERF WANT_CAPSTONE WITH_LIBR WITH_STATIC_THEMES USE_CSNEXT USE_CS5 USE_CS4 WITH_CAPSTONE WITHOUT_SYSCAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE SQSH_CFLAGS SQSH_LDFLAGS HAVE_PKGCFG_LIBSQSH WITH_SQSH USE_SQSH LZ4_CFLAGS LZ4_LDFLAGS HAVE_PKGCFG_LIBLZ4 WITH_SYSLZ4 USE_SYSLZ4 HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP HAVE_LIB_XXHASH USE_XXHASH USE_LIB_XXHASH LIBXXHASH WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_DECL___GLIBC__ HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO HAVE_EXPLICIT_MEMSET HAVE_CLOCK_NANOSLEEP HAVE_SIGACTION HAVE_CLOCK_GETTIME CLOCK_LDFLAGS SUPPORT_GNU99 HAVE_LIB_GMP WANT_SSL WANT_SSL_CRYPTO HAVE_OPENSSL SSL_CFLAGS SSL_LDFLAGS HAVE_LIB_SSL HAVE_PKGCFG_OPENSSL WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_NEW_ABI USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL WANT_DEBUGSTUFF"
|
||||
|
||||
create_environ
|
||||
|
||||
@ -668,6 +671,22 @@ HAVE_PKGCFG_CAPSTONE="0"
|
||||
CAPSTONE_CFLAGS=""
|
||||
CAPSTONE_LDFLAGS=""; fi
|
||||
if [ -z "${PKGCONFIG}" ]; then pkg-config --version >/dev/null 2>&1 ; if [ 0 = 0 ]; then PKGCONFIG=pkg-config ; else PKGCONFIG=pkgconf ; fi; fi
|
||||
printf 'checking pkg-config flags for libsqsh... '
|
||||
tmp=`${PKGCONFIG} --cflags libsqsh 2>/dev/null`
|
||||
if [ $? != 0 ]; then echo no ; HAVE_PKGCFG_LIBSQSH=0;
|
||||
SQSH_CFLAGS='';SQSH_LDFLAGS='';
|
||||
else
|
||||
SQSH_CFLAGS=$tmp;
|
||||
tmp=`${PKGCONFIG} --libs libsqsh 2>/dev/null`
|
||||
if [ $? = 0 ]; then
|
||||
echo yes; HAVE_PKGCFG_LIBSQSH=1;
|
||||
SQSH_LDFLAGS=$tmp; fi; fi
|
||||
if [ 11 = "$WITH_SQSH$HAVE_PKGCFG_LIBSQSH" ]; then
|
||||
|
||||
USE_SQSH="1"
|
||||
else
|
||||
USE_SQSH="0"; fi
|
||||
if [ -z "${PKGCONFIG}" ]; then pkg-config --version >/dev/null 2>&1 ; if [ 0 = 0 ]; then PKGCONFIG=pkg-config ; else PKGCONFIG=pkgconf ; fi; fi
|
||||
printf 'checking pkg-config flags for liblz4... '
|
||||
tmp=`${PKGCONFIG} --cflags liblz4 2>/dev/null`
|
||||
if [ $? != 0 ]; then echo no ; HAVE_PKGCFG_LIBLZ4=0;
|
||||
@ -1002,7 +1021,7 @@ do_remove
|
||||
if [ "$QUIET" = 0 ]; then
|
||||
echo
|
||||
echo "Final report:"
|
||||
for A in BUILD CC CFLAGS DEBUGGER HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO USE_NEW_ABI HAVE_EXPLICIT_MEMSET HAVE_FORK HAVE_GPERF HAVE_LIBUV HAVE_LIB_GMP WANT_DEBUGSTUFF HAVE_OPENSSL WANT_SSL_CRYPTO HAVE_PTRACE HOST LDFLAGS LIBVERSION PKGCONFIG PREFIX R_CHECKS_LEVEL TARGET USERCC USEROSTYPE USE_CAPSTONE USE_LIB_MAGIC NEW_IO_CACHE USE_LIB_XXHASH USE_LIB_ZIP USE_PTRACE_WRAP USE_SYSLZ4 VERSION WANT_DYLINK USE_SMALLZ4 ; do
|
||||
for A in BUILD CC CFLAGS DEBUGGER HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO USE_NEW_ABI HAVE_EXPLICIT_MEMSET HAVE_FORK HAVE_GPERF HAVE_LIBUV HAVE_LIB_GMP WANT_DEBUGSTUFF HAVE_OPENSSL WANT_SSL_CRYPTO HAVE_PTRACE HOST LDFLAGS LIBVERSION PKGCONFIG PREFIX R_CHECKS_LEVEL TARGET USERCC USEROSTYPE USE_CAPSTONE USE_LIB_MAGIC NEW_IO_CACHE USE_SQSH USE_LIB_XXHASH USE_LIB_ZIP USE_PTRACE_WRAP USE_SYSLZ4 VERSION WANT_DYLINK USE_SMALLZ4 ; do
|
||||
eval VAL="\$${A}"
|
||||
[ -z "${VAL}" ] && VAL="\"\""
|
||||
echo " - ${A} = ${VAL}"
|
||||
|
@ -73,6 +73,15 @@ IFNOT WITHOUT_SYSCAPSTONE {
|
||||
CAPSTONE_LDFLAGS = "" ;
|
||||
}
|
||||
|
||||
(( SQSH ))
|
||||
PKGCFG SQSH_CFLAGS SQSH_LDFLAGS libsqsh
|
||||
ARG_WITHOUT WITH_SQSH sqsh ensure squashfs support is not included, even if library is found ;
|
||||
IFAND WITH_SQSH HAVE_PKGCFG_LIBSQSH {
|
||||
USE_SQSH = 1 ;
|
||||
}{
|
||||
USE_SQSH = 0 ;
|
||||
}
|
||||
|
||||
(( LZ4 ))
|
||||
PKGCFG LZ4_CFLAGS LZ4_LDFLAGS liblz4
|
||||
ARG_WITH WITH_SYSLZ4 syslz4 force to use system's liblz4 ;
|
||||
@ -301,7 +310,7 @@ REPORT
|
||||
BUILD CC CFLAGS DEBUGGER HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO USE_NEW_ABI
|
||||
HAVE_EXPLICIT_MEMSET HAVE_FORK HAVE_GPERF HAVE_LIBUV HAVE_LIB_GMP WANT_DEBUGSTUFF
|
||||
HAVE_OPENSSL WANT_SSL_CRYPTO HAVE_PTRACE HOST LDFLAGS LIBVERSION PKGCONFIG PREFIX
|
||||
R_CHECKS_LEVEL TARGET USERCC USEROSTYPE USE_CAPSTONE USE_LIB_MAGIC NEW_IO_CACHE
|
||||
R_CHECKS_LEVEL TARGET USERCC USEROSTYPE USE_CAPSTONE USE_LIB_MAGIC NEW_IO_CACHE USE_SQSH
|
||||
USE_LIB_XXHASH USE_LIB_ZIP USE_PTRACE_WRAP USE_SYSLZ4 VERSION WANT_DYLINK USE_SMALLZ4
|
||||
;
|
||||
|
||||
|
1
dist/plugins-cfg/plugins.def.cfg
vendored
1
dist/plugins-cfg/plugins.def.cfg
vendored
@ -206,6 +206,7 @@ esil.null
|
||||
esil.dummy
|
||||
esil.forth
|
||||
fs.ext2
|
||||
fs.squashfs
|
||||
fs.fat
|
||||
fs.fb
|
||||
fs.hfs
|
||||
|
@ -9,6 +9,10 @@ CFLAGS:=-I$(SHLR)/grub/include $(CFLAGS)
|
||||
ifeq ($(WITH_GPL),1)
|
||||
LDFLAGS+=$(SHLR)/grub/libgrubfs.a
|
||||
endif
|
||||
ifeq ($(R2_USE_SQSH),1)
|
||||
CFLAGS+=$(SQSH_CFLAGS)
|
||||
LDFLAGS+=$(SQSH_LDFLAGS)
|
||||
endif
|
||||
|
||||
EXTRA_TARGETS=plugins
|
||||
|
||||
@ -20,7 +24,7 @@ STATIC_OBJS=$(subst ..,p/..,$(subst fs_,p/fs_,$(STATIC_OBJ)))
|
||||
OBJS=${STATIC_OBJS} fs.o fs_file.o fs_shell.o
|
||||
|
||||
pre:
|
||||
cd d && ${MAKE}
|
||||
$(MAKE) -C d
|
||||
|
||||
re:
|
||||
rm -f fs.o libr_fs.so
|
||||
|
@ -12,8 +12,13 @@ all:
|
||||
#FILESYSTEMS=hfs.mk iso9660.mk jfs.mk
|
||||
#FILESYSTEMS=hfsplus.mk
|
||||
FILESYSTEMS=ext2.mk fat.mk ntfs.mk reiserfs.mk tar.mk udf.mk ufs2.mk ufs.mk xfs.mk hfs.mk
|
||||
FILESYSTEMS+=squashfs.mk
|
||||
include $(FILESYSTEMS)
|
||||
|
||||
ifeq ($(R2_USE_SQSH),1)
|
||||
CFLAGS+=$(SQSH_CFLAGS)
|
||||
LDFLAGS+=$(SQSH_LDFLAGS)
|
||||
endif
|
||||
clean:
|
||||
-rm -f *.${EXT_SO} *.o ${STATIC_OBJ}
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* radare - BSD2 - Copyright 2024 - Enno Boland */
|
||||
|
||||
#include <r_fs.h>
|
||||
#include <r_userconf.h>
|
||||
|
||||
#if R2_USE_SQSH
|
||||
#include <sqsh.h>
|
||||
|
||||
static char sqsh_to_r_type(enum SqshFileType type) {
|
||||
@ -38,6 +41,7 @@ static int fs_sqsh_mapper_init(
|
||||
sqsh_mapper_set_user_data (mapper, (void *)input);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fs_sqsh_mapper_map(
|
||||
const struct SqshMapper *mapper, sqsh_index_t offset, size_t size,
|
||||
uint8_t **data) {
|
||||
@ -57,6 +61,7 @@ static int fs_sqsh_mapper_map(
|
||||
*data = buf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fs_sqsh_mapper_cleanup(struct SqshMapper *mapper) {
|
||||
// Do nothing, cleanup happens in _umount.
|
||||
return 0;
|
||||
@ -251,3 +256,9 @@ R_API RLibStruct radare_plugin = {
|
||||
.version = R2_VERSION
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
RFSPlugin r_fs_plugin_squashfs = {
|
||||
.meta = {0}, 0
|
||||
};
|
||||
#endif
|
||||
|
14
libr/fs/p/squashfs.mk
Normal file
14
libr/fs/p/squashfs.mk
Normal file
@ -0,0 +1,14 @@
|
||||
# ifeq ($(R2_USE_SQSH),1)
|
||||
OBJ_SQUASHFS=fs_squashfs.o
|
||||
CFLAGS+=$(SQSH_CFLAGS)
|
||||
EXTRA+=$(SQSH_CFLAGS)
|
||||
|
||||
STATIC_OBJ+=${OBJ_SQUASHFS}
|
||||
#STATIC_OBJ+=${EXTRA}
|
||||
TARGET_SQUASHFS=fs_squashfs.${EXT_SO}
|
||||
|
||||
ALL_TARGETS+=${TARGET_SQUASHFS}
|
||||
|
||||
${TARGET_SQUASHFS}: ${OBJ_SQUASHFS}
|
||||
${CC} $(call libname,fs_squashfs) ${LDFLAGS} ${CFLAGS} -o ${TARGET_SQUASHFS} ${OBJ_SQUASHFS} ${EXTRA}
|
||||
# endif
|
@ -21,6 +21,7 @@ extern "C" {
|
||||
#define WANT_CAPSTONE @WANT_CAPSTONE@
|
||||
#define HAVE_LINUX_CAN_H @HAVE_LINUX_CAN_H@
|
||||
#define R2_USE_NEW_ABI @USE_NEW_ABI@
|
||||
#define R2_USE_SQSH @USE_SQSH@
|
||||
|
||||
#define R_BUILDSYSTEM "@R2_BUILDSYSTEM@"
|
||||
#if @USE_CS4@ == 1
|
||||
|
@ -329,6 +329,7 @@ else
|
||||
message('Not using libuv, thus using fallback server implementations')
|
||||
endif
|
||||
|
||||
use_libsqsh = false
|
||||
if get_option('use_libsqsh')
|
||||
libsqsh_dep = dependency('libsqsh', version: '>=1.4.0', required: false)
|
||||
use_libsqsh = libsqsh_dep.found()
|
||||
@ -398,6 +399,7 @@ userconf.set('PLUGINS', r2_plugins)
|
||||
userconf.set('EXTRAS', r2_extras)
|
||||
userconf.set('BINDINGS', r2_bindings)
|
||||
userconf.set('R2_BUILDSYSTEM', 'meson')
|
||||
userconf.set10('USE_SQSH', use_libsqsh)
|
||||
capstone_version = get_option('use_capstone_version')
|
||||
userconf.set10('USE_CS4', capstone_version == 'v4')
|
||||
userconf.set10('USE_CSNEXT', capstone_version == 'v6')
|
||||
|
Loading…
Reference in New Issue
Block a user