altcross: don't hard-code versions of sources

This commit is contained in:
Alexey Sheplyakov 2021-07-29 19:55:36 +04:00
parent 1ca8679a31
commit 6bd130caa8

View File

@ -2,15 +2,15 @@
set -e
set -x
KERNEL_VERSION='5.4'
BINUTILS_VERSION='2.31.1'
GCC_VERSION='8.4.1-20200305'
GLIBC_VERSION='2.27-alt13'
KERNEL_VERSION='5.10'
BINUTILS_VERSION='2.35.2'
GCC_VERSION='10.3.1-20210703'
GLIBC_VERSION='2.32-alt4'
KERNEL_SOURCE="/usr/src/kernel/sources/kernel-source-${KERNEL_VERSION}.tar"
BINUTILS_SOURCE="/usr/src/binutils-source/binutils-${BINUTILS_VERSION}.tar"
GCC_SOURCE="/usr/src/gcc-source/gcc-${GCC_VERSION}.tar"
GLIBC_SOURCE="/usr/src/glibc-source/glibc-${GLIBC_VERSION}.tar"
KERNEL_SOURCE="`find /usr/src/kernel/sources -type f -name 'kernel-source-*.tar'`"
BINUTILS_SOURCE="`find /usr/src/binutils-source -type f -name 'binutils-*.tar'`"
GCC_SOURCE="`find /usr/src/gcc-source -type f -name 'gcc-*.tar'`"
GLIBC_SOURCE="`find /usr/src/glibc-source -type f -name 'glibc-*.tar'`"
TARGET=aarch64-linux-gnu
@ -26,12 +26,13 @@ SYSROOTDIR="$INSTALLDIR/$SYSROOT"
mkdir -p -m755 "$SRCDIR"
cd "$SRCDIR"
tar xf "$KERNEL_SOURCE"
tar xf "$BINUTILS_SOURCE"
tar xf "$GCC_SOURCE"
tar xf "$GLIBC_SOURCE"
mkdir -p -m755 linux binutils gcc glibc
tar -x --strip-components=1 -f "$KERNEL_SOURCE" -C linux
tar -x --strip-components=1 -f "$BINUTILS_SOURCE" -C binutils
tar -x --strip-components=1 -f "$GCC_SOURCE" -C gcc
tar -x --strip-components=1 -f "$GLIBC_SOURCE" -C glibc
cd "gcc-${GCC_VERSION}"
cd "gcc"
sed -i contrib/download_prerequisites -e '/base_url=/s/ftp/http/'
./contrib/download_prerequisites
@ -43,11 +44,11 @@ mkdir -p -m755 \
"$BUILDDIR/obj_binutils" \
"$BUILDDIR/obj_gcc" \
"$BUILDDIR/obj_glibc" \
"$BUILDDIR/obj_kernel" \
"$BUILDDIR/obj_linux" \
make -j$(nproc) \
-C "$SRCDIR/kernel-source-${KERNEL_VERSION}" \
O="$BUILDDIR/obj_kernel" \
-C "$SRCDIR/linux" \
O="$BUILDDIR/obj_linux" \
ARCH=arm64 \
INSTALL_HDR_PATH="$SYSROOTDIR/usr" \
headers_install
@ -55,7 +56,7 @@ make -j$(nproc) \
# binutils
cd "$BUILDDIR/obj_binutils"
../../src/binutils-${BINUTILS_VERSION}/configure \
../../src/binutils/configure \
--target="$TARGET" \
--prefix= \
--with-sysroot="$SYSROOT" \
@ -67,7 +68,7 @@ make -j$(nproc) install DESTDIR="$INSTALLDIR"
# gcc
cd "$BUILDDIR/obj_gcc"
../../src/gcc-${GCC_VERSION}/configure \
../../src/gcc/configure \
--prefix= \
--target=$TARGET \
--enable-languages=c,c++ \
@ -85,7 +86,7 @@ make -j$(nproc) install-gcc DESTDIR="$INSTALLDIR"
# glibc
cd "$BUILDDIR/obj_glibc"
../../src/glibc-${GLIBC_VERSION}/configure \
../../src/glibc/configure \
--prefix=/usr \
--target=$TARGET \
--host=$TARGET \