From 0f73369ad9cd15cb17ae44aadfc035cb12778b93 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 21 Aug 2017 16:30:50 +0200
Subject: Fixed installation directories.

---
 ChangeLog                           | 21 +++++++++++++++++++++
 configure.ac                        | 30 ++++++++++++++++++++++--------
 pixmaps/Makefile.am                 |  4 ++--
 plugins/devdbg/Makefile.am          |  2 ++
 plugins/fmtp/Makefile.am            |  2 ++
 plugins/libcsem/Makefile.am         |  2 ++
 plugins/mobicore/Makefile.am        |  2 ++
 plugins/pychrysa/Makefile.am        |  2 ++
 plugins/python/apkfiles/Makefile.am |  2 +-
 plugins/python/samples/Makefile.am  |  2 +-
 plugins/readdex/Makefile.am         |  2 ++
 plugins/readelf/Makefile.am         |  2 ++
 plugins/readmc/Makefile.am          |  2 ++
 plugins/ropgadgets/Makefile.am      |  2 ++
 src/core/core.c                     |  2 +-
 src/gui/core/theme.c                |  2 +-
 src/main.c                          |  3 ++-
 themes/Adwaita/Makefile.am          |  4 ++--
 18 files changed, 71 insertions(+), 17 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b17ec71..c56cc94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 17-08-21  Cyrille Bagard <nocbos@gmail.com>
 
+	* configure.ac:
+	* pixmaps/Makefile.am:
+	* plugins/devdbg/Makefile.am:
+	* plugins/fmtp/Makefile.am:
+	* plugins/libcsem/Makefile.am:
+	* plugins/mobicore/Makefile.am:
+	* plugins/pychrysa/Makefile.am:
+	* plugins/python/apkfiles/Makefile.am:
+	* plugins/python/samples/Makefile.am:
+	* plugins/readdex/Makefile.am:
+	* plugins/readelf/Makefile.am:
+	* plugins/readmc/Makefile.am:
+	* plugins/ropgadgets/Makefile.am:
+	* src/core/core.c:
+	* src/gui/core/theme.c:
+	* src/main.c:
+	* themes/Adwaita/Makefile.am:
+	Fix installation directories.
+
+17-08-21  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/gtkext/gtkbinarystrip.c:
 	* src/gtkext/gtkgraphdisplay.c:
 	* src/gui/panels/glance.c:
diff --git a/configure.ac b/configure.ac
index aadb326..98923d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,8 +95,9 @@ AC_CHECK_FUNCS([strrchr])
 #--- Autoheader Macros
 
 AH_TEMPLATE([REVISION], [Define the version number of the program for the about box.])
-AH_TEMPLATE([PACKAGE_DATA_DIR], [Define the directory where the associated data will be installed.])
 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([LOCALE_DIR], [Define the directory where the message catalogs are installed.])
 
@@ -105,28 +106,41 @@ AC_DEFINE_UNQUOTED(REVISION, AC_PACKAGE_VERSION)
 
 if test "x${datadir}" = 'x${prefix}/share'; then
    if test "x${prefix}" = "xNONE"; then
-      AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
+      pkgdatadir="${ac_default_prefix}/share/${PACKAGE}"
    else
-      AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
+      pkgdatadir="${prefix}/share/${PACKAGE}"
    fi
 elif test "x${datadir}" = 'x${datarootdir}'; then
    if test "x${datarootdir}" = 'x${prefix}/share'; then
       if test "x${prefix}" = "xNONE"; then
-         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/share/${PACKAGE}")
+         pkgdatadir="${ac_default_prefix}/share/${PACKAGE}"
       else
-         AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/share/${PACKAGE}")
+         pkgdatadir="${prefix}/share/${PACKAGE}"
       fi
    else
-      AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datarootdir}/${PACKAGE}")
+      pkgdatadir="${datarootdir}/${PACKAGE}"
    fi 
 else
-   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${datadir}/${PACKAGE}")
+   pkgdatadir="${datadir}/${PACKAGE}"
 fi
 
 packagesrcdir=`cd $srcdir && pwd`
 AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}")
 
-AC_DEFINE_UNQUOTED(PLUGINS_DIR, PACKAGE_DATA_DIR "/plugins")
+pixmapsdir="${pkgdatadir}/pixmaps"
+AC_SUBST(pixmapsdir)
+
+AC_DEFINE_UNQUOTED(PIXMAPS_DIR, "${pixmapsdir}")
+
+themesdir="${pkgdatadir}/themes"
+AC_SUBST(themesdir)
+
+AC_DEFINE_UNQUOTED(THEMES_DIR, "${themesdir}")
+
+pluginsdir="${pkgdatadir}/plugins"
+AC_SUBST(pluginsdir)
+
+AC_DEFINE_UNQUOTED(PLUGINS_DIR, "${pluginsdir}")
 
 if test "x${prefix}" = "xNONE"; then
    AC_DEFINE_UNQUOTED(LOCALE_DIR, "${ac_default_prefix}/share/locale")
diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
index bb1a7b5..2ce41ff 100644
--- a/pixmaps/Makefile.am
+++ b/pixmaps/Makefile.am
@@ -53,6 +53,6 @@ EXTRA_DIST =							\
 	$(LIST_ICONS)						\
 	$(MISC)
 
-oidapixdir = $(datadir)/openida
+pix_DATA = $(APP_ICONS) $(REVISION_PIX) $(TOOLBAR_BUTTONS) $(LIST_ICONS) $(ERROR_ICONS) $(MISC)
 
-oidapix_DATA = $(APP_ICONS) $(REVISION_PIX) $(TOOLBAR_BUTTONS) $(LIST_ICONS) $(ERROR_ICONS) $(MISC)
+pixdir = $(pixmapsdir)
diff --git a/plugins/devdbg/Makefile.am b/plugins/devdbg/Makefile.am
index bd686d3..37b7ae4 100644
--- a/plugins/devdbg/Makefile.am
+++ b/plugins/devdbg/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libspeed.la
 
+libdir = $(pluginsdir)
+
 libspeed_la_SOURCES =					\
 	speed.h speed.c
 
diff --git a/plugins/fmtp/Makefile.am b/plugins/fmtp/Makefile.am
index 1c5d0d9..497a6b1 100644
--- a/plugins/fmtp/Makefile.am
+++ b/plugins/fmtp/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libfmtp.la
 
+libdir = $(pluginsdir)
+
 libfmtp_la_SOURCES =					\
 	def.h								\
 	parser.h parser.c
diff --git a/plugins/libcsem/Makefile.am b/plugins/libcsem/Makefile.am
index 1c8ad9c..c09ba86 100644
--- a/plugins/libcsem/Makefile.am
+++ b/plugins/libcsem/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = liblibcsem.la
 
+libdir = $(pluginsdir)
+
 liblibcsem_la_SOURCES =					\
 	exit.h exit.c						\
 	semantic.h semantic.c
diff --git a/plugins/mobicore/Makefile.am b/plugins/mobicore/Makefile.am
index 10beb85..b49d7ef 100644
--- a/plugins/mobicore/Makefile.am
+++ b/plugins/mobicore/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libmobicore.la
 
+libdir = $(pluginsdir)
+
 libmobicore_la_SOURCES =				\
 	mclf-def.h							\
 	mclf-int.h mclf-int.c				\
diff --git a/plugins/pychrysa/Makefile.am b/plugins/pychrysa/Makefile.am
index 8bc5e0c..e9798b2 100644
--- a/plugins/pychrysa/Makefile.am
+++ b/plugins/pychrysa/Makefile.am
@@ -1,6 +1,8 @@
 
 pkglib_LTLIBRARIES = pychrysalide.la
 
+libdir = $(pluginsdir)
+
 pychrysalide_la_SOURCES =				\
 	helpers.h helpers.c					\
 	plugin.h plugin.c					\
diff --git a/plugins/python/apkfiles/Makefile.am b/plugins/python/apkfiles/Makefile.am
index dfa27b7..9e323a4 100644
--- a/plugins/python/apkfiles/Makefile.am
+++ b/plugins/python/apkfiles/Makefile.am
@@ -1,5 +1,5 @@
 
-apkfilesdir = $(datadir)/openida/plugins/python/apkfiles
+apkfilesdir = $(pluginsdir)/python/apkfiles
 
 apkfiles_DATA = 							\
 	__init__.py								\
diff --git a/plugins/python/samples/Makefile.am b/plugins/python/samples/Makefile.am
index 1268032..816868c 100644
--- a/plugins/python/samples/Makefile.am
+++ b/plugins/python/samples/Makefile.am
@@ -1,5 +1,5 @@
 
-samplesdir = $(datadir)/openida/plugins/python/samples
+samplesdir = $(pluginsdir)/python/apkfiles
 
 samples_DATA = 								\
 	__init__.py								\
diff --git a/plugins/readdex/Makefile.am b/plugins/readdex/Makefile.am
index ce98d4a..36dd8bf 100644
--- a/plugins/readdex/Makefile.am
+++ b/plugins/readdex/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libreaddex.la
 
+libdir = $(pluginsdir)
+
 libreaddex_la_SOURCES =					\
 	class.h class.c						\
 	code.h code.c						\
diff --git a/plugins/readelf/Makefile.am b/plugins/readelf/Makefile.am
index c3cf822..6ba7efb 100644
--- a/plugins/readelf/Makefile.am
+++ b/plugins/readelf/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libreadelf.la
 
+libdir = $(pluginsdir)
+
 libreadelf_la_SOURCES =					\
 	header.h header.c					\
 	program.h program.c					\
diff --git a/plugins/readmc/Makefile.am b/plugins/readmc/Makefile.am
index f1b0845..ca5f9b4 100644
--- a/plugins/readmc/Makefile.am
+++ b/plugins/readmc/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libreadmc.la
 
+libdir = $(pluginsdir)
+
 libreadmc_la_SOURCES =					\
 	header.h header.c					\
 	reader.h reader.c					\
diff --git a/plugins/ropgadgets/Makefile.am b/plugins/ropgadgets/Makefile.am
index 5d11366..c6dba84 100644
--- a/plugins/ropgadgets/Makefile.am
+++ b/plugins/ropgadgets/Makefile.am
@@ -1,6 +1,8 @@
 
 lib_LTLIBRARIES = libropgadgets.la
 
+libdir = $(pluginsdir)
+
 libropgadgets_la_SOURCES =				\
 	finder.h finder.c					\
 	helper_arm.h helper_arm.c			\
diff --git a/src/core/core.c b/src/core/core.c
index 6ba54c1..b382e34 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -71,7 +71,7 @@ bool load_all_basic_components(void)
 
         srand(time(NULL) + getpid());
 
-        add_pixmap_directory(PACKAGE_DATA_DIR);
+        add_pixmap_directory(PIXMAPS_DIR);
         add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps");
 
         cfgdir = get_xdg_config_dir("chrysalide" G_DIR_SEPARATOR_S "chrysalide");
diff --git a/src/gui/core/theme.c b/src/gui/core/theme.c
index 7719573..895a1a5 100644
--- a/src/gui/core/theme.c
+++ b/src/gui/core/theme.c
@@ -56,7 +56,7 @@ static bool look_for_named_theme(GdkScreen *, const char *, const char *, gboole
 static const char *_themes_directories[] = {
 
     PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "themes",
-    PACKAGE_DATA_DIR G_DIR_SEPARATOR_S "themes",
+    THEMES_DIR,
     NULL
 
 };
diff --git a/src/main.c b/src/main.c
index 64d5d2b..27f5f94 100644
--- a/src/main.c
+++ b/src/main.c
@@ -122,7 +122,8 @@ static void show_chrysalide_version(void)
 
     printf("\n");
 
-    printf(_("Data directory: %s\n"), PACKAGE_DATA_DIR);
+    printf(_("Pictures directory: %s\n"), PIXMAPS_DIR);
+    printf(_("Themes directory: %s\n"), THEMES_DIR);
     printf(_("Plugins directory: %s\n"), PLUGINS_DIR);
     printf(_("Locale directory: %s\n"), LOCALE_DIR);
 
diff --git a/themes/Adwaita/Makefile.am b/themes/Adwaita/Makefile.am
index 338d65b..4712702 100644
--- a/themes/Adwaita/Makefile.am
+++ b/themes/Adwaita/Makefile.am
@@ -7,8 +7,8 @@ GTK3_CSS =								\
 	redo.png							\
 	undo.png
 
-cssdir = $(datadir)/themes/Adwaita
-
 css_DATA = $(GTK3_CSS)
 
+cssdir = $(themesdir)/Adwaita
+
 EXTRA_DIST = $(css_DATA)
-- 
cgit v0.11.2-87-g4458