All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 9/9] toolchain: speed up sysroot lib copying
Date: Tue, 4 Oct 2011 08:10:42 +0200	[thread overview]
Message-ID: <201110040810.42654.arnout@mind.be> (raw)
In-Reply-To: <201110030055.41126.yann.morin.1998@anciens.enib.fr>


On Monday 03 October 2011 00:55:40, Yann E. MORIN wrote:
> Thomas, Mike, All,
> 
> On Sunday 02 October 2011 21:20:17 Thomas Petazzoni wrote:
> > From: Mike Frysinger <vapier@gentoo.org>
> > 
> > The copy_toolchain_lib_root helper searches the entire sysroot, but is
> > only interested in files in certain subdirs.  So rather than waste time
> > in walking the entire tree, walk the few subdirs at the depth level we
> > are actually going to be poaching files from.
> > 
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> > 
> >  toolchain/helpers.mk |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> > index 7f3efaa..1a72ae5 100644
> > --- a/toolchain/helpers.mk
> > +++ b/toolchain/helpers.mk
> > @@ -22,9 +22,9 @@ copy_toolchain_lib_root = \
> > 
> >  	DESTDIR="$(strip $3)" ; \
> >  	
> >   \
> >   
> >  	LIBS=`(cd $${ARCH_SYSROOT_DIR}; \
> > 
> > -		find -L . -path "./lib/$${LIB}.*"     -o \
> > -			  -path "./usr/lib/$${LIB}.*" -o \
> > -			  -path "./usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib*/$${LIB}.*" \
> > +		find -L \
> > +			$(for d in lib* usr/lib* 
usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib*; do
> > test -e "$d" && echo $d) \
> 
> Just by reading the above line:
> 
> 1) You need to double the '$' here, as it must be interpreted by the shell,
>    not by make.
> 
> 2) Also, the 'for' construct is missing the final 'done':
>   for ...; do ...; done
> 
> 3) You should test for a directory, not for mere existence: test -d "$$d"
> 
> 4) And you also need to quote the second '$$d', as you do when testing for
>    its existence (granteed, not really needed, it's not gonna have a space
>    in it, ever, but for consistency, either you quote both, or you quote
>    none; I prefer quoting).
> 
> So (sorry if the line gets wrapped):
>   $$(for d in lib* usr/lib* usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib*; do test
> -e "$$d" && echo "$$d"; done) \

 But in fact, all of the above is unnecessary.  lib, usr/lib and 
usr/<prefix>/lib should exist anyway, and the shell will only expand the * to 
existing files or directories.  If you want to limit to directories you can 
simply say

find -L lib* usr/lib* usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib* \

> 
> > +			-maxdepth 1 -name "$${LIB}.*" \

 But just to be safe, you can add a 2>/dev/null

 Oh and the exit code of find is fortunately ignored, else you'd have to add a 
|| true as well.

 So, my proposal is one line less:

+               find -L lib* usr/lib* usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib* \
+                       -maxdepth 1 -name "$${LIB}.*" 2>/dev/null || true \

 Note: completely untested

> > 
> >  		)` ; \
> >  	
> >  	for FILE in $${LIBS} ; do \
> >  	
> >  		LIB=`basename $${FILE}`; \
> 
> Regards,
> Yann E. MORIN.


 Regards,
 Arnout
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  31BB CF53 8660 6F88 345D  54CC A836 5879 20D7 CF43

  reply	other threads:[~2011-10-04  6:10 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-02 19:20 [Buildroot] [pull request] Pull request for branch for-2011.11/ext-toolchain-updates Thomas Petazzoni
2011-10-02 19:20 ` [Buildroot] [PATCH 1/9] external toolchain: slightly optimize the copy of the toolchain sysroot Thomas Petazzoni
2011-10-02 21:19   ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 2/9] toolchain-external: allow specifying extra external libraries Thomas Petazzoni
2011-10-02 21:45   ` Yann E. MORIN
2011-10-03  7:21     ` Thomas De Schampheleire
2011-10-04 21:36       ` Yann E. MORIN
2011-10-05  6:20         ` Thomas De Schampheleire
2011-10-05 17:43           ` Yann E. MORIN
2011-10-04 21:37   ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 3/9] ext-toolchain: Add CodeSourcery SH uClinux 2011.03 Thomas Petazzoni
2011-10-02 21:50   ` Yann E. MORIN
2011-10-02 22:13     ` Yann E. MORIN
2011-10-02 22:24       ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 4/9] ext-toolchain: Bump version of CodeSourcery MIPS 2011.03 Thomas Petazzoni
2011-10-02 22:09   ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 5/9] ext-toolchain: Add CodeSourcery SH GNU/Linux 2011.03 Thomas Petazzoni
2011-10-02 22:28   ` Yann E. MORIN
2011-10-03  8:44     ` phil.edworthy at renesas.com
2011-10-02 19:20 ` [Buildroot] [PATCH 6/9] ext-toolchain: Add CodeSoucery x86 GNU/Linux 2010.09 Thomas Petazzoni
2011-10-02 22:35   ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 7/9] ext-toolchain: Take into account Mentor Graphics acquisition of CodeSoucery Thomas Petazzoni
2011-10-02 22:35   ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 8/9] external-toolchain: Slightly optimize toolchain extraction Thomas Petazzoni
2011-10-02 22:40   ` Yann E. MORIN
2011-10-02 19:20 ` [Buildroot] [PATCH 9/9] toolchain: speed up sysroot lib copying Thomas Petazzoni
2011-10-02 22:55   ` Yann E. MORIN
2011-10-04  6:10     ` Arnout Vandecappelle [this message]
2011-10-09 19:40 ` [Buildroot] [pull request] Pull request for branch for-2011.11/ext-toolchain-updates Peter Korsgaard
2011-10-09 20:05   ` Thomas Petazzoni
  -- strict thread matches above, loose matches on Subject: below --
2011-10-09 17:44 [Buildroot] [pull request v2] " Thomas Petazzoni
2011-10-09 17:44 ` [Buildroot] [PATCH 9/9] toolchain: speed up sysroot lib copying Thomas Petazzoni
2011-10-09 21:46   ` Yann E. MORIN
2011-10-10  2:25     ` Mike Frysinger
2011-10-10  6:44       ` Thomas Petazzoni
2011-10-10 15:12         ` Mike Frysinger
2011-10-10 15:19           ` Thomas Petazzoni
2011-10-10 15:22             ` Mike Frysinger
2011-10-10 15:29               ` Thomas Petazzoni
2011-10-10 15:46                 ` Mike Frysinger
2011-10-10  7:57   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110040810.42654.arnout@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.