From c0174a4bc5b12ace8e7449d26dad551f8434f62d Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 18 Jun 2018 23:45:22 +0200
Subject: Ensured each plugin dependency can be found at runtime.

---
 plugins/Makefile.am             | 2 +-
 plugins/arm/Makefile.am         | 6 ++++--
 plugins/dalvik/Makefile.am      | 4 +++-
 plugins/dex/Makefile.am         | 6 ++++--
 plugins/dexbnf/Makefile.am      | 6 ++++--
 plugins/elf/Makefile.am         | 6 ++++--
 plugins/lnxsyscalls/Makefile.am | 5 +++--
 plugins/readdex/Makefile.am     | 6 ++++--
 plugins/readelf/Makefile.am     | 7 ++++---
 plugins/readmc/Makefile.am      | 6 ++++--
 plugins/ropgadgets/Makefile.am  | 4 +++-
 11 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 90556de..257e0d5 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -4,4 +4,4 @@ if HAVE_PYTHON3_CONFIG
 endif
 
 # androhelpers
-SUBDIRS = arm dalvik devdbg dex dexbnf elf fmtp libcsem lnxsyscalls mobicore $(PYTHON3_SUBDIRS) readdex readelf readmc ropgadgets
+SUBDIRS = $(PYTHON3_SUBDIRS) arm dex dalvik devdbg dexbnf elf fmtp libcsem lnxsyscalls mobicore readdex readelf readmc ropgadgets
diff --git a/plugins/arm/Makefile.am b/plugins/arm/Makefile.am
index 877f7f4..14eff6f 100644
--- a/plugins/arm/Makefile.am
+++ b/plugins/arm/Makefile.am
@@ -23,8 +23,10 @@ libarm_la_LIBADD =						\
 
 libarm_la_CFLAGS = $(AM_CFLAGS)
 
-libarm_la_LDFLAGS = $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+libarm_la_LDFLAGS =													\
+	-L$(top_srcdir)/src/.libs -lchrysacore							\
+	-Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs			\
+	-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/dalvik/Makefile.am b/plugins/dalvik/Makefile.am
index e60b3ed..c32eba7 100644
--- a/plugins/dalvik/Makefile.am
+++ b/plugins/dalvik/Makefile.am
@@ -25,7 +25,9 @@ libdalvik_la_LIBADD =					\
 
 libdalvik_la_CFLAGS = $(AM_CFLAGS)
 
-libdalvik_la_LDFLAGS = -L$(top_srcdir)/src/.libs -lchrysacore
+libdalvik_la_LDFLAGS =						\
+	-L$(top_srcdir)/src/.libs -lchrysacore	\
+	-L$(top_srcdir)/plugins/dex/.libs -ldex
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/dex/Makefile.am b/plugins/dex/Makefile.am
index c72d1c6..fa2e65a 100644
--- a/plugins/dex/Makefile.am
+++ b/plugins/dex/Makefile.am
@@ -18,8 +18,10 @@ libdex_la_SOURCES =						\
 libdex_la_LIBADD =						\
 	python/libdexpython.la
 
-libdex_la_LDFLAGS = $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+libdex_la_LDFLAGS =													\
+	-L$(top_srcdir)/src/.libs -lchrysacore							\
+	-Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs			\
+	-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/dexbnf/Makefile.am b/plugins/dexbnf/Makefile.am
index b255871..f6081d7 100644
--- a/plugins/dexbnf/Makefile.am
+++ b/plugins/dexbnf/Makefile.am
@@ -17,8 +17,10 @@ libdexbnf_la_CFLAGS = $(AM_CFLAGS)
 libdexbnf_la_LIBADD =					\
 	python/libdexbnfpython.la
 
-libdexbnf_la_LDFLAGS = $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+libdexbnf_la_LDFLAGS =												\
+	-L$(top_srcdir)/src/.libs -lchrysacore							\
+	-Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs			\
+	-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/elf/Makefile.am b/plugins/elf/Makefile.am
index ccfa2d5..fb95824 100644
--- a/plugins/elf/Makefile.am
+++ b/plugins/elf/Makefile.am
@@ -21,8 +21,10 @@ libelf_la_SOURCES =						\
 libelf_la_LIBADD =						\
 	python/libelfpython.la
 
-libelf_la_LDFLAGS = $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+libelf_la_LDFLAGS =													\
+	-L$(top_srcdir)/src/.libs -lchrysacore							\
+	-Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs			\
+	-L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/lnxsyscalls/Makefile.am b/plugins/lnxsyscalls/Makefile.am
index 251c1c9..e483447 100644
--- a/plugins/lnxsyscalls/Makefile.am
+++ b/plugins/lnxsyscalls/Makefile.am
@@ -18,8 +18,9 @@ liblnxsyscalls_la_CFLAGS = $(AM_CFLAGS)
 
 liblnxsyscalls_la_LIBADD = 
 
-liblnxsyscalls_la_LDFLAGS = $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+liblnxsyscalls_la_LDFLAGS =					\
+	-L$(top_srcdir)/src/.libs -lchrysacore	\
+	-L$(top_srcdir)/plugins/arm/.libs -larm
 
 
 db_DATA = linux-syscalls.db
diff --git a/plugins/readdex/Makefile.am b/plugins/readdex/Makefile.am
index 784007e..5009d97 100644
--- a/plugins/readdex/Makefile.am
+++ b/plugins/readdex/Makefile.am
@@ -13,8 +13,10 @@ libreaddex_la_SOURCES =					\
 
 libreaddex_la_CFLAGS = $(AM_CFLAGS)
 
-libreaddex_la_LDFLAGS = -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+libreaddex_la_LDFLAGS =							\
+	-L$(top_srcdir)/src/.libs -lchrysacore		\
+	-L$(top_srcdir)/plugins/dex/.libs -ldex		\
+	-L$(top_srcdir)/plugins/fmtp/.libs -lfmtp
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/readelf/Makefile.am b/plugins/readelf/Makefile.am
index 5e3496d..463bca5 100644
--- a/plugins/readelf/Makefile.am
+++ b/plugins/readelf/Makefile.am
@@ -13,9 +13,10 @@ libreadelf_la_SOURCES =					\
 
 libreadelf_la_CFLAGS = $(AM_CFLAGS)
 
-libreadelf_la_LDFLAGS = -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp \
-	-L$(top_srcdir)/src/.libs -lchrysacore
-
+libreadelf_la_LDFLAGS =							\
+	-L$(top_srcdir)/src/.libs -lchrysacore		\
+	-L$(top_srcdir)/plugins/elf/.libs -lelf		\
+	-L$(top_srcdir)/plugins/fmtp/.libs -lfmtp
 
 devdir = $(includedir)/chrysalide-$(subdir)
 
diff --git a/plugins/readmc/Makefile.am b/plugins/readmc/Makefile.am
index 5f95641..2cf600c 100644
--- a/plugins/readmc/Makefile.am
+++ b/plugins/readmc/Makefile.am
@@ -14,8 +14,10 @@ libreadmc_la_SOURCES =					\
 
 libreadmc_la_CFLAGS = $(AM_CFLAGS)
 
-libreadmc_la_LDFLAGS = -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp \
-	-L$(top_srcdir)/src/.libs -lchrysacore
+libreadmc_la_LDFLAGS =									\
+	-L$(top_srcdir)/src/.libs -lchrysacore				\
+	-L$(top_srcdir)/plugins/mobicore/.libs -lmobicore	\
+	-L$(top_srcdir)/plugins/fmtp/.libs -lfmtp
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
diff --git a/plugins/ropgadgets/Makefile.am b/plugins/ropgadgets/Makefile.am
index eba45cb..7ca97be 100644
--- a/plugins/ropgadgets/Makefile.am
+++ b/plugins/ropgadgets/Makefile.am
@@ -12,7 +12,9 @@ libropgadgets_la_SOURCES =				\
 
 libropgadgets_la_CFLAGS = $(AM_CFLAGS)
 
-libropgadgets_la_LDFLAGS = -L$(top_srcdir)/src/.libs -lchrysacore
+libropgadgets_la_LDFLAGS =					\
+	-L$(top_srcdir)/src/.libs -lchrysacore	\
+	-L$(top_srcdir)/plugins/arm/.libs -larm
 
 
 devdir = $(includedir)/chrysalide-$(subdir)
-- 
cgit v0.11.2-87-g4458