Patchwork [v2,13/28] external-sourcery: use ${prefix} and ${libdir} instead of /usr and /usr/lib

login
register
mail settings
Submitter Javier Martinez Canillas
Date Aug. 5, 2012, 7:48 p.m.
Message ID <1344196136-7643-14-git-send-email-javier@dowhile0.org>
Download mbox | patch
Permalink /patch/33927/
State New
Headers show

Comments

Javier Martinez Canillas - Aug. 5, 2012, 7:48 p.m.
It is considered good practice to use the build system provided
variables instead of directly specify hardcoded paths.

Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
 .../meta/external-sourcery-toolchain.bb            |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Chris Larson - Aug. 5, 2012, 9:34 p.m.
On Sun, Aug 5, 2012 at 12:48 PM, Javier Martinez Canillas
<javier@dowhile0.org> wrote:
> It is considered good practice to use the build system provided
> variables instead of directly specify hardcoded paths.
>
> Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
> ---
>  .../meta/external-sourcery-toolchain.bb            |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-core/meta/external-sourcery-toolchain.bb b/meta/recipes-core/meta/external-sourcery-toolchain.bb
> index 74c82ec..1def79e 100644
> --- a/meta/recipes-core/meta/external-sourcery-toolchain.bb
> +++ b/meta/recipes-core/meta/external-sourcery-toolchain.bb
> @@ -24,7 +24,7 @@ PROVIDES += "\
>         virtual/linux-libc-headers \
>  "
>  PV = "${CSL_VER_MAIN}"
> -PR = "r7"
> +PR = "r8"
>
>  #SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/${CSL_TARGET_SYS}/arm-${PV}-${TARGET_PREFIX}i686-pc-linux-gnu.tar.bz2"
>
> @@ -38,10 +38,10 @@ do_install() {
>         cp -a $sysroot/etc/. ${D}${sysconfdir}
>         cp -a $sysroot/sbin/. ${D}${base_sbindir}
>
> -       install -d ${D}/usr
> +       install -d ${D}${prefix}
>         for usr_element in bin libexec sbin share ${base_libdir}; do
>                 usr_path=$sysroot/usr/$usr_element
> -               cp -a $usr_path ${D}/usr/
> +               cp -a $usr_path ${D}${prefix}/
>         done
>         for datadir_element in man info; do
>                 datadir_path=$sysroot/usr/$datadir_element
> @@ -81,7 +81,7 @@ external_toolchain_sysroot_adjust() {
>
>         # If the usr/lib directory doesn't exist, the toolchain fails to even
>         # try to find crti.o in a completely different directory (usr/lib64)
> -       install -d ${SYSROOT_DESTDIR}/usr/lib
> +       install -d ${SYSROOT_DESTDIR}${libdir}


This is wrong. This line creates usr/lib *explicitly* to cover the
case where libdir is set to something else (e.g. usr/lib64). As the
comment says, the toolchain will fail to search the real libdir if the
usr/lib dir does not exist.
Javier Martinez Canillas - Aug. 5, 2012, 9:53 p.m.
On Sun, Aug 5, 2012 at 11:34 PM, Chris Larson <clarson@kergoth.com> wrote:
> On Sun, Aug 5, 2012 at 12:48 PM, Javier Martinez Canillas
> <javier@dowhile0.org> wrote:
>> It is considered good practice to use the build system provided
>> variables instead of directly specify hardcoded paths.
>>
>> Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
>> ---
>>  .../meta/external-sourcery-toolchain.bb            |    8 ++++----
>>  1 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/recipes-core/meta/external-sourcery-toolchain.bb b/meta/recipes-core/meta/external-sourcery-toolchain.bb
>> index 74c82ec..1def79e 100644
>> --- a/meta/recipes-core/meta/external-sourcery-toolchain.bb
>> +++ b/meta/recipes-core/meta/external-sourcery-toolchain.bb
>> @@ -24,7 +24,7 @@ PROVIDES += "\
>>         virtual/linux-libc-headers \
>>  "
>>  PV = "${CSL_VER_MAIN}"
>> -PR = "r7"
>> +PR = "r8"
>>
>>  #SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/${CSL_TARGET_SYS}/arm-${PV}-${TARGET_PREFIX}i686-pc-linux-gnu.tar.bz2"
>>
>> @@ -38,10 +38,10 @@ do_install() {
>>         cp -a $sysroot/etc/. ${D}${sysconfdir}
>>         cp -a $sysroot/sbin/. ${D}${base_sbindir}
>>
>> -       install -d ${D}/usr
>> +       install -d ${D}${prefix}
>>         for usr_element in bin libexec sbin share ${base_libdir}; do
>>                 usr_path=$sysroot/usr/$usr_element
>> -               cp -a $usr_path ${D}/usr/
>> +               cp -a $usr_path ${D}${prefix}/
>>         done
>>         for datadir_element in man info; do
>>                 datadir_path=$sysroot/usr/$datadir_element
>> @@ -81,7 +81,7 @@ external_toolchain_sysroot_adjust() {
>>
>>         # If the usr/lib directory doesn't exist, the toolchain fails to even
>>         # try to find crti.o in a completely different directory (usr/lib64)
>> -       install -d ${SYSROOT_DESTDIR}/usr/lib
>> +       install -d ${SYSROOT_DESTDIR}${libdir}
>
>
> This is wrong. This line creates usr/lib *explicitly* to cover the
> case where libdir is set to something else (e.g. usr/lib64). As the
> comment says, the toolchain will fail to search the real libdir if the
> usr/lib dir does not exist.
> --
> Christopher Larson
>

Hi Christopher,

Thanks for explaining me this, I didn't know that libdir weren't use on purpose.

This patch can be discarded from the patch-set then.

Best regards,
Javier

Patch

diff --git a/meta/recipes-core/meta/external-sourcery-toolchain.bb b/meta/recipes-core/meta/external-sourcery-toolchain.bb
index 74c82ec..1def79e 100644
--- a/meta/recipes-core/meta/external-sourcery-toolchain.bb
+++ b/meta/recipes-core/meta/external-sourcery-toolchain.bb
@@ -24,7 +24,7 @@  PROVIDES += "\
 	virtual/linux-libc-headers \
 "
 PV = "${CSL_VER_MAIN}"
-PR = "r7"
+PR = "r8"
 
 #SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/${CSL_TARGET_SYS}/arm-${PV}-${TARGET_PREFIX}i686-pc-linux-gnu.tar.bz2"
 
@@ -38,10 +38,10 @@  do_install() {
 	cp -a $sysroot/etc/. ${D}${sysconfdir}
 	cp -a $sysroot/sbin/. ${D}${base_sbindir}
 
-	install -d ${D}/usr
+	install -d ${D}${prefix}
 	for usr_element in bin libexec sbin share ${base_libdir}; do
 		usr_path=$sysroot/usr/$usr_element
-		cp -a $usr_path ${D}/usr/
+		cp -a $usr_path ${D}${prefix}/
 	done
 	for datadir_element in man info; do
 		datadir_path=$sysroot/usr/$datadir_element
@@ -81,7 +81,7 @@  external_toolchain_sysroot_adjust() {
 
 	# If the usr/lib directory doesn't exist, the toolchain fails to even
 	# try to find crti.o in a completely different directory (usr/lib64)
-	install -d ${SYSROOT_DESTDIR}/usr/lib
+	install -d ${SYSROOT_DESTDIR}${libdir}
 }
 
 PACKAGES =+ "libgcc libgcc-dev libstdc++ libstdc++-dev libstdc++-staticdev linux-libc-headers linux-libc-headers-dev gdbserver gdbserver-dbg"