new file mode 100644
@@ -0,0 +1,47 @@
+## rpath helper functions
+##
+
+CHRPATH_BUILD ?= "${BUILD_PREFIX}chrpath"
+CHRPATH_HOST ?= "${HOST_PREFIX}chrpath"
+CHRPATH_TARGET ?= "${TARGET_PREFIX}chrpath"
+
+CLASS_DEPENDS += "${CHRPATH_DEPENDS}"
+CHRPATH_DEPENDS:native = "${CHRPATH_DEPENDS_NATIVE}"
+CHRPATH_DEPENDS:cross = "${CHRPATH_DEPENDS_NATIVE} ${CHRPATH_DEPENDS_HOST}"
+CHRPATH_DEPENDS:machine = "${CHRPATH_DEPENDS_HOST}"
+CHRPATH_DEPENDS:sdk-cross = "${CHRPATH_DEPENDS_NATIVE} ${CHRPATH_DEPENDS_HOST}"
+CHRPATH_DEPENDS:sdk = "${CHRPATH_DEPENDS_HOST}"
+CHRPATH_DEPENDS:canadian-cross = "${CHRPATH_DEPENDS_NATIVE} ${CHRPATH_DEPENDS_HOST} ${CHRPATH_DEPENDS_TARGET}"
+CHRPATH_DEPENDS_NATIVE = "native:chrpath"
+CHRPATH_DEPENDS_HOST = "host-cross:chrpath"
+CHRPATH_DEPENDS_HOST:HOST_LIBC_mingw = ""
+CHRPATH_DEPENDS_TARGET = "target-cross:chrpath"
+CHRPATH_DEPENDS_TARGET:TARGET_LIBC_mingw = ""
+
+def chrpath_get_cmd(d,filetype):
+
+ chrpath_cmd = {}
+ for elf_type in ("BUILD", "HOST", "TARGET"):
+ chrpath_cmd[elf_type] = (d.get("%s_ELF"%(elf_type)),
+ d.get("CHRPATH_%s"%(elf_type)))
+ if chrpath_cmd["TARGET"][0] == chrpath_cmd["HOST"][0]:
+ del chrpath_cmd["TARGET"]
+ if chrpath_cmd["HOST"][0] == chrpath_cmd["BUILD"][0]:
+ del chrpath_cmd["HOST"]
+ for elf_type in chrpath_cmd:
+ if not chrpath_cmd[elf_type][0]:
+ del chrpath_cmd[elf_type]
+ else:
+ chrpath_cmd[elf_type] = (re.compile(chrpath_cmd[elf_type][0]),
+ chrpath_cmd[elf_type][1])
+
+ if not "dynamically linked" in filetype:
+ return None
+ for elf_type in chrpath_cmd:
+ if chrpath_cmd[elf_type][0].match(filetype):
+ return chrpath_cmd[elf_type][1]
+ return None
+
+# Local Variables:
+# mode: python
+# End: