summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-04-17 13:56:56 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-04-17 13:56:56 (GMT)
commit58afc7858cffe180bafbae306db6be66d313b74b (patch)
tree6ccba3064e1b1d49faf1099d3d6fe3c600192819 /plugins
parentb25638b8b13ffa833414c6a7c48fffdac12eda61 (diff)
Remove hardcoded run paths from libraries.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am14
-rw-r--r--plugins/arm/Makefile.am21
-rw-r--r--plugins/bhash/Makefile.am31
-rw-r--r--plugins/bootimg/Makefile.am21
-rw-r--r--plugins/dalvik/Makefile.am25
-rw-r--r--plugins/devdbg/Makefile.am11
-rw-r--r--plugins/dex/Makefile.am21
-rw-r--r--plugins/dexbnf/Makefile.am24
-rw-r--r--plugins/dwarf/Makefile.am13
-rw-r--r--plugins/elf/Makefile.am25
-rw-r--r--plugins/fmtp/Makefile.am11
-rw-r--r--plugins/itanium/Makefile.am21
-rw-r--r--plugins/javadesc/Makefile.am21
-rw-r--r--plugins/libcsem/Makefile.am16
-rw-r--r--plugins/lnxsyscalls/Makefile.am14
-rw-r--r--plugins/mobicore/Makefile.am11
-rw-r--r--plugins/pe/Makefile.am25
-rw-r--r--plugins/pychrysalide/Makefile.am13
-rw-r--r--plugins/pychrysalide/core.c30
-rw-r--r--plugins/readdex/Makefile.am15
-rw-r--r--plugins/readelf/Makefile.am15
-rw-r--r--plugins/readmc/Makefile.am15
-rw-r--r--plugins/ropgadgets/Makefile.am15
-rw-r--r--plugins/winordinals/Makefile.am29
-rw-r--r--plugins/yaml/Makefile.am24
25 files changed, 388 insertions, 93 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 608c927..8d39c37 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -9,24 +9,24 @@ endif
SUBDIRS = \
$(PYTHON3_SUBDIRS) \
arm \
- bhash \
bootimg \
- dex \
- dalvik \
devdbg \
+ dex \
dexbnf \
dwarf \
elf \
fmtp \
itanium \
javadesc \
- libcsem \
- lnxsyscalls \
mobicore \
pe \
+ yaml \
+ bhash \
+ dalvik \
+ libcsem \
+ lnxsyscalls \
readdex \
readelf \
readmc \
ropgadgets \
- winordinals \
- yaml
+ winordinals
diff --git a/plugins/arm/Makefile.am b/plugins/arm/Makefile.am
index 66cff6f..a37cbbd 100644
--- a/plugins/arm/Makefile.am
+++ b/plugins/arm/Makefile.am
@@ -4,22 +4,32 @@ lib_LTLIBRARIES = libarm.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
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
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -43,8 +53,9 @@ libarm_la_LIBADD = \
v7/libarmv7.la
libarm_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/bhash/Makefile.am b/plugins/bhash/Makefile.am
index 44d1c21..45c5ee0 100644
--- a/plugins/bhash/Makefile.am
+++ b/plugins/bhash/Makefile.am
@@ -4,23 +4,36 @@ lib_LTLIBRARIES = libbhash.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
if BUILD_PYTHON3_BINDINGS
-PYTHON3_LIBADD = \
- python/libbhashpython.la
+PYTHON3_LIBADD = python/libbhashpython.la
if BUILD_DISCARD_LOCAL
-PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -35,9 +48,11 @@ libbhash_la_SOURCES = \
libbhash_la_LIBADD = \
$(PYTHON3_LIBADD)
-libbhash_la_LDFLAGS = \
+libbhash_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ -L$(top_srcdir)/plugins/pe/.libs -lpe \
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/bootimg/Makefile.am b/plugins/bootimg/Makefile.am
index 3f8efb7..ada1e4e 100644
--- a/plugins/bootimg/Makefile.am
+++ b/plugins/bootimg/Makefile.am
@@ -4,22 +4,32 @@ lib_LTLIBRARIES = libbootimg.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
if BUILD_PYTHON3_BINDINGS
PYTHON3_LIBADD = python/libbootimgpython.la
if BUILD_DISCARD_LOCAL
-PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -35,8 +45,9 @@ libbootimg_la_LIBADD = \
$(PYTHON3_LIBADD)
libbootimg_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/dalvik/Makefile.am b/plugins/dalvik/Makefile.am
index 0183cfb..644c38a 100644
--- a/plugins/dalvik/Makefile.am
+++ b/plugins/dalvik/Makefile.am
@@ -4,22 +4,36 @@ lib_LTLIBRARIES = libdalvik.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
if BUILD_PYTHON3_BINDINGS
PYTHON3_LIBADD = python/libdalvikpython.la
if BUILD_DISCARD_LOCAL
-PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -46,9 +60,10 @@ libdalvik_la_LIBADD = \
v35/libdalvik35.la
libdalvik_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
-L$(top_srcdir)/plugins/dex/.libs -ldex \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/devdbg/Makefile.am b/plugins/devdbg/Makefile.am
index e2dc7b8..a92744d 100644
--- a/plugins/devdbg/Makefile.am
+++ b/plugins/devdbg/Makefile.am
@@ -4,11 +4,20 @@ lib_LTLIBRARIES = libspeed.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
+
libspeed_la_SOURCES = \
speed.h speed.c
libspeed_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/dex/Makefile.am b/plugins/dex/Makefile.am
index 45003f6..8eb7bde 100644
--- a/plugins/dex/Makefile.am
+++ b/plugins/dex/Makefile.am
@@ -4,22 +4,32 @@ lib_LTLIBRARIES = libdex.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
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
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -41,8 +51,9 @@ libdex_la_LIBADD = \
$(PYTHON3_LIBADD)
libdex_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/dexbnf/Makefile.am b/plugins/dexbnf/Makefile.am
index 3340bc2..51598ce 100644
--- a/plugins/dexbnf/Makefile.am
+++ b/plugins/dexbnf/Makefile.am
@@ -4,22 +4,31 @@ lib_LTLIBRARIES = libdexbnf.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
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
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
PYTHON3_SUBDIRS = python
endif
@@ -36,9 +45,10 @@ libdexbnf_la_SOURCES = \
libdexbnf_la_LIBADD = \
$(PYTHON3_LIBADD)
-libdexbnf_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+libdexbnf_la_LDFLAGS = \
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/dwarf/Makefile.am b/plugins/dwarf/Makefile.am
index 47387db..5a8c9c9 100644
--- a/plugins/dwarf/Makefile.am
+++ b/plugins/dwarf/Makefile.am
@@ -4,6 +4,13 @@ lib_LTLIBRARIES = libdwarf.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
+
libdwarf_la_SOURCES = \
abbrev.h abbrev.c \
checks.h checks.c \
@@ -31,8 +38,10 @@ libdwarf_la_LIBADD = \
v3/libdwarfv3.la \
v4/libdwarfv4.la
-libdwarf_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore
+libdwarf_la_LDFLAGS = \
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/elf/Makefile.am b/plugins/elf/Makefile.am
index 8a8ce5b..880ae78 100644
--- a/plugins/elf/Makefile.am
+++ b/plugins/elf/Makefile.am
@@ -6,22 +6,32 @@ lib_LTLIBRARIES = libelf.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
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
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -44,9 +54,10 @@ libelf_la_SOURCES = \
libelf_la_LIBADD = \
$(PYTHON3_LIBADD)
-libelf_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+libelf_la_LDFLAGS = \
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/fmtp/Makefile.am b/plugins/fmtp/Makefile.am
index 0180111..f365c03 100644
--- a/plugins/fmtp/Makefile.am
+++ b/plugins/fmtp/Makefile.am
@@ -4,12 +4,21 @@ lib_LTLIBRARIES = libfmtp.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
+
libfmtp_la_SOURCES = \
def.h \
parser.h parser.c
libfmtp_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/itanium/Makefile.am b/plugins/itanium/Makefile.am
index ec2e93b..e1b2d9e 100644
--- a/plugins/itanium/Makefile.am
+++ b/plugins/itanium/Makefile.am
@@ -4,22 +4,32 @@ lib_LTLIBRARIES = libitanium.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
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
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -37,8 +47,9 @@ libitanium_la_LIBADD = \
$(PYTHON3_LIBADD)
libitanium_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/javadesc/Makefile.am b/plugins/javadesc/Makefile.am
index e4da266..7a79b99 100644
--- a/plugins/javadesc/Makefile.am
+++ b/plugins/javadesc/Makefile.am
@@ -4,22 +4,32 @@ lib_LTLIBRARIES = libjavadesc.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
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
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -36,8 +46,9 @@ libjavadesc_la_LIBADD = \
$(PYTHON3_LIBADD)
libjavadesc_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/libcsem/Makefile.am b/plugins/libcsem/Makefile.am
index e4d4cca..c55a2f8 100644
--- a/plugins/libcsem/Makefile.am
+++ b/plugins/libcsem/Makefile.am
@@ -4,12 +4,26 @@ lib_LTLIBRARIES = liblibcsem.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
+
liblibcsem_la_SOURCES = \
exit.h exit.c \
semantic.h semantic.c
liblibcsem_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ -L$(top_srcdir)/plugins/elf/.libs -lelf \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/lnxsyscalls/Makefile.am b/plugins/lnxsyscalls/Makefile.am
index c12537c..9c5158f 100644
--- a/plugins/lnxsyscalls/Makefile.am
+++ b/plugins/lnxsyscalls/Makefile.am
@@ -4,6 +4,16 @@ lib_LTLIBRARIES = liblnxsyscalls.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
liblnxsyscalls_la_SOURCES = \
collect.h collect.c \
core.h core.c \
@@ -17,8 +27,10 @@ liblnxsyscalls_la_SOURCES = \
liblnxsyscalls_la_LIBADD =
liblnxsyscalls_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- -L$(top_srcdir)/plugins/arm/.libs -larm
+ -L$(top_srcdir)/plugins/arm/.libs -larm \
+ $(RUN_PATH)
EXTRA_DIST = linux-syscalls.db
diff --git a/plugins/mobicore/Makefile.am b/plugins/mobicore/Makefile.am
index a1a3b08..761108e 100644
--- a/plugins/mobicore/Makefile.am
+++ b/plugins/mobicore/Makefile.am
@@ -4,6 +4,13 @@ lib_LTLIBRARIES = libmobicore.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
+
libmobicore_la_SOURCES = \
core.h core.c \
mclf-def.h \
@@ -12,7 +19,9 @@ libmobicore_la_SOURCES = \
symbols.h symbols.c
libmobicore_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/pe/Makefile.am b/plugins/pe/Makefile.am
index 8e9bca6..038b8c5 100644
--- a/plugins/pe/Makefile.am
+++ b/plugins/pe/Makefile.am
@@ -6,22 +6,32 @@ lib_LTLIBRARIES = libpe.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
if BUILD_PYTHON3_BINDINGS
PYTHON3_LIBADD = python/libpepython.la
if BUILD_DISCARD_LOCAL
-PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -40,9 +50,10 @@ libpe_la_SOURCES = \
libpe_la_LIBADD = \
$(PYTHON3_LIBADD)
-libpe_la_LDFLAGS = \
- -L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+libpe_la_LDFLAGS = \
+ -avoid-version \
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/pychrysalide/Makefile.am b/plugins/pychrysalide/Makefile.am
index b4b20ad..fb3986c 100644
--- a/plugins/pychrysalide/Makefile.am
+++ b/plugins/pychrysalide/Makefile.am
@@ -6,6 +6,13 @@ lib_LTLIBRARIES = pychrysalide.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/chrysalide-libs'
+
+endif
+
+
pychrysalide_la_SOURCES = \
access.h access.c \
core.h core.c \
@@ -28,10 +35,12 @@ pychrysalide_la_LIBADD = \
mangling/libpychrysamangling.la \
plugins/libpychrysaplugins.la
+# -ldl: dladdr(), dlerror()
pychrysalide_la_LDFLAGS = \
- -module -avoid-version \
+ -module -avoid-version -ldl \
$(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) \
- -L$(top_srcdir)/src/.libs -lchrysacore
+ -L$(top_srcdir)/src/.libs -lchrysacore \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/pychrysalide/core.c b/plugins/pychrysalide/core.c
index 38e3c7c..98f94b6 100644
--- a/plugins/pychrysalide/core.c
+++ b/plugins/pychrysalide/core.c
@@ -42,6 +42,7 @@
#include <common/environment.h>
#include <common/extstr.h>
#include <core/core.h>
+#include <core/logs.h>
#include <core/paths.h>
#include <plugins/pglist.h>
#include <plugins/self.h>
@@ -399,6 +400,9 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
PyObject *result; /* Module Python à retourner */
bool status; /* Bilan des inclusions */
int ret; /* Bilan de préparatifs */
+#ifdef PYTHON_PACKAGE
+ Dl_info info; /* Informations dynamiques */
+#endif
GPluginModule *self; /* Représentation interne */
PluginStatusFlags self_flags; /* Fanions à mettre à jour */
@@ -529,6 +533,32 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
set_batch_mode();
+ /**
+ * Si cette extension pour Python est chargée depuis un dépôt Python,
+ * elle ne se trouve pas dans le répertoire classique des extensions et
+ * n'est donc pas chargée et enregistrée comme attendu.
+ *
+ * Cet enregistrement est donc forcé ici.
+ */
+
+#ifdef PYTHON_PACKAGE
+
+ ret = dladdr(__FUNCTION__, &info);
+ if (ret == 0)
+ {
+ LOG_ERROR_DL_N("dladdr");
+ Py_DECREF(result);
+ result = NULL;
+ goto exit;
+ }
+
+ self = g_plugin_module_new(info.dli_fname);
+ assert(self != NULL);
+
+ register_plugin(self);
+
+#endif
+
init_all_plugins(false);
lock_plugin_list_for_reading();
diff --git a/plugins/readdex/Makefile.am b/plugins/readdex/Makefile.am
index e4d961a..b21f855 100644
--- a/plugins/readdex/Makefile.am
+++ b/plugins/readdex/Makefile.am
@@ -4,6 +4,17 @@ lib_LTLIBRARIES = libreaddex.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
+
libreaddex_la_SOURCES = \
class.h class.c \
code.h code.c \
@@ -12,9 +23,11 @@ libreaddex_la_SOURCES = \
reader.h reader.c
libreaddex_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
-L$(top_srcdir)/plugins/dex/.libs -ldex \
- -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp
+ -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/readelf/Makefile.am b/plugins/readelf/Makefile.am
index 35c185d..0ca002b 100644
--- a/plugins/readelf/Makefile.am
+++ b/plugins/readelf/Makefile.am
@@ -4,6 +4,17 @@ lib_LTLIBRARIES = libreadelf.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
+
libreadelf_la_SOURCES = \
header.h header.c \
program.h program.c \
@@ -12,9 +23,11 @@ libreadelf_la_SOURCES = \
strtab.h strtab.c
libreadelf_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
-L$(top_srcdir)/plugins/elf/.libs -lelf \
- -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp
+ -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/readmc/Makefile.am b/plugins/readmc/Makefile.am
index 1c63ccd..fa13fb2 100644
--- a/plugins/readmc/Makefile.am
+++ b/plugins/readmc/Makefile.am
@@ -4,6 +4,17 @@ lib_LTLIBRARIES = libreadmc.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
+
libreadmc_la_SOURCES = \
header.h header.c \
reader.h reader.c \
@@ -13,9 +24,11 @@ libreadmc_la_SOURCES = \
v24.h v24.c
libreadmc_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
-L$(top_srcdir)/plugins/mobicore/.libs -lmobicore \
- -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp
+ -L$(top_srcdir)/plugins/fmtp/.libs -lfmtp \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/ropgadgets/Makefile.am b/plugins/ropgadgets/Makefile.am
index 3cb5e9a..f23e054 100644
--- a/plugins/ropgadgets/Makefile.am
+++ b/plugins/ropgadgets/Makefile.am
@@ -4,6 +4,17 @@ lib_LTLIBRARIES = libropgadgets.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
+
libropgadgets_la_SOURCES = \
finder.h finder.c \
helper.h helper.c \
@@ -12,8 +23,10 @@ libropgadgets_la_SOURCES = \
select.h select.c
libropgadgets_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- -L$(top_srcdir)/plugins/arm/.libs -larm
+ -L$(top_srcdir)/plugins/arm/.libs -larm \
+ $(RUN_PATH)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/winordinals/Makefile.am b/plugins/winordinals/Makefile.am
index 91607f3..f9ff14f 100644
--- a/plugins/winordinals/Makefile.am
+++ b/plugins/winordinals/Makefile.am
@@ -4,23 +4,36 @@ lib_LTLIBRARIES = libwinordinals.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs:$$ORIGIN'
+
+else
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+
+endif
+
if BUILD_PYTHON3_BINDINGS
-PYTHON3_LIBADD = \
- python/libwinordinalspython.la
+PYTHON3_LIBADD = python/libwinordinalspython.la
if BUILD_DISCARD_LOCAL
-PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -38,8 +51,10 @@ libwinordinals_la_LIBADD = \
$(PYTHON3_LIBADD)
libwinordinals_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ -L$(top_srcdir)/plugins/pe/.libs -lpe \
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)
diff --git a/plugins/yaml/Makefile.am b/plugins/yaml/Makefile.am
index 13596e1..9eee4ab 100644
--- a/plugins/yaml/Makefile.am
+++ b/plugins/yaml/Makefile.am
@@ -4,23 +4,32 @@ lib_LTLIBRARIES = libyaml.la
libdir = $(pluginslibdir)
+if BUILD_PYTHON_PACKAGE
+
+RUN_PATH = -Wl,-rpath,'$$ORIGIN/../chrysalide-libs'
+
+endif
+
if BUILD_PYTHON3_BINDINGS
-PYTHON3_LIBADD = \
- python/libyamlpython.la
+PYTHON3_LIBADD = python/libyamlpython.la
if BUILD_DISCARD_LOCAL
-PYTHON3_LDFLAGS = -Wl,-rpath,$(pluginslibdir) \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+if BUILD_PYTHON_PACKAGE
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN/..'
+else
+PYTHON3_RUN_PATH = -Wl,-rpath,'$$ORIGIN'
+endif
else
-PYTHON3_LDFLAGS = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs \
- -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+PYTHON3_RUN_PATH = -Wl,-rpath,$(abs_top_srcdir)/plugins/pychrysalide/.libs
endif
+PYTHON3_LDFLAGS = $(PYTHON3_RUN_PATH) -L$(top_srcdir)/plugins/pychrysalide/.libs -l:pychrysalide.so
+
PYTHON3_SUBDIRS = python
endif
@@ -41,8 +50,9 @@ libyaml_la_LIBADD = \
$(PYTHON3_LIBADD)
libyaml_la_LDFLAGS = \
+ -avoid-version \
-L$(top_srcdir)/src/.libs -lchrysacore \
- $(PYTHON3_LDFLAGS)
+ $(RUN_PATH) $(PYTHON3_LDFLAGS)
devdir = $(includedir)/chrysalide/$(subdir)