Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 59 lines (54 sloc) 2.1 kB
66457bf @uliwitness Updated Versioning for Git:
authored
1 #
720b0e7 @uliwitness Added licensing information to the source files.
authored
2 # make_git_version_header.sh
3 # TalkingMoose
4 #
5 # Created by Uli Kusterer on 2010-02-14
6 # Copyright 2010 Uli Kusterer.
7 #
8 # This software is provided 'as-is', without any express or implied
9 # warranty. In no event will the authors be held liable for any damages
10 # arising from the use of this software.
11 #
12 # Permission is granted to anyone to use this software for any purpose,
13 # including commercial applications, and to alter it and redistribute it
14 # freely, subject to the following restrictions:
15 #
16 # 1. The origin of this software must not be misrepresented; you must not
17 # claim that you wrote the original software. If you use this software
18 # in a product, an acknowledgment in the product documentation would be
19 # appreciated but is not required.
20 #
21 # 2. Altered source versions must be plainly marked as such, and must not be
22 # misrepresented as being the original software.
23 #
24 # 3. This notice may not be removed or altered from any source
25 # distribution.
26 #
27
28 #
66457bf @uliwitness Updated Versioning for Git:
authored
29 # Run this file as part of your build process to extract the latest
30 # revision from your Git working copy and create a 'svn_version.h'
31 # file defining a SVN_VERSION constant to that value.
32 #
33 # This is for a user-visible build number, so we use the number of revisions
34 # and not the actual git hash.
35 #
36 # The file will be created in the current directory and the subversion
37 # revision number is extracted from the current folder's .svn/entries
38 # file.
39 #
40
41 echo -n "note: Finding revision in "
42 pwd
e45002e @uliwitness Make make_git_version_header find Xcode the proper way
authored
43
44 XCODE=`xcode-select --print-path 2> /dev/null`
45 if [ $? -ne 0 ]; then
46 XCODE=/Applications/Xcode.app/Contents/Developer
47 fi
48 GIT="$XCODE/usr/bin/git"
eff8e4d @uliwitness Use the copy of git in Xcode
authored
49 revnum=`$GIT rev-list HEAD | /usr/bin/wc -l | tr -d ' '`
50 fullrevnum=`$GIT rev-parse HEAD`
29823db @uliwitness Output from make_git_version.sh is now prettier and includes a build …
authored
51 builddate=`date "+%Y-%m-%d"`
66457bf @uliwitness Updated Versioning for Git:
authored
52
53 # Now write the constant declaration to the file:
29823db @uliwitness Output from make_git_version.sh is now prettier and includes a build …
authored
54 echo "#define SVN_VERSION \"$revnum\"" > svn_version.h
55 echo "#define GIT_HASH \"$fullrevnum\"" >> svn_version.h
aef11b9 @uliwitness Also output the version number as a number, not just a string, for us…
authored
56 echo "#define SVN_VERSION_NUM $revnum" >> svn_version.h
29823db @uliwitness Output from make_git_version.sh is now prettier and includes a build …
authored
57 echo "#define SVN_BUILD_DATE \"$builddate\"" >> svn_version.h
66457bf @uliwitness Updated Versioning for Git:
authored
58 echo "note: Wrote revision $revnum to svn_version.h"
Something went wrong with that request. Please try again.