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.
|
|
|
|
|
|
|
|
# Exit on error
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# We wil generate a tarball with a prefix "fish"
|
|
|
|
# git can do that automatically for us via git-archive
|
|
|
|
# but to get the documentation in, we need to make a symlink called "fish"
|
|
|
|
# and tar from that, so that the documentation gets the right prefix
|
|
|
|
|
|
|
|
# Get the current directory, which we'll use for symlinks
|
|
|
|
wd="$PWD"
|
|
|
|
|
|
|
|
# The name of the prefix, which is the directory that you get when you untar
|
|
|
|
prefix="fish"
|
|
|
|
|
2013-06-24 18:12:09 +08:00
|
|
|
# Get the version from git-describe
|
|
|
|
VERSION=`git describe --tags --dirty 2>/dev/null`
|
2013-08-11 23:23:28 +08:00
|
|
|
prefix="$prefix-$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
|
2013-08-11 23:23:28 +08:00
|
|
|
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
|
|
|
|
git archive --format=tar --prefix="$prefix"/ master > "$path"
|
|
|
|
|
|
|
|
# tarball out the documentation
|
|
|
|
make user_doc
|
|
|
|
make share/man
|
2013-06-24 18:12:09 +08:00
|
|
|
echo $VERSION > version
|
2012-07-10 10:41:51 +08:00
|
|
|
cd /tmp
|
|
|
|
rm -f "$prefix"
|
|
|
|
ln -s "$wd" "$prefix"
|
2013-05-17 15:41:06 +08:00
|
|
|
gnutar --append --file="$path" "$prefix"/user_doc/html
|
|
|
|
gnutar --append --file="$path" "$prefix"/share/man
|
2013-06-24 18:12:09 +08:00
|
|
|
gnutar --append --file="$path" "$prefix"/version
|
2012-07-10 10:41:51 +08:00
|
|
|
rm -f "$prefix"
|
|
|
|
|
|
|
|
# gzip it
|
|
|
|
gzip "$path"
|
|
|
|
|
|
|
|
# Output what we did, and the sha1 hash
|
|
|
|
echo "Tarball written to $path".gz
|
|
|
|
openssl sha1 "$path".gz
|