aboutsummaryrefslogtreecommitdiffhomepage
path: root/build_tools
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2016-05-25 16:54:38 +0000
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2016-05-25 16:56:00 +0000
commitb883e59ee97e0fb63e77adc4cf3dfb9ef77e0a10 (patch)
treea49f068ac0a4f14b91975be2bf7abbd0f4d6c685 /build_tools
parent79fa4d5c4a4ba152155d29c74208b6abef3f4d60 (diff)
make_tarball: search for a tar that supports the options we need
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/make_tarball.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/build_tools/make_tarball.sh b/build_tools/make_tarball.sh
index 1231f585..eec9d436 100755
--- a/build_tools/make_tarball.sh
+++ b/build_tools/make_tarball.sh
@@ -14,6 +14,21 @@ set -e
# but to get the documentation in, we need to make a symlink called "fish-VERSION"
# and tar from that, so that the documentation gets the right prefix
+# We need GNU tar as that supports the --mtime option
+# BSD tar supports --mtree but keeping them in sync sounds too hard
+TAR=notfound
+for try in tar gtar gnutar; do
+ if $try -Pcf /dev/null --mtime now /dev/null >/dev/null 2>&1; then
+ TAR=$try
+ break
+ fi
+done
+
+if [ "$TAR" = "notfound" ]; then
+ echo 'No suitable tar (supporting --mtime) found as tar/gtar/gnutar in PATH'
+ exit 1
+fi
+
# Get the current directory, which we'll use for symlinks
wd="$PWD"
@@ -43,7 +58,7 @@ echo $VERSION > version
cd /tmp
rm -f "$prefix"
ln -s "$wd" "$prefix"
-TAR_APPEND="gnutar --append --file=$path --mtime=now --owner=0 --group=0 --mode=g+w,a+rX"
+TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 --mode=g+w,a+rX"
$TAR_APPEND --no-recursion "$prefix"/user_doc
$TAR_APPEND "$prefix"/user_doc/html "$prefix"/share/man
$TAR_APPEND "$prefix"/version