From: Romain Naour <romain.naour@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3 2/3] toolchain-helpers: factorise the arch sysroot symlink creation
Date: Fri, 28 Nov 2014 22:45:02 +0100 [thread overview]
Message-ID: <5478ECDE.4090207@openwide.fr> (raw)
In-Reply-To: <20141127232116.GP3900@free.fr>
Hi Yann, all,
Le 28/11/2014 00:21, Yann E. MORIN a ?crit :
> Romain, All,
>
> On 2014-11-14 00:03 +0100, Romain Naour spake thusly:
>> The part of copy_toolchain_sysroot function that create the symlink in the
>> staging directory will be used in two different place in the following patch.
>> So factorize this part in a new function called
>> toolchain_create_arch_sysroot_symlink.
>>
>> Signed-off-by: Romain Naour <romain.naour@openwide.fr>
>>
>> ---
>> v3: no change
>> v2: new patch
>> ---
>> toolchain/helpers.mk | 23 +++++++++++++++--------
>> 1 file changed, 15 insertions(+), 8 deletions(-)
>>
>> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
>> index 3121da4..7d7af5f 100644
>> --- a/toolchain/helpers.mk
>> +++ b/toolchain/helpers.mk
>> @@ -83,6 +83,20 @@ copy_toolchain_lib_root = \
>> \
>> echo -n
>>
>> +# Calculate the symlink's depth by counting the number of slashs.
>> +# Then create the symlink to arch sysroot.
>> +# $1: arch specific subdirectory in the sysroot
>> +toolchain_create_arch_sysroot_symlink = \
>> + ARCH_SUBDIR="$(strip $1)"; \
>
> I think I have some problems parsing that...
>
> - $(strip $1) is makefile syntax,
> - $1 is the first argument to the macro,
> - $1 is set to literally $${ARCH_SUBDIR} at the time of the call.
>
> So, you're calling $(strip) which is evaluated by make on a shell
> variable, set in the shell to something that is already $(strip)ed.
>
> I think this assignement should just go away.
>
> Unless I'm too tired and I missed something...
No, you're right, the call to strip is useless.
>
>> + mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \
>> + relpath="./" ; \
>> + nbslashs=`echo -n $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \
>> + for slash in `seq 1 $${nbslashs}` ; do \
>> + relpath=$${relpath}"../" ; \
>> + done ; \
>> + ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
>> + echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}"
>> +
>> #
>> # Copy the full external toolchain sysroot directory to the staging
>> # dir. The operation of this function is rendered a little bit
>> @@ -148,14 +162,7 @@ copy_toolchain_sysroot = \
>> if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
>> cp -a $${SYSROOT_DIR}/usr/include $(STAGING_DIR)/usr ; \
>> fi ; \
>> - mkdir -p `dirname $(STAGING_DIR)/$${ARCH_SUBDIR}` ; \
>> - relpath="./" ; \
>> - nbslashs=`echo -n $${ARCH_SUBDIR} | sed 's%[^/]%%g' | wc -c` ; \
>> - for slash in `seq 1 $${nbslashs}` ; do \
>> - relpath=$${relpath}"../" ; \
>> - done ; \
>> - ln -s $${relpath} $(STAGING_DIR)/$${ARCH_SUBDIR} ; \
>> - echo "Symlinking $(STAGING_DIR)/$${ARCH_SUBDIR} -> $${relpath}" ; \
>> + $(call toolchain_create_arch_sysroot_symlink,$${ARCH_SUBDIR}) ; \
>
> Here you are doing the call with something that is supposed to be
> a shell variable.
>
> Care to review this part, and provide an explanation of what I missed?
Indeed, ARCH_SUBDIR is already stripped.
>
> Regards,
> Yann E. MORIN.
>
>> fi ; \
>> if test -n "$${SUPPORT_LIB_DIR}" ; then \
>> cp -a $${SUPPORT_LIB_DIR}/* $(STAGING_DIR)/lib/ ; \
>> --
>> 1.9.3
>>
>
I'll wait for the review of the last patch before sending v4.
Thanks !
--
Romain Naour
OPEN WIDE Ing?nierie - Paris
23/25, rue Daviel| 75013 PARIS
http://ingenierie.openwide.fr
Le blog des technologies libres et embarqu?es :
http://www.linuxembedded.fr
next prev parent reply other threads:[~2014-11-28 21:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-13 23:03 [Buildroot] [PATCH v3 0/3] toolchain: Add support for Sourcery Codebench Standard Romain Naour
2014-11-13 23:03 ` [Buildroot] [PATCH v3 1/3] toolchain-external: Detect empty or invalid sysroot Romain Naour
2014-11-27 23:06 ` Yann E. MORIN
2014-11-28 21:41 ` Romain Naour
2014-11-13 23:03 ` [Buildroot] [PATCH v3 2/3] toolchain-helpers: factorise the arch sysroot symlink creation Romain Naour
2014-11-27 23:21 ` Yann E. MORIN
2014-11-28 21:45 ` Romain Naour [this message]
2014-11-13 23:03 ` [Buildroot] [PATCH v3 3/3] toolchain-external: calculation of the symlink to the arch sysroot Romain Naour
2014-11-29 12:49 ` Romain Naour
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=5478ECDE.4090207@openwide.fr \
--to=romain.naour@openwide.fr \
--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.