summaryrefslogtreecommitdiffstats
path: root/create-tarball-from-git.sh
diff options
context:
space:
mode:
Diffstat (limited to 'create-tarball-from-git.sh')
-rw-r--r--create-tarball-from-git.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/create-tarball-from-git.sh b/create-tarball-from-git.sh
new file mode 100644
index 0000000..e23aadf
--- /dev/null
+++ b/create-tarball-from-git.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+set -e
+set -x
+
+CURRENTDIR=$(pwd)
+PKGNAME=oniguruma
+TARNAME=onig
+
+TMPDIR=$(mktemp -d /var/tmp/$PKGNAME-XXXXXX)
+pushd $TMPDIR
+
+GITSCM=https://github.com/kkos/$PKGNAME.git
+
+git clone $GITSCM
+pushd $PKGNAME
+
+COMMIT=$(git log | head -n 1 | sed -e 's|^.*[ \t]||')
+SHORTCOMMIT=$(echo $COMMIT | cut -c-7)
+DATE=$(git show --format=%ci $COMMIT | head -n 1 | sed -e 's|[ \t].*$||')
+SHORTDATE=$(echo $DATE | sed -e 's|-||g')
+VERSION=$(cat configure.ac | grep AC_INIT | sed -n -e 's|^.*,[ \t]*\([0-9\.][0-9\.]*\).*$|\1|p')
+
+git log --format=fuller | head -n 12
+
+echo "VERSION=$VERSION"
+echo "COMMIT=$COMMIT"
+echo "DATE=$DATE"
+
+echo
+popd
+
+TARDIR=${TARNAME}-${VERSION}-${SHORTDATE}git${SHORTCOMMIT}
+ln -sf $PKGNAME $TARDIR
+tar czf ${TARDIR}.tar.gz ${TARDIR}/./
+
+mv ${TARDIR}.tar.gz ${CURRENTDIR}/
+popd
+
+rm -rf $TMPDIR
+