From 531be2e3a96bf13cd36035cec7faa31b2534a742 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Fri, 31 Aug 2018 21:15:26 +0200
Subject: Changed the location of installed plugins.

---
 configure.ac                        | 14 ++++++++++----
 plugins/androhelpers/Makefile.am    |  2 +-
 plugins/arm/Makefile.am             |  2 +-
 plugins/dalvik/Makefile.am          |  2 +-
 plugins/devdbg/Makefile.am          |  2 +-
 plugins/dex/Makefile.am             |  2 +-
 plugins/dexbnf/Makefile.am          |  2 +-
 plugins/elf/Makefile.am             |  2 +-
 plugins/fmtp/Makefile.am            |  2 +-
 plugins/itanium/Makefile.am         |  2 +-
 plugins/libcsem/Makefile.am         |  2 +-
 plugins/lnxsyscalls/Makefile.am     |  4 ++--
 plugins/lnxsyscalls/db.c            |  2 +-
 plugins/mobicore/Makefile.am        |  2 +-
 plugins/pychrysalide/Makefile.am    |  2 +-
 plugins/pychrysalide/pychrysa.c     |  4 ++--
 plugins/python/apkfiles/Makefile.am |  2 +-
 plugins/readdex/Makefile.am         |  2 +-
 plugins/readelf/Makefile.am         |  2 +-
 plugins/readmc/Makefile.am          |  2 +-
 plugins/ropgadgets/Makefile.am      |  2 +-
 plugins/stackvars/Makefile.am       |  2 +-
 src/core/paths.c                    |  4 ++--
 src/core/paths.h                    |  2 +-
 src/main.c                          |  3 ++-
 25 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3eebab2..0d48687 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,7 +98,8 @@ AH_TEMPLATE([REVISION], [Define the version number of the program for the about
 AH_TEMPLATE([PACKAGE_SOURCE_DIR], [Define the directory where the code source is waiting for being compiled.])
 AH_TEMPLATE([PIXMAPS_DIR], [Define the directory where the pictures will be installed.])
 AH_TEMPLATE([THEMES_DIR], [Define the main directory where all themes will be installed.])
-AH_TEMPLATE([PLUGINS_DIR], [Define the directory where the plugins are installed.])
+AH_TEMPLATE([PLUGINS_LIB_DIR], [Define the directory where the plugin librairies are installed.])
+AH_TEMPLATE([PLUGINS_DATA_DIR], [Define the directory where the plugin data is installed.])
 AH_TEMPLATE([LOCALE_DIR], [Define the directory where the message catalogs are installed.])
 
 
@@ -137,10 +138,15 @@ AC_SUBST(themesdir)
 
 AC_DEFINE_UNQUOTED(THEMES_DIR, "${themesdir}")
 
-pluginsdir="${pkgdatadir}/plugins"
-AC_SUBST(pluginsdir)
+pluginslibdir="${libdir}/chrysalide/plugins"
+AC_SUBST(pluginslibdir)
 
-AC_DEFINE_UNQUOTED(PLUGINS_DIR, "${pluginsdir}")
+AC_DEFINE_UNQUOTED(PLUGINS_LIB_DIR, "${pluginslibdir}")
+
+pluginsdatadir="${pkgdatadir}/plugins"
+AC_SUBST(pluginsdatadir)
+
+AC_DEFINE_UNQUOTED(PLUGINS_DATA_DIR, "${pluginsdatadir}")
 
 if test "x${prefix}" = "xNONE"; then
    AC_DEFINE_UNQUOTED(LOCALE_DIR, "${ac_default_prefix}/share/locale")
diff --git a/plugins/androhelpers/Makefile.am b/plugins/androhelpers/Makefile.am
index 1eb374e..c0c423f 100644
--- a/plugins/androhelpers/Makefile.am
+++ b/plugins/androhelpers/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libandrohelpers.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libandrohelpers_la_SOURCES =			\
diff --git a/plugins/arm/Makefile.am b/plugins/arm/Makefile.am
index 8b28e95..12e58fd 100644
--- a/plugins/arm/Makefile.am
+++ b/plugins/arm/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libarm.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libarm_la_SOURCES =						\
diff --git a/plugins/dalvik/Makefile.am b/plugins/dalvik/Makefile.am
index 11101d2..c3dd774 100644
--- a/plugins/dalvik/Makefile.am
+++ b/plugins/dalvik/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libdalvik.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libdalvik_la_SOURCES =					\
diff --git a/plugins/devdbg/Makefile.am b/plugins/devdbg/Makefile.am
index 5c19f47..90553c8 100644
--- a/plugins/devdbg/Makefile.am
+++ b/plugins/devdbg/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libspeed.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libspeed_la_SOURCES =					\
diff --git a/plugins/dex/Makefile.am b/plugins/dex/Makefile.am
index fa2e65a..95a63e0 100644
--- a/plugins/dex/Makefile.am
+++ b/plugins/dex/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libdex.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libdex_la_SOURCES =						\
diff --git a/plugins/dexbnf/Makefile.am b/plugins/dexbnf/Makefile.am
index 677e4a6..226bcc0 100644
--- a/plugins/dexbnf/Makefile.am
+++ b/plugins/dexbnf/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libdexbnf.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libdexbnf_la_SOURCES =					\
diff --git a/plugins/elf/Makefile.am b/plugins/elf/Makefile.am
index 084e7b5..50c9d49 100644
--- a/plugins/elf/Makefile.am
+++ b/plugins/elf/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libelf.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libelf_la_SOURCES =						\
diff --git a/plugins/fmtp/Makefile.am b/plugins/fmtp/Makefile.am
index d2d6611..de7fdbe 100644
--- a/plugins/fmtp/Makefile.am
+++ b/plugins/fmtp/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libfmtp.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libfmtp_la_SOURCES =					\
diff --git a/plugins/itanium/Makefile.am b/plugins/itanium/Makefile.am
index b4a9cb7..b6d62ff 100644
--- a/plugins/itanium/Makefile.am
+++ b/plugins/itanium/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES  = libitanium.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 libitanium_la_SOURCES =					\
 	abi.h abi.c							\
diff --git a/plugins/libcsem/Makefile.am b/plugins/libcsem/Makefile.am
index 8f9333d..077a5b5 100644
--- a/plugins/libcsem/Makefile.am
+++ b/plugins/libcsem/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = liblibcsem.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 liblibcsem_la_SOURCES =					\
diff --git a/plugins/lnxsyscalls/Makefile.am b/plugins/lnxsyscalls/Makefile.am
index a68e18e..654420b 100644
--- a/plugins/lnxsyscalls/Makefile.am
+++ b/plugins/lnxsyscalls/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = liblnxsyscalls.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 liblnxsyscalls_la_SOURCES =				\
@@ -26,7 +26,7 @@ EXTRA_DIST = linux-syscalls.db
 
 db_DATA = linux-syscalls.db
 
-dbdir = $(pluginsdir)
+dbdir = $(pluginsdatadir)
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/lnxsyscalls/db.c b/plugins/lnxsyscalls/db.c
index d6325b5..1c28981 100644
--- a/plugins/lnxsyscalls/db.c
+++ b/plugins/lnxsyscalls/db.c
@@ -54,7 +54,7 @@ sqlite3 *open_syscalls_database(const GPluginModule *plugin)
     char *filename;                     /* Chemin vers la base         */
     int ret;                            /* Bilan d'un appel            */
 
-    filename = find_plugin_file("lnxsyscalls", "linux-syscalls.db");
+    filename = find_plugin_data_file("lnxsyscalls", "linux-syscalls.db");
 
     if (filename == NULL)
     {
diff --git a/plugins/mobicore/Makefile.am b/plugins/mobicore/Makefile.am
index ed8fd00..276b3a9 100644
--- a/plugins/mobicore/Makefile.am
+++ b/plugins/mobicore/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libmobicore.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libmobicore_la_SOURCES =				\
diff --git a/plugins/pychrysalide/Makefile.am b/plugins/pychrysalide/Makefile.am
index bc01ee3..cfd5f81 100644
--- a/plugins/pychrysalide/Makefile.am
+++ b/plugins/pychrysalide/Makefile.am
@@ -1,7 +1,7 @@
 
 pkglib_LTLIBRARIES = pychrysalide.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 pychrysalide_la_SOURCES =				\
diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c
index 7403927..8c93448 100644
--- a/plugins/pychrysalide/pychrysa.c
+++ b/plugins/pychrysalide/pychrysa.c
@@ -548,12 +548,12 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
 
     /* Définition des zones d'influence */
 
-    dir = opendir(PLUGINS_DIR G_DIR_SEPARATOR_S "python");
+    dir = opendir(PLUGINS_DATA_DIR G_DIR_SEPARATOR_S "python");
 
     if (dir != NULL)
     {
          closedir(dir);
-         add_to_env_var("PYTHONPATH", PLUGINS_DIR G_DIR_SEPARATOR_S "python", ":");
+         add_to_env_var("PYTHONPATH", PLUGINS_DATA_DIR G_DIR_SEPARATOR_S "python", ":");
     }
     else
         add_to_env_var("PYTHONPATH", PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "plugins" \
diff --git a/plugins/python/apkfiles/Makefile.am b/plugins/python/apkfiles/Makefile.am
index 9e323a4..bd160bb 100644
--- a/plugins/python/apkfiles/Makefile.am
+++ b/plugins/python/apkfiles/Makefile.am
@@ -1,5 +1,5 @@
 
-apkfilesdir = $(pluginsdir)/python/apkfiles
+apkfilesdir = $(pluginsdatadir)/python/apkfiles
 
 apkfiles_DATA = 							\
 	__init__.py								\
diff --git a/plugins/readdex/Makefile.am b/plugins/readdex/Makefile.am
index b773dc5..47b7f7b 100644
--- a/plugins/readdex/Makefile.am
+++ b/plugins/readdex/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libreaddex.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libreaddex_la_SOURCES =					\
diff --git a/plugins/readelf/Makefile.am b/plugins/readelf/Makefile.am
index 5c80023..928acde 100644
--- a/plugins/readelf/Makefile.am
+++ b/plugins/readelf/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libreadelf.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libreadelf_la_SOURCES =					\
diff --git a/plugins/readmc/Makefile.am b/plugins/readmc/Makefile.am
index 7bd5fa5..937a193 100644
--- a/plugins/readmc/Makefile.am
+++ b/plugins/readmc/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libreadmc.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libreadmc_la_SOURCES =					\
diff --git a/plugins/ropgadgets/Makefile.am b/plugins/ropgadgets/Makefile.am
index 50ded08..8df1c2e 100644
--- a/plugins/ropgadgets/Makefile.am
+++ b/plugins/ropgadgets/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libropgadgets.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libropgadgets_la_SOURCES =				\
diff --git a/plugins/stackvars/Makefile.am b/plugins/stackvars/Makefile.am
index 7555120..d4a7714 100644
--- a/plugins/stackvars/Makefile.am
+++ b/plugins/stackvars/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libstackvars.la
 
-libdir = $(pluginsdir)
+libdir = $(pluginslibdir)
 
 
 libstackvars_la_SOURCES =				\
diff --git a/src/core/paths.c b/src/core/paths.c
index 8e825d2..f58f46c 100644
--- a/src/core/paths.c
+++ b/src/core/paths.c
@@ -123,7 +123,7 @@ char *find_pixmap_file(const char *filename)
 *                                                                             *
 ******************************************************************************/
 
-char *find_plugin_file(const char *pgname, const char *filename)
+char *find_plugin_data_file(const char *pgname, const char *filename)
 {
     char *result;                           /* Trouvaille à renvoyer       */
 #ifndef DISCARD_LOCAL
@@ -150,7 +150,7 @@ char *find_plugin_file(const char *pgname, const char *filename)
 #endif
 
     if (result == NULL)
-        result = find_file_in_directory(PLUGINS_DIR, filename);
+        result = find_file_in_directory(PLUGINS_DATA_DIR, filename);
 
     return result;
 
diff --git a/src/core/paths.h b/src/core/paths.h
index c16a278..a755559 100644
--- a/src/core/paths.h
+++ b/src/core/paths.h
@@ -30,7 +30,7 @@
 char *find_pixmap_file(const char *);
 
 /* Trouve le chemin d'accès complet à un fichier de greffon. */
-char *find_plugin_file(const char *, const char *);
+char *find_plugin_data_file(const char *, const char *);
 
 
 
diff --git a/src/main.c b/src/main.c
index 05e2b15..bbd4d11 100644
--- a/src/main.c
+++ b/src/main.c
@@ -129,7 +129,8 @@ static void show_chrysalide_version(void)
 
     printf(_("Pictures directory: %s\n"), PIXMAPS_DIR);
     printf(_("Themes directory: %s\n"), THEMES_DIR);
-    printf(_("Plugins directory: %s\n"), PLUGINS_DIR);
+    printf(_("Plugins library directory: %s\n"), PLUGINS_LIB_DIR);
+    printf(_("Plugins data directory: %s\n"), PLUGINS_DATA_DIR);
     printf(_("Locale directory: %s\n"), LOCALE_DIR);
 
     printf("\n");
-- 
cgit v0.11.2-87-g4458