Merge pull request #1763 from cpackham/tarball

Add option to build toolchain tarball
This commit is contained in:
Bryan Hundven 2023-01-16 11:11:52 -08:00 committed by GitHub
commit aa6cc4d7f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -137,3 +137,31 @@ config STRIP_TARGET_TOOLCHAIN_EXECUTABLES
An install-strip make target is provided that installs stripped
executables, and may install libraries with unneeded or debugging
sections stripped.
config TARBALL_RESULT
bool
depends on EXPERIMENTAL
prompt "Create binary toolchain tarball"
default n
help
Create tarball of the final binary toolchain.
if TARBALL_RESULT
config TARBALL_RESULT_DIR
string
depends on TARBALL_RESULT
prompt "Output directory"
default "${CT_TOP_DIR}"
help
Directory where tarball will be created.
config TARBALL_RESULT_FILENAME
string
depends on TARBALL_RESULT
prompt "Output filename"
default "toolchain${CT_TOOLCHAIN_PKGVERSION:+-${CT_TOOLCHAIN_PKGVERSION}}-${CT_HOST:+HOST-${CT_HOST}-}${CT_TARGET}"
help
Filename for toolchain tarball, without extension.
endif

View File

@ -31,6 +31,7 @@ do_finish() {
local strip_args
local gcc_version
local exe_suffix
local tarball
CT_DoStep INFO "Finalizing the toolchain's directory"
@ -138,5 +139,19 @@ do_finish() {
CT_InstallCopyingInformation
fi
if [ "${CT_TARBALL_RESULT}" = y ]; then
tarball="${CT_TARBALL_RESULT_DIR}/${CT_TARBALL_RESULT_FILENAME}.tar.xz"
CT_DoLog EXTRA "Creating binary toolchain tarball: ${tarball}"
cp "${CT_TOP_DIR}/.config" "${CT_PREFIX_DIR}/${CT_TOOLCHAIN_PKGVERSION}.config"
(cd "${CT_PREFIX_DIR}" && \
find ./. -print0 | \
LC_ALL=C sort -z | \
tar --numeric-owner --owner=0 --group=0 \
--transform "s,^\./\.,${CT_TARBALL_RESULT_FILENAME},S" \
--no-recursion --null -T - -Jcf "${tarball}")
CT_DoLog EXTRA "Calculating binary toolchain checksum"
sha256sum "${tarball}" > "${tarball}.asc"
fi
CT_EndStep
}