aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2022-06-15 21:51:25 +1200
committerChris Packham <judge.packham@gmail.com>2022-06-15 21:51:58 +1200
commit376a289777fcd33465cec5c2e5db35523fa3265a (patch)
treeab017c05b14febaee331c2f969cf31e6bcc7e998
parent618affc78902e86815c908e08a1d0c51832ce7ce (diff)
downloadcrosstool-ng-376a289777fcd33465cec5c2e5db35523fa3265a.tar.gz
crosstool-ng-376a289777fcd33465cec5c2e5db35523fa3265a.tar.bz2
crosstool-ng-376a289777fcd33465cec5c2e5db35523fa3265a.zip
Add option to build toolchain tarball
Add TARBALL_RESULT option that will produce a tarball of the final toolchain to make it easier to deploy the toolchain to other machines. The implementation uses `find | sort` instead of `tar --sort` because this was introduced in GNU Tar v1.28, which is not available in some LTS Linux distributions. This is a variation of the command recommended here: https://wiki.debian.org/ReproducibleBuilds/FileOrderInTarballs Closes #1262 Signed-off-by: Chris Packham <judge.packham@gmail.com>
-rw-r--r--config/global/paths.in28
-rw-r--r--scripts/build/internals.sh15
2 files changed, 43 insertions, 0 deletions
diff --git a/config/global/paths.in b/config/global/paths.in
index 82ee4b39..e4cf7024 100644
--- a/config/global/paths.in
+++ b/config/global/paths.in
@@ -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
diff --git a/scripts/build/internals.sh b/scripts/build/internals.sh
index 821761c2..c4dc81dd 100644
--- a/scripts/build/internals.sh
+++ b/scripts/build/internals.sh
@@ -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
}