diff --git a/config-user.mk.acr b/config-user.mk.acr index fb51f5c106..1a75ba0761 100644 --- a/config-user.mk.acr +++ b/config-user.mk.acr @@ -19,6 +19,7 @@ MKPLUGINS=mk/stat.mk mk/sloc.mk COMPILER=@USERCC@ STATIC_DEBUG=0 RUNTIME_DEBUG=1 +HAVE_CPARSE=@CPARSE@ INSTALL_DIR=@INSTALL_DIR@ INSTALL_DATA=@INSTALL_DATA@ diff --git a/configure b/configure index c7dd957176..4b9d87918a 100755 --- a/configure +++ b/configure @@ -17,6 +17,7 @@ control_c() { exit 1 } trap control_c 2 +CPARSE=0 DEBUGGER=1 USE_MAGIC=0 HAVE_EWF=1 @@ -149,8 +150,10 @@ System types: --target=TARGET configure for building compilers for TARGET [HOST] EOF2 -printf "\nOptional Features: - --without-debugger disable native debugger features +printf " +Optional Features: + --enable-cparse build with cparse support + --disable-debugger disable native debugger features --with-sysmagic force to use system's magic --without-ewf disable EWF dependency --without-gmp disable GMP dependency @@ -162,8 +165,10 @@ printf "\nOptional Features: --with-ostype Choose OS type ( gnulinux windows darwin ) (USEROSTYPE=auto) --without-pic do not build libr as a program independent location --with-nonpic build the library archives .a - --with-libversion specify different libversion (LIBVERSION=xxx)\n" -printf "\nSome influential environment variables: + --with-libversion specify different libversion (LIBVERSION=xxx) +" +printf " +Some influential environment variables: CC C compiler command CFLAGS C compiler flags CPPFLAGS C preprocessor flags @@ -171,8 +176,10 @@ printf "\nSome influential environment variables: nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory - CPP C preprocessor\n" -printf "\nReport bugs to: pancake " + CPP C preprocessor +" +printf " +Report bugs to: pancake " echo "" exit 0 } @@ -214,7 +221,7 @@ echo "LANGS: c" echo "REQUIRED: libdl" echo "OPTIONAL: libmagic" echo "PKG-CONFIG: libewf openssl" -echo "FLAGS: --without-debugger --with-sysmagic --without-ewf --without-gmp --without-ssl --with-rpath --with-little-endian --with-big-endian --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=xxx" +echo "FLAGS: --enable-cparse --disable-debugger --with-sysmagic --without-ewf --without-gmp --without-ssl --with-rpath --with-little-endian --with-big-endian --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=xxx" exit 0 ;; "--cache-file") @@ -256,7 +263,8 @@ echo "FLAGS: --without-debugger --with-sysmagic --without-ewf --without-gmp "--mandir") MANDIR="$value"; ;; -"--without-debugger") DEBUGGER="0"; ;; +"--enable-cparse") CPARSE="1"; ;; +"--disable-debugger") DEBUGGER="0"; ;; "--with-sysmagic") USE_MAGIC="1"; ;; "--without-ewf") HAVE_EWF="0"; ;; "--without-gmp") HAVE_GMP="0"; ;; @@ -286,7 +294,7 @@ parse_options $1 shift done -ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR 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 PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC LIBMAGIC HAVE_FLEX FLEX HAVE_LIB_EWF EWF_CFLAGS EWF_LDFLAGS HAVE_PKGCFG_LIBEWF HAVE_EWF HAVE_LIB_GMP HAVE_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL USE_RPATH HAVE_LILEND HAVE_BIGEND HAVE_LIB_LUA5_1 HAVE_LIB_TCC USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION" +ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR SYSCONFDIR DATADIR 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 PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C CPARSE DEBUGGER HAVE_LIB_DL DL_LIBS LIL_ENDIAN BIG_ENDIAN BYTEORDER HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC LIBMAGIC HAVE_FLEX FLEX HAVE_LIB_EWF EWF_CFLAGS EWF_LDFLAGS HAVE_PKGCFG_LIBEWF HAVE_EWF HAVE_LIB_GMP HAVE_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL USE_RPATH HAVE_LILEND HAVE_BIGEND HAVE_LIB_LUA5_1 HAVE_LIB_TCC USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION" create_environ diff --git a/configure.acr b/configure.acr index a0aadf6ade..09a86d0e40 100644 --- a/configure.acr +++ b/configure.acr @@ -4,7 +4,8 @@ CONTACT pancake ; pancake@nopcode.org LANG_C! -ARG_WITHOUT DEBUGGER debugger disable native debugger features ; +ARG_ENABLE CPARSE cparse build with cparse support ; +ARG_DISABLE DEBUGGER debugger disable native debugger features ; (( -ldl -dynamic ... )) USE_DL diff --git a/libr/anal/Makefile b/libr/anal/Makefile index c93b31a8de..0d17cb3b19 100644 --- a/libr/anal/Makefile +++ b/libr/anal/Makefile @@ -4,6 +4,7 @@ NAME=r_anal EXTRA_CLEAN=clean2 DEPS=r_util r_db r_lib r_reg r_syscall r_diff # r_core (commented as it would be recursive) +CFLAGS*=HAVE_CPARSE=$(HAVE_CPARSE) CFLAGS+=-DCORELIB -Iarch -I$(TOP)/shlr include $(LTOP)/config.mk @@ -17,7 +18,9 @@ include ${STATIC_ANAL_PLUGINS} STATIC_OBJS=$(addprefix $(LTOP)/anal/p/,$(STATIC_OBJ)) OBJLIBS=meta.o reflines.o ref.o op.o fcn.o bb.o var.o anal.o cond.o value.o cc.o diff.o type.o fcnstore.o +ifeq ($(HAVE_CPARSE),1) CPARSE_OBJS=cparse/cparse.o cparse/lex.yy.o cparse/tree.o cparse/gen.o cparse/error.o cparse/symset.o cparse/pplex.o cparse/exptree.o cparse/pp.o +endif OBJ=${STATIC_OBJS} ${OBJLIBS} ${CPARSE_OBJS} diff --git a/libr/anal/type.c b/libr/anal/type.c index 7127bd24f8..e154e4eab1 100644 --- a/libr/anal/type.c +++ b/libr/anal/type.c @@ -217,6 +217,7 @@ R_API char* r_anal_type_to_str(RAnal *a, RAnalType *t, const char *sep) { return strdup (buf); } +#if HAVE_CPARSE // TODO: Add types to RList instead or RAnalType R_API RAnalType *r_anal_str_to_type(RAnal *a, const char* type) { RAnalType *tTree = R_NEW0 (RAnalType); @@ -302,6 +303,14 @@ R_API RAnalType *r_anal_type_loadfile(RAnal *a, const char *path) { } return tTree; } +#else +R_API RAnalType *r_anal_str_to_type(RAnal *a, const char* type) { + return NULL; +} +R_API RAnalType *r_anal_type_loadfile(RAnal *a, const char *path) { + return NULL; +} +#endif /* if value is null, undefine, if value is "" , defined*/ /* numeric values are parsed from strings */ diff --git a/libr/io/io.c b/libr/io/io.c index 11353d90ee..2d7013e1f4 100644 --- a/libr/io/io.c +++ b/libr/io/io.c @@ -94,6 +94,7 @@ R_API RIODesc *r_io_open(RIO *io, const char *file, int flags, int mode) { if (plugin && plugin->open) { desc = plugin->open (io, uri, flags, mode); if (io->redirect) { + // TODO: free desc if not null free ((void *)uri); uri = strdup (io->redirect); r_io_redirect (io, NULL);