summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-08-06 09:10:08 +0000
committerRichard Purdie <richard@openedhand.com>2007-08-06 09:10:08 +0000
commitdd51fc0ffb02460798d62908e1b2189fc69a9ba4 (patch)
tree20db13df35e9d701ac1fcaa41350376506b3a7c8
parent60b432849111abf7e9325c7a90f0d26435869109 (diff)
downloadpoky-dd51fc0ffb02460798d62908e1b2189fc69a9ba4.tar.gz
package.bbclass: Try stripping files more enthusiastically
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2372 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--meta/classes/package.bbclass16
1 files changed, 11 insertions, 5 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 6dbb7413e2..202e594c08 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -157,27 +157,33 @@ def runstrip(file, d):
157 strip = bb.data.getVar("STRIP", d, 1) 157 strip = bb.data.getVar("STRIP", d, 1)
158 objcopy = bb.data.getVar("OBJCOPY", d, 1) 158 objcopy = bb.data.getVar("OBJCOPY", d, 1)
159 159
160 bb.debug(1, "runstrip: %s %s" % (strip, file))
161
162 newmode = None 160 newmode = None
163 if not os.access(file, os.W_OK): 161 if not os.access(file, os.W_OK):
164 origmode = os.stat(file)[os.stat.ST_MODE] 162 origmode = os.stat(file)[os.stat.ST_MODE]
165 newmode = origmode | os.stat.S_IWRITE 163 newmode = origmode | os.stat.S_IWRITE
166 os.chmod(file, newmode) 164 os.chmod(file, newmode)
167 165
168 bb.mkdirhier(os.path.join(os.path.dirname(file), ".debug")) 166 extraflags = ""
167 if ".so" in file and "shared" in result:
168 extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
169 elif "shared" in result or "executable" in result:
170 extraflags = "--remove-section=.comment --remove-section=.note"
169 171
172 bb.mkdirhier(os.path.join(os.path.dirname(file), ".debug"))
170 debugfile=os.path.join(os.path.dirname(file), ".debug", os.path.basename(file)) 173 debugfile=os.path.join(os.path.dirname(file), ".debug", os.path.basename(file))
171 174
175 stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
176 bb.debug(1, "runstrip: %s" % stripcmd)
177
172 os.system("%s'%s' --only-keep-debug '%s' '%s'" % (pathprefix, objcopy, file, debugfile)) 178 os.system("%s'%s' --only-keep-debug '%s' '%s'" % (pathprefix, objcopy, file, debugfile))
173 ret = os.system("%s'%s' '%s'" % (pathprefix, strip, file)) 179 ret = os.system("%s%s" % (pathprefix, stripcmd))
174 os.system("%s'%s' --add-gnu-debuglink='%s' '%s'" % (pathprefix, objcopy, debugfile, file)) 180 os.system("%s'%s' --add-gnu-debuglink='%s' '%s'" % (pathprefix, objcopy, debugfile, file))
175 181
176 if newmode: 182 if newmode:
177 os.chmod(file, origmode) 183 os.chmod(file, origmode)
178 184
179 if ret: 185 if ret:
180 bb.error("runstrip: %s %s: strip failed" % (strip, file)) 186 bb.error("runstrip: '%s' strip command failed" % stripcmd)
181 187
182 return 1 188 return 1
183 189