aboutsummaryrefslogtreecommitdiff
path: root/development/rmac/git2targz.sh
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2017-09-08 00:19:33 +0100
committerDavid Spencer <idlemoor@slackbuilds.org>2017-09-08 00:19:33 +0100
commit8c0ffd397b35cadfca32308acb17fb137e307f10 (patch)
tree0e5d6c99336dd5c46d74c9d98c289f65fc22fef0 /development/rmac/git2targz.sh
parentb5365b1f400b9e17b1281b9f885543abe1477894 (diff)
development/rmac: Added (cross assembler for 6502 and 68000).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'development/rmac/git2targz.sh')
-rw-r--r--development/rmac/git2targz.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/development/rmac/git2targz.sh b/development/rmac/git2targz.sh
new file mode 100644
index 0000000000000..282edaaec59d2
--- /dev/null
+++ b/development/rmac/git2targz.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# Create source tarball from git repo, with generated version
+# number. We don't want to include the whole git history in the tarball,
+# but we do want to build the git hash into slack-desc, so there's a bit
+# of extra stuff here.
+
+# Note that this script doesn't need to be run as root. It does
+# need to be able to write to the current directory it's run from.
+
+PRGNAM=rmac
+CLONE_URL=http://shamusworld.gotdns.org/git/$PRGNAM
+
+set -e
+
+GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX )
+rm -rf $GITDIR
+git clone $CLONE_URL $GITDIR
+
+CWD="$( pwd )"
+cd $GITDIR
+
+# get upstream's version number from version.h. easier to do in C than bash.
+cat <<EOF >v.c
+#include <stdio.h>
+#include "version.h"
+int main(int argc, char **argv) {
+ printf("%d.%d.%d\n", MAJOR, MINOR, PATCH);
+ return 0;
+}
+EOF
+
+gcc -o v v.c
+VERSION="$( ./v )"
+rm -f v v.c
+
+DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 )
+VERSION=${VERSION}_$DATE
+
+# git revision stored in gitrev, the SlackBuild seds it into the slack-desc.
+git rev-parse --short HEAD > $PRGNAM.gitrev
+
+# tarball won't contain git history.
+rm -rf .git
+find . -name .gitignore -print0 | xargs -0 rm -f
+
+cd "$CWD"
+rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz
+mv $GITDIR $PRGNAM-$VERSION
+tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION