diff options
author | Chris Packham <judge.packham@gmail.com> | 2022-06-15 21:51:25 +1200 |
---|---|---|
committer | Chris Packham <judge.packham@gmail.com> | 2022-06-15 21:51:58 +1200 |
commit | 376a289777fcd33465cec5c2e5db35523fa3265a (patch) | |
tree | ab017c05b14febaee331c2f969cf31e6bcc7e998 /scripts/build | |
parent | 618affc78902e86815c908e08a1d0c51832ce7ce (diff) | |
download | crosstool-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>
Diffstat (limited to 'scripts/build')
-rw-r--r-- | scripts/build/internals.sh | 15 |
1 files changed, 15 insertions, 0 deletions
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 } |