summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/prelink/prelink_git.bb93
1 files changed, 93 insertions, 0 deletions
diff --git a/meta/recipes-devtools/prelink/prelink_git.bb b/meta/recipes-devtools/prelink/prelink_git.bb
index 5d9f260f85..0856b1c667 100644
--- a/meta/recipes-devtools/prelink/prelink_git.bb
+++ b/meta/recipes-devtools/prelink/prelink_git.bb
@@ -44,6 +44,99 @@ BBCLASSEXTEND = "native"
44EXTRA_OECONF = "--disable-selinux --with-pkgversion=${PV}-${PR} \ 44EXTRA_OECONF = "--disable-selinux --with-pkgversion=${PV}-${PR} \
45 --with-bugurl=http://bugzilla.yoctoproject.org/" 45 --with-bugurl=http://bugzilla.yoctoproject.org/"
46 46
47
48#
49# For target prelink we need to ensure paths match the lib path layout
50# including for any configured multilibs
51#
52python do_linkerpaths () {
53 values = all_multilib_tune_list(["TUNE_ARCH", "baselib", "ABIEXTENSION"], d)
54
55 arches = values["TUNE_ARCH"]
56 baselibs = values["baselib"]
57 abis = values["ABIEXTENSION"]
58
59 def replace_lines(f, search, replacement, d, firstonly = False, secondonly = False):
60 f = d.expand(f)
61 if search == replacement:
62 return
63 bb.debug(2, "Replacing %s with %s in %s" % (search, replacement, f))
64 with open(f, "r") as data:
65 lines = data.readlines()
66 with open(f, "w") as data:
67 for line in lines:
68 if not secondonly and not firstonly:
69 line = line.replace(search, replacement)
70 elif secondonly and search in line:
71 secondonly = False
72 elif firstonly and search and search in line:
73 line = line.replace(search, replacement)
74 search = None
75 data.write(line)
76
77 def replace_lines_rtld(f, search, replacement, section, d):
78 f = d.expand(f)
79 bb.debug(2, "Replacing %s with %s in %s" % (search, replacement, f))
80 with open(f, "r") as data:
81 lines = data.readlines()
82 found = False
83 found2 = False
84 with open(f, "w") as data:
85 for line in lines:
86 if section in line:
87 if section == "else" and "if" in line:
88 found = False
89 else:
90 found = True
91 if found and "dst_LIB =" in line:
92 found2 = True
93 elif "}" in line:
94 found = False
95 found2 = False
96 if found2:
97 line = line.replace(search, replacement)
98 data.write(line)
99
100 for i, arch in enumerate(arches):
101 tune_baselib = baselibs[i]
102 abi = abis[i]
103
104 bits = 32
105 if arch == "powerpc":
106 replace_lines("${S}/src/arch-ppc.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d)
107 elif arch == "powerpc64":
108 replace_lines("${S}/src/arch-ppc64.c", "/lib64/ld64.so.1", "/" + tune_baselib + "/ld64.so.1", d)
109 bits = 64
110 elif arch == "x86_64":
111 if abi == "x32":
112 replace_lines("${S}/src/arch-x86_64.c", "/libx32/ld-linux-x32.so.2", "/" + tune_baselib + "/ld-linux-x32.so.2", d)
113 else:
114 replace_lines("${S}/src/arch-x86_64.c", "/lib64/ld-linux-x86-64.so.2", "/" + tune_baselib + "/ld-linux-x86-64.so.2", d)
115 bits = 64
116 elif arch == "arm":
117 replace_lines("${S}/src/arch-arm.c", "/lib/ld-linux.so.3", "/" + tune_baselib + "/ld-linux.so.3", d)
118 replace_lines("${S}/src/arch-arm.c", "/lib/ld-linux-armhf.so.3", "/" + tune_baselib + "/ld-linux-armhf.so.3", d)
119 elif arch == "mips" or arch == "mipsel":
120 replace_lines("${S}/src/arch-mips.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d, firstonly=True)
121 replace_lines("${S}/src/arch-mips.c", "/lib32/ld.so.1", "/" + tune_baselib + "/ld.so.1", d)
122 elif arch == "mips64" or arch == "mips64el":
123 replace_lines("${S}/src/arch-mips.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d, secondonly=True)
124 replace_lines("${S}/src/arch-mips.c", "/lib64/ld.so.1", "/" + tune_baselib + "/ld.so.1", d)
125 bits = 64
126 elif arch.endswith("86"):
127 replace_lines("${S}/src/arch-i386.c", "/lib/ld-linux.so.2", "/" + tune_baselib + "/ld-linux.so.2", d)
128 if bits == 32 and tune_baselib != "lib":
129 replace_lines_rtld("${S}/src/rtld/rtld.c", "lib", tune_baselib, "else", d)
130 if bits == 64 and tune_baselib != "lib64":
131 replace_lines_rtld("${S}/src/rtld/rtld.c", "lib64", tune_baselib, "use_64bit", d)
132}
133
134python () {
135 overrides = d.getVar("OVERRIDES", True).split(":")
136 if "class-target" in overrides:
137 bb.build.addtask('do_linkerpaths', 'do_configure', 'do_patch', d)
138}
139
47do_configure_prepend () { 140do_configure_prepend () {
48 # Disable documentation! 141 # Disable documentation!
49 echo "all:" > ${S}/doc/Makefile.am 142 echo "all:" > ${S}/doc/Makefile.am