- Replaced the packaging logic in build-toolchain.sh with a call to the new package-toolchain.sh script for better organization and maintainability. - Added package-toolchain.sh to handle the stripping and archiving of the toolchain, including necessary checks for the installation directory and environment script. - Updated README.md to document the addition of package-toolchain.sh for clarity on the build process.
37 lines
1.0 KiB
Bash
37 lines
1.0 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
source "$(dirname "$0")/versions.sh"
|
|
|
|
TOP="$(pwd)"
|
|
TARGET="${1:-arm-uclinuxfdpiceabi}"
|
|
SUBARCH="${2:-armv7-m}"
|
|
INSTALL_DIR="${3:-${TOP}/build/install}"
|
|
|
|
if [ ! -d "${INSTALL_DIR}" ]; then
|
|
echo "Ошибка: директория установки не найдена: ${INSTALL_DIR}"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "${TOP}/scripts/env.sh" ]; then
|
|
echo "Ошибка: файл окружения не найден: ${TOP}/scripts/env.sh"
|
|
exit 1
|
|
fi
|
|
|
|
echo "== Strip toolchain и упаковка =="
|
|
|
|
WDIR="$(mktemp -d)"
|
|
trap 'rm -rf "$WDIR"' EXIT
|
|
|
|
ARCHIVE_TOOLCHAIN_DIR="${WDIR}/${TARGET}"
|
|
mkdir -p "${ARCHIVE_TOOLCHAIN_DIR}"
|
|
cp -a "${INSTALL_DIR}"/* "${ARCHIVE_TOOLCHAIN_DIR}/"
|
|
cp -a "${TOP}/scripts/env.sh" "${WDIR}/env.sh"
|
|
|
|
find "${ARCHIVE_TOOLCHAIN_DIR}" -type f -executable -exec strip -p {} \; 2>/dev/null || true
|
|
|
|
ARCHIVE_NAME="toolset-jlv-${SUBARCH}-gcc${GCC_VER}-uclibc${UCLIBC_VER}.tar.xz"
|
|
tar -C "${WDIR}" --owner=0 --group=0 -cJf "${ARCHIVE_NAME}" "${TARGET}" "env.sh"
|
|
|
|
echo "Готово: ${ARCHIVE_NAME}"
|