aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/build-aux
diff options
context:
space:
mode:
authorDavid M. Syzdek <syzdek@bindlebinaries.com>2012-03-30 15:55:49 -0800
committerDavid M. Syzdek <syzdek@bindlebinaries.com>2012-03-30 15:55:49 -0800
commita00c8d74521b085f48ab979972e89ed8465c4eda (patch)
tree0b019d34fb16998b85a268025f0ac62b4361c783 /build-aux
parentef4cb2d47a44223f09a9f96b81af3cc28126e8b2 (diff)
downloadldap-utils-a00c8d74521b085f48ab979972e89ed8465c4eda.tar.gz
ldap-utils-a00c8d74521b085f48ab979972e89ed8465c4eda.tar.bz2
ldap-utils-a00c8d74521b085f48ab979972e89ed8465c4eda.tar.xz
ldap-utils-a00c8d74521b085f48ab979972e89ed8465c4eda.zip
Updating git-package-version script.
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/.gitignore3
-rwxr-xr-xbuild-aux/git-package-version.sh88
2 files changed, 78 insertions, 13 deletions
diff --git a/build-aux/.gitignore b/build-aux/.gitignore
index 0f69d8e..82bea89 100644
--- a/build-aux/.gitignore
+++ b/build-aux/.gitignore
@@ -2,6 +2,9 @@
2/config.guess 2/config.guess
3/config.sub 3/config.sub
4/depcomp 4/depcomp
5/git-package-version-prefix.h
6/git-package-version.h
7/git-package-version.txt
5/install-sh 8/install-sh
6/ltmain.sh 9/ltmain.sh
7/missing 10/missing
diff --git a/build-aux/git-package-version.sh b/build-aux/git-package-version.sh
index d182dd4..8c10f64 100755
--- a/build-aux/git-package-version.sh
+++ b/build-aux/git-package-version.sh
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# ODBC Shell 3# Bindle Binaries Objective-C Kit
4# Copyright (C) 2011 Bindle Binaries <syzdek@bindlebinaries.com>. 4# Copyright (c) 2012, Bindle Binaries
5# 5#
6# @BINDLE_BINARIES_BSD_LICENSE_START@ 6# @BINDLE_BINARIES_BSD_LICENSE_START@
7# 7#
@@ -32,28 +32,90 @@
32# 32#
33# @BINDLE_BINARIES_BSD_LICENSE_END@ 33# @BINDLE_BINARIES_BSD_LICENSE_END@
34# 34#
35# @configure_input@
36#
37# build-aux/git-package-version.sh - determines Git version if available 35# build-aux/git-package-version.sh - determines Git version if available
38# 36#
39 37
38# saves srcdir from command line arguments
40if test "x${1}" == "x";then 39if test "x${1}" == "x";then
41 echo "Usage: ${0} srcdir version" 1>&2; 40 echo "Usage: ${0} srcdir [ savedir ]" 1>&2;
42 exit 1; 41 exit 1;
43fi; 42fi;
44
45SRCDIR=$1; 43SRCDIR=$1;
46PACKAGE_VERSION=$2; 44
45# saves savedir from command line arguments
46OUTDIR="${SRCDIR}/build-aux"
47if test "x${2}" != "x";then
48 OUTDIR="${2}"
49 if test ! -d "${OUTDIR}";then
50 echo "${0}: ${OUTDIR}: directory does not exist" 1>&2;
51 exit 1;
52 fi
53fi;
54
55GPV="" # git project version (XXX.YYY.ZZZ.gCCC)
56GBV="" # git build version (gCCC)
57GAV="" # git application version (XXX.YYY.ZZZ)
58
59# set default file names
60if test "x${GIT_VERSION_FILE}" == "x";then
61 GIT_VERSION_FILE="${OUTDIR}/git-package-version.txt"
62fi
63if test "x${GIT_VERSION_HEADER}" == "x";then
64 GIT_VERSION_HEADER="${OUTDIR}/git-package-version.h"
65fi
66if test "x${GIT_VERSION_PREFIX_HEADER}" == "x";then
67 GIT_VERSION_PREFIX_HEADER="${OUTDIR}/git-package-version-prefix.h"
68fi
69
70# sets default directories
71GIT_VERSION_FILE_DIR=`dirname ${GIT_VERSION_FILE}`
72GIT_VERSION_HEADER_DIR=`dirname ${GIT_VERSION_HEADER}`
73GIT_VERSION_PREFIX_HEADER_DIR=`dirname ${GIT_VERSION_PREFIX_HEADER}`
47 74
48if test -f ${SRCDIR}/.git/config;then 75if test -f ${SRCDIR}/.git/config;then
49 GPV=`git --git-dir=${SRCDIR}/.git describe --abbrev=7 HEAD 2> /dev/null`; 76 # retrieve raw output of git describe
50 GPV=`echo ${GPV} |sed -e 's/-/./g'`; 77 RAW=`git --git-dir=${SRCDIR}/.git describe --long --abbrev=7 HEAD 2> /dev/null`;
51 GPV=`echo ${GPV} |sed -e 's/^v//g'`; 78
79 # calculate GBV from raw output of git describe
80 GBV=`echo ${RAW} |cut -d- -f3`;
81
82 # calculate GPV from raw output of git describe
83 GPV=`echo ${RAW} |sed -e 's/-/./g' -e 's/^v//g'`;
84
85 # calculate GAV from GPV
86 GAV=`echo ${GPV} |sed -e 's/\.g[[:xdigit:]]\{0,\}$//g' -e 's/\.0$//g'`;
87
88 # write data to file and display results
52 if test "x${GPV}" != "x";then 89 if test "x${GPV}" != "x";then
53 if test -d ${SRCDIR}/build-aux;then 90 rm -f ${GIT_VERSION_FILE} ${GIT_VERSION_HEADER} ${GIT_VERSION_PREFIX_HEADER}
54 echo "${GPV}" > ${SRCDIR}/build-aux/git-package-version 2> /dev/null; 91
92 # writes git version file
93 if test -d ${GIT_VERSION_FILE_DIR};then
94 echo "${GPV}" > ${GIT_VERSION_FILE}; 2>&1
95 fi
96
97 # writes git version C header
98 if test -d ${GIT_VERSION_HEADER_DIR};then
99 echo "#define GIT_PACKAGE_VERSION \"${GPV}\"" > ${GIT_VERSION_HEADER}; 2>&1
100 echo "#define GIT_APPLICATION_VERSION \"${GAV}\"" >> ${GIT_VERSION_HEADER}; 2>&1
101 echo "#define GIT_BUILD_VERSION \"${GBV}\"" >> ${GIT_VERSION_HEADER}; 2>&1
102 fi
103
104 # writes git version Info.plist preprocessor prefix file
105 if test -d ${GIT_VERSION_PREFIX_HEADER_DIR};then
106 echo "#define GIT_PACKAGE_VERSION ${GPV}" > ${GIT_VERSION_PREFIX_HEADER}; 2>&1
107 echo "#define GIT_APPLICATION_VERSION ${GAV}" >> ${GIT_VERSION_PREFIX_HEADER}; 2>&1
108 echo "#define GIT_BUILD_VERSION ${GBV}" >> ${GIT_VERSION_PREFIX_HEADER}; 2>&1
109 fi
110
111 # displays summary
112 if test "x${GIT_PACKAGE_VERSION_VERBOSE}" == "xYES";then
113 echo "Git Package Version: ${GPV}";
114 echo "Git Application Version: ${GAV}";
115 echo "Git Build Version: ${GBV}";
116 else
117 echo "${GPV}"
55 fi 118 fi
56 echo "${GPV}";
57 fi; 119 fi;
58fi 120fi
59 121