fixing build
[profile/ivi/connman-qt.git] / makedist
1 #!/bin/bash
2
3
4
5
6 # Determine project name based on current directory
7 #PROJECT=$(basename $PWD)
8 PROJECT=connman-qt
9
10 # NOTE: Don't like this?  Then uncomment one of the following as appropriate
11 #
12 # Just set it explictly to whatever you like:
13 # PROJECT=libseaside
14 #
15 # Parse it from any Qt *.pro or *.pri files in CWD:
16 # PROJECT=$(grep -E "TARGET ?= ?" *.pr[io]|cut -d' ' -f3)
17
18 while getopts ht: o
19 do   case $o in
20    h)   head=1;;
21    t)   TAG="$OPTARG";;
22    ?) printf >&2 "Usage: $0 [-h] [-t TAG]\n"
23       exit 2;;
24    esac
25 done
26
27 # Grab most recent tag from git unless TAG is set
28 if [ -z "$TAG" ] ; then 
29   TAG=$(git describe --tags --abbrev=0)
30 fi
31
32 # Parse out just the version number
33 #PARTS=(${TAG//-/ })
34 #VERSION=${PARTS[1]}
35 VERSION=${TAG}
36
37 # Set name of toplevel directory for the archive
38 PREFIX="${PROJECT}-${VERSION}/"
39
40 # Set name of resulting release archive file
41 ARCHIVE=${PROJECT}-${VERSION}.tar.bz2
42
43 [ -e ${ARCHIVE} ] && rm -rf ${ARCHIVE} && echo "Removed: ${ARCHIVE}"
44
45 if [ ! -z "$head" ] ; then
46   TAG="HEAD"
47 fi
48
49 git archive --format=tar --prefix=${PREFIX} $TAG | bzip2 -c -- > ${ARCHIVE} && {
50         echo "Created: ${ARCHIVE}"
51 } || {
52         echo "Creation of release archive ${ARCHIVE} failed.  Reason unknown."
53 }