From 3bdde2147b5912c052ed0945a176867ae563f3ec Mon Sep 17 00:00:00 2001 From: Egor Tsyganchuk Date: Wed, 18 Feb 2026 10:07:30 +0300 Subject: [PATCH] Extract package versions into a single versions.sh file All hardcoded versions are now defined once in versions.sh and sourced by build-toolchain.sh, download_prerequisites.sh, and build-libraries.sh, eliminating the need to update multiple files when changing a version. Co-Authored-By: Claude Sonnet 4.6 --- build-libraries.sh | 10 ++++++---- build-toolchain.sh | 5 +---- download_prerequisites.sh | 18 ++++++++++-------- versions.sh | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 versions.sh diff --git a/build-libraries.sh b/build-libraries.sh index 9e28e96..3ac9dbf 100755 --- a/build-libraries.sh +++ b/build-libraries.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +source "$(dirname "$0")/versions.sh" + # Подготавливаем переменные TOP="$(pwd)" @@ -80,7 +82,7 @@ cd ${TOP} export CFLAGS="" export CXXFLAGS="" -cd "${LIB_BUILD_DIR}/zlib-1.2.13" +cd "${LIB_BUILD_DIR}/zlib-${ZLIB_VER}" ./configure --prefix=${SYSROOT_USR_DIR} --libdir=${SYSROOT_USR_DIR}/lib --static make -j$(nproc) make install @@ -92,7 +94,7 @@ cd ${TOP} export CFLAGS="" export CXXFLAGS="" -cd "${LIB_BUILD_DIR}/openssl-3.0.13" +cd "${LIB_BUILD_DIR}/openssl-${OPENSSL_VER}" ./Configure linux-armv4 \ --prefix=${SYSROOT_USR_DIR} \ --libdir=${SYSROOT_USR_DIR}/lib \ @@ -110,7 +112,7 @@ make install_sw # ================================================================== -cd "${LIB_BUILD_DIR}/LibVNCServer-0.9.14" +cd "${LIB_BUILD_DIR}/LibVNCServer-${LIBVNCSERVER_VER}" rm -rf build mkdir -p build && cd build cmake -S .. -B . \ @@ -146,7 +148,7 @@ make install # ================================================================== -cd "${LIB_BUILD_DIR}/freetype-2.13.2" +cd "${LIB_BUILD_DIR}/freetype-${FREETYPE_VER}" [ -d "build" ] && rm -rf build mkdir -p build && cd build cmake -S .. -B . \ diff --git a/build-toolchain.sh b/build-toolchain.sh index 5dc573e..1abdaa2 100755 --- a/build-toolchain.sh +++ b/build-toolchain.sh @@ -12,10 +12,7 @@ PKG_UCLIBC="uClibc-ng" # ================================================================== # Версии пакетов # ================================================================== -BINUTILS_VER="2.42" -GCC_VER="13.4.0" -LINUX_VER="4.9.224" -UCLIBC_VER="1.0.55" +source "$(dirname "$0")/versions.sh" # ================================================================== # Основные параметры тулчейна diff --git a/download_prerequisites.sh b/download_prerequisites.sh index 7ed4b7e..6f69aea 100755 --- a/download_prerequisites.sh +++ b/download_prerequisites.sh @@ -1,5 +1,7 @@ #!/bin/bash +source "$(dirname "$0")/versions.sh" + # Создаем папки для исходников mkdir -p src/toolchain src/libs @@ -32,18 +34,18 @@ download_files() { # Исходники тулчейна toolchain_files=( - "https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz" - "https://ftp.gnu.org/gnu/gcc/gcc-13.4.0/gcc-13.4.0.tar.xz" - "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.9.224.tar.xz" - "https://downloads.uclibc-ng.org/releases/1.0.55/uClibc-ng-1.0.55.tar.xz" + "https://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VER}.tar.xz" + "https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-${GCC_VER}.tar.xz" + "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${LINUX_VER}.tar.xz" + "https://downloads.uclibc-ng.org/releases/${UCLIBC_VER}/uClibc-ng-${UCLIBC_VER}.tar.xz" ) # Исходники библиотек libs_files=( - "https://download.savannah.gnu.org/releases/freetype/freetype-2.13.2.tar.gz" - "https://github.com/LibVNC/libvncserver/archive/LibVNCServer-0.9.14.tar.gz" - "https://www.openssl.org/source/openssl-3.0.13.tar.gz" - "https://zlib.net/fossils/zlib-1.2.13.tar.gz" + "https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VER}.tar.gz" + "https://github.com/LibVNC/libvncserver/archive/LibVNCServer-${LIBVNCSERVER_VER}.tar.gz" + "https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz" + "https://zlib.net/fossils/zlib-${ZLIB_VER}.tar.gz" ) echo "=== Загрузка исходников тулчейна в 'src/toolchain' ===" diff --git a/versions.sh b/versions.sh new file mode 100644 index 0000000..ae07959 --- /dev/null +++ b/versions.sh @@ -0,0 +1,15 @@ +# ================================================================== +# Версии компонентов тулчейна +# ================================================================== +BINUTILS_VER="2.42" +GCC_VER="13.4.0" +LINUX_VER="4.9.224" +UCLIBC_VER="1.0.34" + +# ================================================================== +# Версии библиотек +# ================================================================== +ZLIB_VER="1.2.13" +OPENSSL_VER="3.0.13" +LIBVNCSERVER_VER="0.9.14" +FREETYPE_VER="2.13.2"