Add toolchain rules

This commit is contained in:
NADAL Jean-Baptiste
2019-10-25 18:35:14 +02:00
parent c1075f68da
commit 36af1b0874
10 changed files with 170 additions and 2 deletions

35
bsp/scripts/toolchain_build.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Catch build Error
function error {
echo "Docker build Failed."
exit 1;
}
cross_compiler_path=$1
delivery_path=$2
echo "Cross Compiler Path: $cross_compiler_path"
echo "Delivery Path: $delivery_path"
BASE=`$cross_compiler_path/bin/*-*-gcc --version | head -n 1 | cut -d ' ' -f 1 | cut -d '.' -f 1`
GCC_VERSION=`$cross_compiler_path/bin/*-*-gcc --version | head -n 1 | cut -d ' ' -f 4`
VERSION=`$cross_compiler_path/bin/*-*-gcc --version | head -n 1 | cut -d ' ' -f 3 | cut -d '-' -f 1`
LIBC=unknown
cat configs/toolchain_defconfig | grep BR2_TOOLCHAIN_BUILDROOT_GLIBC
if test $? -eq 0; then LIBC=glibc; fi
cat configs/toolchain_defconfig | grep BR2_TOOLCHAIN_BUILDROOT_UCLIBC
if test $? -eq 0; then LIBC=uclibc; fi
cat configs/toolchain_defconfig | grep BR2_TOOLCHAIN_BUILDROOT_MUSL
if test $? -eq 0; then LIBC=musl; fi
echo "BASE: $BASE"
echo "GCC_VERSION: $GCC_VERSION"
echo "VERSION: $VERSION"
echo "LIBC: $LIBC"
mkdir -p $delivery_path
cd $cross_compiler_path
tar cvzf $delivery_path/toochain_${BASE}-${GCC_VERSION}-${LIBC}-${VERSION}.tgz .