diff mbox

[1/4] classes/rpath: Added rpath class with chrpath_get_cmd() function

Message ID deef9a584ea2b18ee8c15962e514ac86679c736e.1385196868.git.Morten.ThunbergSvendsen@prevas.dk
State Accepted
Delegated to: Esben Haabendal
Headers show

Commit Message

Morten Svendsen Nov. 23, 2013, 11:12 a.m. UTC
---
 classes/rpath.oeclass | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 classes/rpath.oeclass

Comments

Esben Haabendal Nov. 28, 2013, 8:37 a.m. UTC | #1
Merged to master, thanks.

/Esben
diff mbox

Patch

diff --git a/classes/rpath.oeclass b/classes/rpath.oeclass
new file mode 100644
index 0000000..fc49247
--- /dev/null
+++ b/classes/rpath.oeclass
@@ -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: