2012-05-10 17:11:28 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-07-10 10:41:51 +08:00
|
|
|
# Script to generate a tarball
|
|
|
|
# We use git to output a tree. But we also want to build the user documentation
|
|
|
|
# and put that in the tarball, so that nobody needs to have doxygen installed
|
|
|
|
# to build it.
|
2016-05-26 00:51:04 +08:00
|
|
|
# Outputs to $FISH_ARTEFACT_PATH or ~/fish_built by default
|
2012-07-10 10:41:51 +08:00
|
|
|
|
|
|
|
# Exit on error
|
|
|
|
set -e
|
|
|
|
|
2016-05-26 00:49:53 +08:00
|
|
|
# We wil generate a tarball with a prefix "fish-VERSION"
|
2012-07-10 10:41:51 +08:00
|
|
|
# git can do that automatically for us via git-archive
|
2016-05-26 00:49:53 +08:00
|
|
|
# but to get the documentation in, we need to make a symlink called "fish-VERSION"
|
2012-07-10 10:41:51 +08:00
|
|
|
# and tar from that, so that the documentation gets the right prefix
|
|
|
|
|
2016-05-26 00:54:38 +08:00
|
|
|
# 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
|
|
|
|
|
2012-07-10 10:41:51 +08:00
|
|
|
# Get the current directory, which we'll use for symlinks
|
|
|
|
wd="$PWD"
|
|
|
|
|
2013-06-24 18:12:09 +08:00
|
|
|
# Get the version from git-describe
|
2014-01-24 20:51:06 +08:00
|
|
|
VERSION=`git describe --dirty 2>/dev/null`
|
2016-05-26 00:49:53 +08:00
|
|
|
|
|
|
|
# The name of the prefix, which is the directory that you get when you untar
|
|
|
|
prefix="fish-$VERSION"
|
2013-06-24 18:12:09 +08:00
|
|
|
|
2012-07-10 10:41:51 +08:00
|
|
|
# The path where we will output the tar file
|
2016-05-26 00:51:04 +08:00
|
|
|
# Defaults to ~/fish_built
|
|
|
|
path=${FISH_ARTEFACT_PATH:-~/fish_built}/$prefix.tar
|
2012-07-10 10:41:51 +08:00
|
|
|
|
|
|
|
# Clean up stuff we've written before
|
|
|
|
rm -f "$path" "$path".gz
|
|
|
|
|
|
|
|
# git starts the archive
|
2014-09-07 09:37:43 +08:00
|
|
|
git archive --format=tar --prefix="$prefix"/ HEAD > "$path"
|
2012-07-10 10:41:51 +08:00
|
|
|
|
2013-09-06 10:43:43 +08:00
|
|
|
# tarball out the documentation, generate a configure script and version file
|
2016-11-27 07:02:19 +08:00
|
|
|
autoreconf --no-recursive
|
2013-09-09 20:08:37 +08:00
|
|
|
./configure --with-doxygen
|
2016-03-31 06:35:14 +08:00
|
|
|
make doc share/man
|
2013-06-24 18:12:09 +08:00
|
|
|
echo $VERSION > version
|
2016-05-26 00:55:40 +08:00
|
|
|
|
|
|
|
PREFIX_TMPDIR=`mktemp -d`
|
|
|
|
cd $PREFIX_TMPDIR
|
|
|
|
|
2012-07-10 10:41:51 +08:00
|
|
|
ln -s "$wd" "$prefix"
|
2016-05-26 00:54:38 +08:00
|
|
|
TAR_APPEND="$TAR --append --file=$path --mtime=now --owner=0 --group=0 --mode=g+w,a+rX"
|
2013-09-09 20:08:37 +08:00
|
|
|
$TAR_APPEND --no-recursion "$prefix"/user_doc
|
|
|
|
$TAR_APPEND "$prefix"/user_doc/html "$prefix"/share/man
|
|
|
|
$TAR_APPEND "$prefix"/version
|
|
|
|
$TAR_APPEND "$prefix"/configure "$prefix"/config.h.in
|
2016-05-26 00:55:40 +08:00
|
|
|
rm "$prefix"/version
|
|
|
|
unlink "$prefix"
|
|
|
|
|
|
|
|
cd -
|
|
|
|
rmdir $PREFIX_TMPDIR
|
2012-07-10 10:41:51 +08:00
|
|
|
|
|
|
|
# gzip it
|
|
|
|
gzip "$path"
|
|
|
|
|
|
|
|
# Output what we did, and the sha1 hash
|
|
|
|
echo "Tarball written to $path".gz
|
2016-05-23 07:11:26 +08:00
|
|
|
openssl dgst -sha256 "$path".gz
|