From patchwork Wed Aug 6 19:16:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Diorcet X-Patchwork-Id: 377356 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [IPv6:2001:878:346::102]) by ozlabs.org (Postfix) with ESMTP id C9B421400AA for ; Thu, 7 Aug 2014 05:17:22 +1000 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id 7DB473FB81 for ; Wed, 6 Aug 2014 21:17:21 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by hugin.dotsrc.org (Postfix) with ESMTPS id D815C3FC85 for ; Wed, 6 Aug 2014 21:17:19 +0200 (CEST) Received: by mail-wi0-f169.google.com with SMTP id n3so10087290wiv.0 for ; Wed, 06 Aug 2014 12:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tGIOrVIsIjct3l94SafFEEtsXM8Rq76WCINUwAmqtEQ=; b=WmnXiRLFuxmvmJVPPPALI6mLvZkcu7urxMHiCfCmlZPkAVyzH6w00VmMlcMsAc46vw YnsIeEfiErano0y0uU4S/YChjChTfeTiv+46ZJUlYWGcW7u7pBhuHr9wiutep1w0QXSB TZ7TAyZa5mrQ+bfnj3/u5CLZQEj0p0wkrfj2UP6kOameeZy27dvP8ZRbzntO7Qjfs1HK gOgGH0AM3koSNvSoQoXNCL5xuhCeuqqQWb7FXcPTQmjxLGr4edFxXuSFkpNAWqAN5ct3 CHvwqIAVMtQpBBYl6TMLHFlosS7dVJmP/6RbDGfyNhSfIPyGOUkHi7E3STLQvflML/UJ oZ9w== X-Received: by 10.194.158.226 with SMTP id wx2mr18460582wjb.107.1407352639015; Wed, 06 Aug 2014 12:17:19 -0700 (PDT) Received: from localhost.localdomain (mut38-h01-31-33-249-220.dsl.sta.abo.bbox.fr. [31.33.249.220]) by mx.google.com with ESMTPSA id ej10sm21057792wib.12.2014.08.06.12.17.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Aug 2014 12:17:18 -0700 (PDT) From: Yann Diorcet To: dev@oe-lite.org Subject: [PATCH 13/20] Fix strip for mingw and darwin Date: Wed, 6 Aug 2014 21:16:44 +0200 Message-Id: <1407352611-7652-13-git-send-email-diorcet.yann@gmail.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1407352611-7652-1-git-send-email-diorcet.yann@gmail.com> References: <1407352611-7652-1-git-send-email-diorcet.yann@gmail.com> X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org --- classes/core.oeclass | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/classes/core.oeclass b/classes/core.oeclass index 17d7d92..244182c 100644 --- a/classes/core.oeclass +++ b/classes/core.oeclass @@ -130,7 +130,8 @@ def do_install_strip(d): file = os.path.join(root, f) if os.path.islink(file) or os.path.isdir(file): continue - if isexec(file) or ".so" in os.path.basename(file): + basename = os.path.basename(file) + if isexec(file) or (".so" in basename) or (".dll" in basename) or (".dylib" in basename): runstrip(file, d) def runstrip(file, d): @@ -152,7 +153,7 @@ def runstrip(file, d): bb.error("runstrip() unable to determine file type: %s"%(file)) return - if "not stripped" not in filetype: + if "stripped" in filetype and not "not stripped" in filetype: print "runstrip() skip %s"%(file) return target_elf = d.getVar('TARGET_ELF', True) @@ -197,10 +198,16 @@ def runstrip(file, d): os.chmod(file, newmode) extraflags = "" - if ".so" in file and "shared" in filetype: - extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded" + if (".so" in file) or (".dll" in file) or (".dylib" in file) and "shared" in filetype: + if d.getVar('TARGET_OS', True) == "darwin": + extraflags = "-S -x -X" + else: + extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded" elif "shared" in filetype or "executable" in filetype: - extraflags = "--remove-section=.comment --remove-section=.note" + if d.getVar('TARGET_OS', True) == "darwin": + extraflags = "-S -x -X" + else: + extraflags = "--remove-section=.comment --remove-section=.note" oelite.util.makedirs(os.path.join(os.path.dirname(file), ".debug")) debugfile=os.path.join(os.path.dirname(file), ".debug", os.path.basename(file)) @@ -209,21 +216,25 @@ def runstrip(file, d): objcpcmd = "'%s' --only-keep-debug '%s' '%s'" % (objcopy, file, debugfile) objlncmd = "'%s' --add-gnu-debuglink='%s' '%s'" % (objcopy, debugfile, file) - print "runstrip() %s"%(objcpcmd) + if d.getVar('TARGET_OS', True) <> "darwin": + print "runstrip() %s"%(objcpcmd) print "runstrip() %s"%(stripcmd) - print "runstrip() %s"%(objlncmd) + if d.getVar('TARGET_OS', True) <> "darwin": + print "runstrip() %s"%(objlncmd) - ret, result = commands.getstatusoutput("%s%s" % (pathprefix, objcpcmd)) - if ret: - bb.note("runstrip() '%s' %s" % (objcpcmd,result)) + if d.getVar('TARGET_OS', True) <> "darwin": + ret, result = commands.getstatusoutput("%s%s" % (pathprefix, objcpcmd)) + if ret: + bb.note("runstrip() '%s' %s" % (objcpcmd,result)) ret, result = commands.getstatusoutput("%s%s" % (pathprefix, stripcmd)) if ret: bb.note("runstrip() '%s' %s" % (stripcmd,result)) - ret, result = commands.getstatusoutput("%s%s" % (pathprefix, objlncmd)) - if ret: - bb.note("runstrip() '%s' %s" % (objlncmd,result)) + if d.getVar('TARGET_OS', True) <> "darwin": + ret, result = commands.getstatusoutput("%s%s" % (pathprefix, objlncmd)) + if ret: + bb.note("runstrip() '%s' %s" % (objlncmd,result)) if newmode: os.chmod(file, origmode)