mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-06 18:13:46 +00:00
Add support for statically compiled themes ##cons
This commit is contained in:
parent
80a5b3f787
commit
b47140ea8d
@ -18,6 +18,7 @@ HAVE_JEMALLOC=@HAVE_JEMALLOC@
|
||||
HAVE_FORK=@HAVE_FORK@
|
||||
WANT_DYLINK=@WANT_DYLINK@
|
||||
WANT_CAPSTONE=@WANT_CAPSTONE@
|
||||
WITH_STATIC_THEMES=@WITH_STATIC_THEMES@
|
||||
WITH_LIBR=@WITH_LIBR@
|
||||
|
||||
ifeq ($(USE_RPATH),1)
|
||||
|
9
configure
vendored
9
configure
vendored
@ -29,6 +29,7 @@ WANT_PTRACE_WRAP=1
|
||||
WANT_GPERF=1
|
||||
WANT_CAPSTONE=1
|
||||
WITH_LIBR=0
|
||||
WITH_STATIC_THEMES=0
|
||||
USE_CS5=0
|
||||
USE_CS4=0
|
||||
WITH_CAPSTONE=0
|
||||
@ -193,8 +194,9 @@ Optional Features:
|
||||
--without-fork disable fork
|
||||
--without-ptrace-wrap build ptrace-wrap support needed for the iaito debugger on Linux
|
||||
--without-gperf do not statically link the sdb databases even if gperf is found
|
||||
--without-capstone don't build the capstone dependency
|
||||
--without-capstone dont build the capstone dependency
|
||||
--with-libr build libr.a and libr.dylib
|
||||
--with-static-themes default themes are compiled and fallback if not available on disk
|
||||
--with-capstone5 build next branch of capstone5 (default)
|
||||
--with-capstone4 build v4 branch of capstone
|
||||
--with-syscapstone force to use system-wide capstone
|
||||
@ -283,7 +285,7 @@ echo "LANGS: c"
|
||||
echo "REQUIRED: libdl"
|
||||
echo "OPTIONAL: libmagic libz libzip libxxhash libssl liblibuv>=1.0.0"
|
||||
echo "PKG-CONFIG: 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-capstone5 --with-capstone4 --with-syscapstone --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-openssl --with-libuv --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2"
|
||||
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-capstone5 --with-capstone4 --with-syscapstone --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-openssl --with-libuv --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2"
|
||||
exit 0
|
||||
;;
|
||||
--cache-file)
|
||||
@ -344,6 +346,7 @@ echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-
|
||||
"--without-gperf") WANT_GPERF="0"; ;;
|
||||
"--without-capstone") WANT_CAPSTONE="0"; ;;
|
||||
"--with-libr") WITH_LIBR="1"; ;;
|
||||
"--with-static-themes") WITH_STATIC_THEMES="1"; ;;
|
||||
"--with-capstone5") USE_CS5="1"; ;;
|
||||
"--with-capstone4") USE_CS4="1"; ;;
|
||||
"--with-syscapstone") WITH_CAPSTONE="1"; ;;
|
||||
@ -376,7 +379,7 @@ parse_options "$1"
|
||||
shift
|
||||
done
|
||||
|
||||
ENVWORDS="MANDIR 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 PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC 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 USE_CS5 USE_CS4 WITH_CAPSTONE 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 HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_OPENSSL WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL"
|
||||
ENVWORDS="MANDIR 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 PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC 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_CS5 USE_CS4 WITH_CAPSTONE 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 HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_OPENSSL WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL"
|
||||
|
||||
create_environ
|
||||
|
||||
|
@ -43,6 +43,7 @@ IFNOT WANT_GPERF {
|
||||
}
|
||||
|
||||
ARG_WITH WITH_LIBR libr build libr.a and libr.dylib ;
|
||||
ARG_WITH WITH_STATIC_THEMES static-themes default themes are compiled and fallback if not available on disk ;
|
||||
|
||||
(( CAPSTONE ))
|
||||
ARG_WITH USE_CS5 capstone5 build next branch of capstone5 (default) ;
|
||||
|
@ -2140,3 +2140,16 @@ R_API void r_cons_thready(void) {
|
||||
R_CRITICAL_LEAVE (I);
|
||||
}
|
||||
}
|
||||
|
||||
#if WITH_STATIC_THEMES
|
||||
#include "d_themes.inc"
|
||||
|
||||
R_API const RConsTheme* r_cons_themes(void) {
|
||||
return (const RConsTheme *)d_themes;
|
||||
}
|
||||
|
||||
#else
|
||||
R_API const RConsTheme* r_cons_themes(void) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -7,6 +7,25 @@ all clean:
|
||||
|
||||
CWD=$(shell pwd)
|
||||
|
||||
themes.c:
|
||||
echo '/* This file has been autogenerated with make -C d themes.c */' > themes.c
|
||||
THEMES="" ; \
|
||||
for FILE in * ; do \
|
||||
if [ $$FILE != themes.c -a $$FILE != Makefile -a $$FILE != meson.build -a -f $$FILE ]; then \
|
||||
echo "static const char * const theme_$$FILE = \\" >> themes.c ; \
|
||||
cat "${CWD}/$$FILE" | sed -e 's,",\\",g' -e 's,^,\t",' -e 's,$$,\\n",' >> themes.c ; \
|
||||
echo ";" >> themes.c ; \
|
||||
THEMES="$$THEMES $$FILE" ; \
|
||||
fi ; \
|
||||
done ; \
|
||||
echo "RConsTheme d_themes[] = {" >> themes.c ; \
|
||||
for a in $$THEMES ; do \
|
||||
echo " { \"$$a\", theme_$$a }," >> themes.c ; \
|
||||
done ; \
|
||||
echo " {0,0}" >> themes.c ; \
|
||||
echo "};" >> themes.c
|
||||
mv themes.c ../d_themes.inc
|
||||
|
||||
install: ${F_SDB}
|
||||
rm -rf "$P"
|
||||
mkdir -p "$P"
|
||||
|
2039
libr/cons/d_themes.inc
Normal file
2039
libr/cons/d_themes.inc
Normal file
File diff suppressed because it is too large
Load Diff
@ -160,6 +160,7 @@ static bool cmd_load_theme(RCore *core, const char *_arg) {
|
||||
return true;
|
||||
}
|
||||
char *arg = strdup (_arg);
|
||||
|
||||
// system themes directory
|
||||
char *home = r_xdg_datadir ("cons");
|
||||
|
||||
@ -186,13 +187,29 @@ static bool cmd_load_theme(RCore *core, const char *_arg) {
|
||||
core->themepath = arg;
|
||||
arg = NULL;
|
||||
} else {
|
||||
char *absfile = r_file_abspath (arg);
|
||||
R_LOG_ERROR ("eco: cannot open colorscheme profile (%s)", absfile);
|
||||
free (absfile);
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failed) {
|
||||
#if WITH_STATIC_THEMES
|
||||
const RConsTheme *theme = r_cons_themes ();
|
||||
while (theme && theme->name) {
|
||||
if (!strcmp (theme->name, arg)) {
|
||||
r_core_cmd0 (core, theme->script);
|
||||
free (arg);
|
||||
failed = false;
|
||||
break;
|
||||
}
|
||||
theme++;
|
||||
}
|
||||
if (failed) {
|
||||
R_LOG_ERROR ("eco: cannot open colorscheme profile (%s)", arg);
|
||||
}
|
||||
#else
|
||||
R_LOG_ERROR ("eco: cannot open colorscheme profile (%s)", arg);
|
||||
#endif
|
||||
}
|
||||
free (home);
|
||||
free (path);
|
||||
free (arg);
|
||||
|
@ -83,6 +83,11 @@ typedef struct r_cons_bind_t {
|
||||
RConsGrepCallback cb_grep;
|
||||
} RConsBind;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *script;
|
||||
} RConsTheme;
|
||||
|
||||
typedef struct r_cons_grep_t {
|
||||
char strings[R_CONS_GREP_WORDS][R_CONS_GREP_WORD_SIZE];
|
||||
int nstrings;
|
||||
@ -775,6 +780,7 @@ R_API void r_cons_canvas_line_back_edge(RConsCanvas *c, int x, int y, int x2, in
|
||||
|
||||
R_API RCons *r_cons_new(void);
|
||||
R_API RCons *r_cons_singleton(void);
|
||||
R_API const RConsTheme *r_cons_themes(void);
|
||||
R_API void r_cons_chop(void);
|
||||
R_API RConsContext *r_cons_context(void);
|
||||
R_API RCons *r_cons_free(void);
|
||||
|
@ -19,6 +19,8 @@ extern "C" {
|
||||
#define WANT_THREADS @WANT_THREADS@
|
||||
#define WANT_CAPSTONE @WANT_CAPSTONE@
|
||||
|
||||
#define WITH_STATIC_THEMES @WITH_STATIC_THEMES@
|
||||
|
||||
#define HAVE_GPERF @HAVE_GPERF@
|
||||
#if (HAVE_GPERF) == 1
|
||||
#define HAVE_GPERF @HAVE_GPERF@
|
||||
|
@ -23,7 +23,6 @@ if get_option('nogpl')
|
||||
user_plugins += ['nogrub']
|
||||
endif
|
||||
|
||||
|
||||
# This must be splitted in meson.builds for each module
|
||||
# meson split is results in 1 empty element when splitting an empty string :facepalm:
|
||||
if not no_user_plugins
|
||||
|
@ -13,7 +13,6 @@ LINK+=-g
|
||||
endif
|
||||
|
||||
LIBR:=$(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
# /libr
|
||||
|
||||
ALL?=
|
||||
CFLAGS:=-I$(LIBR) -I$(LIBR)/include $(CFLAGS)
|
||||
|
@ -356,6 +356,12 @@ else
|
||||
userconf.set('DATADIR_R2', r2_datdir_r2)
|
||||
userconf.set10('HAVE_JEMALLOC', true)
|
||||
endif
|
||||
if get_option('static_themes')
|
||||
userconf.set('WITH_STATIC_THEMES', 1)
|
||||
else
|
||||
userconf.set('WITH_STATIC_THEMES', 0)
|
||||
endif
|
||||
|
||||
userconf.set('DATADIR', join_paths(r2_prefix, r2_datdir))
|
||||
userconf.set('WWWROOT', join_paths(r2_prefix, r2_wwwroot))
|
||||
userconf.set('SDB', r2_sdb)
|
||||
|
@ -44,6 +44,7 @@ option('use_fork', type: 'boolean', value: true)
|
||||
option('sdb_cgen', type: 'boolean', value: false)
|
||||
option('use_dylink', type: 'boolean', value: true)
|
||||
option('debugger', type: 'boolean', value: true)
|
||||
option('static_themes', type: 'boolean', value: false)
|
||||
option('want_ptrace_wrap', type: 'boolean', value: true)
|
||||
option('nogpl', type: 'boolean', value: false)
|
||||
option('use_webui', type: 'boolean', value: true, description: 'install different WebUIs for radare2')
|
||||
|
@ -68,6 +68,7 @@ if [ 1 = "${DOCFG}" ]; then
|
||||
${MAKE} mrproper > /dev/null 2>&1
|
||||
fi
|
||||
export CFLAGS="${CFLAGS} -fPIC"
|
||||
export CFGARGS="$CFGARGS --with-static-themes"
|
||||
cp -f dist/plugins-cfg/plugins.static.nogpl.cfg plugins.cfg
|
||||
./configure-plugins || exit 1
|
||||
./configure --prefix="$PREFIX" --without-gpl --with-libr --without-libuv $CFGARGS || exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user