diff --git a/config.h.acr b/config.h.acr new file mode 100644 index 00000000..fbcfc62d --- /dev/null +++ b/config.h.acr @@ -0,0 +1,6 @@ +#ifndef R2GHIDRA_CONFIG_H +#define R2GHIDRA_CONFIG_H 1 + +#define R2GHIDRA_VERSION "@R2GHIDRA_VERSION@" + +#endif diff --git a/configure b/configure index ee6457a7..90bdded4 100755 --- a/configure +++ b/configure @@ -294,7 +294,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 CXX CXXFLAGS LDFLAGS HAVE_LANG_CXX CPP HAVE_GIT GIT PKGCONFIG R2_CFLAGS R2_LDFLAGS HAVE_PKGCFG_R_CORE R2ASM_CFLAGS R2ASM_LDFLAGS HAVE_PKGCFG_R_ASM R2ANAL_CFLAGS R2ANAL_LDFLAGS HAVE_PKGCFG_R_ANAL HAVE_R2 R2 HAVE_BISON BISON HAVE_FLEX FLEX R2_PREFIX R2_USER_PLUGINS R2_LIBR_PLUGINS" +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 CXX CXXFLAGS LDFLAGS HAVE_LANG_CXX CPP HAVE_GIT GIT PKGCONFIG R2_CFLAGS R2_LDFLAGS HAVE_PKGCFG_R_CORE R2ASM_CFLAGS R2ASM_LDFLAGS HAVE_PKGCFG_R_ASM R2ANAL_CFLAGS R2ANAL_LDFLAGS HAVE_PKGCFG_R_ANAL HAVE_R2 R2 HAVE_BISON BISON HAVE_FLEX FLEX R2_PREFIX R2_USER_PLUGINS R2_LIBR_PLUGINS R2GHIDRA_VERSION" create_environ @@ -542,6 +542,7 @@ else echo "not found" echo 'required'; exit 1 fi +R2GHIDRA_VERSION="$VERSION" SEDFLAGS=" -e '" COUNT=0 for A in ${ENVWORDS} ; do @@ -554,7 +555,7 @@ for A in ${ENVWORDS} ; do SEDFLAGS="${SEDFLAGS}s,@${A}@,${VAR},g;" done SEDFLAGS="${SEDFLAGS}'" -for A in config.mk Makefile ; do # SUBDIRS +for A in config.mk config.h Makefile ; do # SUBDIRS if [ -f "${VPATH}/${A}.acr" ]; then SD_TARGET=${A} else diff --git a/configure.acr b/configure.acr index d5be6b24..5d2c3809 100644 --- a/configure.acr +++ b/configure.acr @@ -17,6 +17,8 @@ EXEC! R2_PREFIX r2 -H R2_PREFIX ; EXEC! R2_USER_PLUGINS r2 -H R2_USER_PLUGINS ; EXEC! R2_LIBR_PLUGINS r2 -H R2_LIBR_PLUGINS ; -SUBDIRS config.mk Makefile ; +R2GHIDRA_VERSION = $VERSION ; + +SUBDIRS config.mk config.h Makefile ; REPORT VERSION R2_PREFIX PREFIX PKGCONFIG ; diff --git a/meson.build b/meson.build index 90054243..e7dd9d81 100644 --- a/meson.build +++ b/meson.build @@ -69,6 +69,15 @@ else r_core = dependency('r_core') endif +r2ghidra_version = meson.project_version() +versionconf = configuration_data() +versionconf.set('R2GHIDRA_VERSION', r2ghidra_version) +r_version_h = configure_file( + input: 'config.h.acr', + output: 'config.h', + configuration: versionconf +) + r2ghidra_incdirs = include_directories(incdirs) ghidra_decompiler_sources = [ diff --git a/src/core_ghidra_plugin.c b/src/core_ghidra_plugin.c index 28449460..e3e5648b 100644 --- a/src/core_ghidra_plugin.c +++ b/src/core_ghidra_plugin.c @@ -1,4 +1,5 @@ #include +#include "../config.h" extern int r2ghidra_core_fini(void *user, const char *cmd); extern int r2ghidra_core_init(void *user, const char *cmd); @@ -11,6 +12,7 @@ RCorePlugin r_core_plugin_ghidra = { .desc = "Ghidra decompiler with pdg command", .license = "GPL3", .author = "thestr4ng3r, pancake", + .version = R2GHIDRA_VERSION, }, #else .name = "r2ghidra",