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

Chris Larson
2012-08-05T21:46:19Z

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