diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2011-12-31 11:57:15 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2012-03-01 20:26:36 +0100 |
commit | 0729b544b3f943f238042d8169ccb8e2f6c88a95 (patch) | |
tree | b3e0ff33a7711bfa468d0763e0ba0d2d8816d97d /toolchain/helpers.mk | |
parent | b5bebeaebd873af7ca6899ab2b9088d33a429b19 (diff) |
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'toolchain/helpers.mk')
-rw-r--r-- | toolchain/helpers.mk | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 65cc9982d..4c3f2406f 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -10,19 +10,22 @@ # Most toolchains have their libraries either in /lib or /usr/lib # relative to their ARCH_SYSROOT_DIR. Buildroot toolchains, however, # have basic libraries in /lib, and libstdc++/libgcc_s in -# /usr/<target-name>/lib(64). +# /usr/<target-name>/lib(64). Thanks to ARCH_LIB_DIR we also take into +# account toolchains that have the libraries in lib64 and usr/lib64. # # $1: arch specific sysroot directory -# $2: library name -# $3: destination directory of the libary, relative to $(TARGET_DIR) +# $2: library directory ('lib' or 'lib64') from which libraries must be copied +# $3: library name +# $4: destination directory of the libary, relative to $(TARGET_DIR) # copy_toolchain_lib_root = \ ARCH_SYSROOT_DIR="$(strip $1)"; \ - LIB="$(strip $2)"; \ - DESTDIR="$(strip $3)" ; \ + ARCH_LIB_DIR="$(strip $2)" ; \ + LIB="$(strip $3)"; \ + DESTDIR="$(strip $4)" ; \ \ LIBS=`(cd $${ARCH_SYSROOT_DIR}; \ - find -L lib* usr/lib* usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/lib* \ + find -L $${ARCH_LIB_DIR} usr/$${ARCH_LIB_DIR} usr/$(TOOLCHAIN_EXTERNAL_PREFIX)/$${ARCH_LIB_DIR} \ -maxdepth 1 -name "$${LIB}.*" 2>/dev/null \ )` ; \ for FILE in $${LIBS} ; do \ @@ -84,12 +87,14 @@ copy_toolchain_lib_root = \ # $1: main sysroot directory of the toolchain # $2: arch specific sysroot directory of the toolchain # $3: arch specific subdirectory in the sysroot +# $4: directory of libraries ('lib' or 'lib64') # copy_toolchain_sysroot = \ SYSROOT_DIR="$(strip $1)"; \ ARCH_SYSROOT_DIR="$(strip $2)"; \ ARCH_SUBDIR="$(strip $3)"; \ - for i in etc lib sbin usr ; do \ + ARCH_LIB_DIR="$(strip $4)" ; \ + for i in etc $${ARCH_LIB_DIR} sbin usr ; do \ if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \ rsync -au --chmod=Du+w --exclude 'usr/lib/locale' $${ARCH_SYSROOT_DIR}/$$i $(STAGING_DIR)/ ; \ fi ; \ |