#!/usr/bin/env bash
-# Copyright (C) 1990-2020 Free Software Foundation
+# Copyright (C) 1990-2024 Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
GZIPPROG=gzip
LZIPPROG=lzip
XZPROG=xz
+ZSTDPROG=zstd
SHA256PROG=sha256sum
MAKE=make
CC=gcc
$XZPROG -k -v -9 $package-$ver.tar
}
+# Compress the output with zstd
+do_zstd()
+{
+ package=$1
+ ver=$2
+ echo "==> Zzipping $package-$ver.tar.zst"
+ rm -f $package-$ver.tar.zst
+ $ZSTDPROG -k -v -19 -T0 $package-$ver.tar
+}
+
# Compress the output with all selected compresion methods
do_compress()
{
do_lz $package $ver;;
xz)
do_xz $package $ver;;
+ zstd)
+ do_zstd $package $ver;;
*)
echo "Unknown compression method: $comp" && exit 1;;
esac
echo " -g: Compress with gzip"
echo " -l: Compress with lzip"
echo " -x: Compress with xz"
+ echo " -z: Compress with zstd"
echo " -r <date>: Create a reproducible tarball using <date> as the mtime"
exit 1
}
compressors=""
-while getopts ":bglr:x" opt; do
+while getopts ":bglr:xz" opt; do
case $opt in
b)
compressors="$compressors bz2";;
release_date=$OPTARG;;
x)
compressors="$compressors xz";;
+ z)
+ compressors="$compressors zstd";;
\?)
echo "Invalid option: -$OPTARG" && usage;;
esac