From fd0df8f884336fc69bd0938453f9712c166f08c8 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sat, 23 Mar 2019 10:01:30 +0100
Subject: Removed references to local sources if required.

---
 configure.ac                     | 30 +++++++++++++++++++++++++-----
 pixmaps/Makefile.am              | 13 ++++++++-----
 plugins/arm/Makefile.am          |  9 +++++++++
 plugins/dex/Makefile.am          |  9 +++++++++
 plugins/dexbnf/Makefile.am       |  9 +++++++++
 plugins/elf/Makefile.am          |  9 +++++++++
 plugins/itanium/Makefile.am      |  9 +++++++++
 plugins/javadesc/Makefile.am     |  9 +++++++++
 plugins/pychrysalide/Makefile.am |  2 +-
 plugins/pychrysalide/pychrysa.c  | 10 ++++++++--
 src/gui/core/theme.c             |  3 +++
 src/plugins/pglist.c             |  4 ++++
 12 files changed, 103 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index a2d8b5e..d1a14a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,16 +138,29 @@ AC_SUBST(themesdir)
 
 AC_DEFINE_UNQUOTED(THEMES_DIR, "${themesdir}")
 
-pluginslibdir="${libdir}/chrysalide/plugins"
-AC_SUBST(pluginslibdir)
-
-AC_DEFINE_UNQUOTED(PLUGINS_LIB_DIR, "${pluginslibdir}")
-
 pluginsdatadir="${pkgdatadir}/plugins"
 AC_SUBST(pluginsdatadir)
 
 AC_DEFINE_UNQUOTED(PLUGINS_DATA_DIR, "${pluginsdatadir}")
 
+if test "x${libdir}" = 'x${exec_prefix}/lib'; then
+   if test "x${exec_prefix}" = "xNONE"; then
+      if test "x${prefix}" = "xNONE"; then
+         pluginslibdir="${ac_default_prefix}/lib/chrysalide/plugins"
+      else
+         pluginslibdir="${prefix}/lib/chrysalide/plugins"
+      fi
+   else
+      pluginslibdir="${exec_prefix}/lib/chrysalide/plugins"
+   fi
+else
+   pluginslibdir="${libdir}/chrysalide/plugins"
+fi
+
+AC_SUBST(pluginslibdir)
+
+AC_DEFINE_UNQUOTED(PLUGINS_LIB_DIR, "${pluginslibdir}")
+
 if test "x${prefix}" = "xNONE"; then
    AC_DEFINE_UNQUOTED(LOCALE_DIR, "${ac_default_prefix}/share/locale")
 else
@@ -198,10 +211,16 @@ fi
 
 #--- Discard local sources when looking for resources ?
 
+if test "x$enable_rpath" = "xno"; then
+   hardcode_libdir_flag_spec=
+fi
+
 if test "x$with_local_resources" = "xno"; then
    CFLAGS="$CFLAGS -DDISCARD_LOCAL"
 fi
 
+AM_CONDITIONAL([BUILD_DISCARD_LOCAL], [test "x$with_local_resources" = "xno"])
+
 AC_SUBST(CFLAGS)
 
 #--- Compilation warnings
@@ -501,6 +520,7 @@ echo Found general-purpose parser generator....... : $YACC_INST
 
 echo
 echo Print debugging messages..................... : $enable_debug
+echo Consider local resources..................... : $with_local_resources
 
 if test -z "$LEX_INST" -o -z "$YACC_INST"; then
 
diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
index 03ab1d5..d9043c7 100644
--- a/pixmaps/Makefile.am
+++ b/pixmaps/Makefile.am
@@ -25,6 +25,7 @@ TOOLBAR_BUTTONS =						\
 
 LIST_ICONS =							\
 	symbol_class_classic.png			\
+	symbol_object_classic.png			\
 	symbol_package.png					\
 	symbol_routine_classic.png
 
@@ -33,15 +34,17 @@ ERROR_ICONS = 							\
 	error_display.png					\
 	error_file.png
 
+OTHER_ICONS = 							\
+	bookmark.png						\
+	entrypoint.png						\
+	breakpoint_disabled.png				\
+	breakpoint_normal.png
+
 MISC =									\
 	chrysalide-full.png					\
 	welcome.png
 
 EXTRA_DIST =							\
-	bookmark.png						\
-	entrypoint.png						\
-	breakpoint_disabled.png				\
-	breakpoint_normal.png				\
 	chrysalide.xcf						\
 	openida.xcf							\
 	openida_text.xcf					\
@@ -53,6 +56,6 @@ EXTRA_DIST =							\
 	$(ERROR_ICONS)						\
 	$(MISC)
 
-pix_DATA = $(APP_ICONS) $(REVISION_PIX) $(TOOLBAR_BUTTONS) $(LIST_ICONS) $(ERROR_ICONS) $(MISC)
+pix_DATA = $(APP_ICONS) $(REVISION_PIX) $(TOOLBAR_BUTTONS) $(LIST_ICONS) $(ERROR_ICONS) $(OTHER_ICONS) $(MISC)
 
 pixdir = $(pixmapsdir)
diff --git a/plugins/arm/Makefile.am b/plugins/arm/Makefile.am
index 3091db7..eb217d7 100644
--- a/plugins/arm/Makefile.am
+++ b/plugins/arm/Makefile.am
@@ -8,9 +8,18 @@ if BUILD_PYTHON3_BINDINGS
 
 PYTHON3_LIBADD = python/libarmpython.la
 
+if BUILD_DISCARD_LOCAL
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
+					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+else
+
 PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
 					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
+endif
+
 PYTHON3_SUBDIRS = python
 
 endif
diff --git a/plugins/dex/Makefile.am b/plugins/dex/Makefile.am
index 9b6cb72..7bdf930 100644
--- a/plugins/dex/Makefile.am
+++ b/plugins/dex/Makefile.am
@@ -8,9 +8,18 @@ if BUILD_PYTHON3_BINDINGS
 
 PYTHON3_LIBADD = python/libdexpython.la
 
+if BUILD_DISCARD_LOCAL
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
+					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+else
+
 PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
 					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
+endif
+
 PYTHON3_SUBDIRS = python
 
 endif
diff --git a/plugins/dexbnf/Makefile.am b/plugins/dexbnf/Makefile.am
index f460459..da2cc4b 100644
--- a/plugins/dexbnf/Makefile.am
+++ b/plugins/dexbnf/Makefile.am
@@ -8,9 +8,18 @@ if BUILD_PYTHON3_BINDINGS
 
 PYTHON3_LIBADD = python/libdexbnfpython.la
 
+if BUILD_DISCARD_LOCAL
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
+					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+else
+
 PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
 					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
+endif
+
 PYTHON3_SUBDIRS = python
 
 endif
diff --git a/plugins/elf/Makefile.am b/plugins/elf/Makefile.am
index 59ee46c..7b243db 100644
--- a/plugins/elf/Makefile.am
+++ b/plugins/elf/Makefile.am
@@ -8,9 +8,18 @@ if BUILD_PYTHON3_BINDINGS
 
 PYTHON3_LIBADD = python/libelfpython.la
 
+if BUILD_DISCARD_LOCAL
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
+					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+else
+
 PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
 					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
+endif
+
 PYTHON3_SUBDIRS = python
 
 endif
diff --git a/plugins/itanium/Makefile.am b/plugins/itanium/Makefile.am
index ecbdc93..3d87d41 100644
--- a/plugins/itanium/Makefile.am
+++ b/plugins/itanium/Makefile.am
@@ -8,9 +8,18 @@ if BUILD_PYTHON3_BINDINGS
 
 PYTHON3_LIBADD = python/libitaniumpython.la
 
+if BUILD_DISCARD_LOCAL
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
+					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+else
+
 PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
 					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
+endif
+
 PYTHON3_SUBDIRS = python
 
 endif
diff --git a/plugins/javadesc/Makefile.am b/plugins/javadesc/Makefile.am
index 9474a87..c2ad3e7 100644
--- a/plugins/javadesc/Makefile.am
+++ b/plugins/javadesc/Makefile.am
@@ -8,9 +8,18 @@ if BUILD_PYTHON3_BINDINGS
 
 PYTHON3_LIBADD = python/libjavadescpython.la
 
+if BUILD_DISCARD_LOCAL
+
+PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
+					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
+else
+
 PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
 					-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
+endif
+
 PYTHON3_SUBDIRS = python
 
 endif
diff --git a/plugins/pychrysalide/Makefile.am b/plugins/pychrysalide/Makefile.am
index d9194b9..25c3e40 100644
--- a/plugins/pychrysalide/Makefile.am
+++ b/plugins/pychrysalide/Makefile.am
@@ -1,5 +1,5 @@
 
-pkglib_LTLIBRARIES = pychrysalide.la
+lib_LTLIBRARIES = pychrysalide.la
 
 libdir = $(pluginslibdir)
 
diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c
index 3e14add..f9cdad5 100644
--- a/plugins/pychrysalide/pychrysa.c
+++ b/plugins/pychrysalide/pychrysa.c
@@ -579,6 +579,12 @@ static void load_python_plugins(GPluginModule *plugin)
 
     /* Définition des zones d'influence */
 
+#ifndef DISCARD_LOCAL
+
+    extend_python_path(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "plugins" G_DIR_SEPARATOR_S "python");
+
+#else
+
     dir = opendir(PLUGINS_DATA_DIR G_DIR_SEPARATOR_S "python");
 
     if (dir != NULL)
@@ -586,8 +592,8 @@ static void load_python_plugins(GPluginModule *plugin)
          closedir(dir);
          extend_python_path(PLUGINS_DATA_DIR G_DIR_SEPARATOR_S "python");
     }
-    else
-        extend_python_path(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "plugins" G_DIR_SEPARATOR_S "python");
+
+#endif
 
     g_plugin_module_log_variadic_message(plugin, LMT_INFO,
                                          _("PYTHONPATH environment variable set to '%s'"),
diff --git a/src/gui/core/theme.c b/src/gui/core/theme.c
index 8e68780..77eff7f 100644
--- a/src/gui/core/theme.c
+++ b/src/gui/core/theme.c
@@ -63,8 +63,11 @@ static bool extend_with_plugins_themes(GdkScreen *, gboolean);
 /* Répertoires de recherche */
 static const char *_themes_directories[] = {
 
+#ifndef DISCARD_LOCAL
     PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "themes",
+#else
     THEMES_DIR,
+#endif
     NULL
 
 };
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c
index b7c8d1d..85f2b99 100644
--- a/src/plugins/pglist.c
+++ b/src/plugins/pglist.c
@@ -75,7 +75,11 @@ bool init_all_plugins(bool load)
 {
     g_rw_lock_init(&_pg_lock);
 
+#ifndef DISCARD_LOCAL
     browse_directory_for_plugins(PACKAGE_SOURCE_DIR "/plugins");
+#else
+    browse_directory_for_plugins(PLUGINS_LIB_DIR);
+#endif
 
     if (load)
         load_remaning_plugins();
-- 
cgit v0.11.2-87-g4458