@@ -54,6 +54,18 @@ relative-path = $(strip \
$(__r)$(subst /%,%,$(2))))
+# Return the RPATH value starting with XORIGIN instead of $ORIGIN.
+# This helper supports multi-libdirs in RPATH.
+# $1: base directory, e.g. $(HOST_DIR)
+# $2: binary path (should start with base directory)
+# $3: libdirs, a space-separated list of paths (each libdir should
+# start with base directory)
+get_rpaths = $(eval __rp :=) \
+ $(foreach libdir,$(3),\
+ $(eval __rp := $(__rp):XORIGIN/$(call \
+ relative-path,$(dir $(patsubst $(1)%,%,$(2))),$(patsubst $(1)%,%,$(libdir))))) \
+ $(patsubst :%,%,$(__rp))
+
#
# Manipulation of .config files based on the Kconfig
# infrastructure. Used by the BusyBox package, the Linux kernel
This helper computes the value of the RPATH for the given binary. Signed-off-by: Samuel Martin <s.martin49@gmail.com> --- package/pkg-utils.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+)