diff --git a/.gitignore b/.gitignore index d40ea5abe2..0b35ab2e68 100644 --- a/.gitignore +++ b/.gitignore @@ -29,8 +29,11 @@ _ReSharper*/ [Tt]est[Rr]esult* Binary/Win32 Binary/x64 +Binary/Darwin* Source/Core/Common/Src/scmrev.h *.opensdf *.sdf [Bb]uild -*.ipch \ No newline at end of file +*.ipch +.sconsign.dblite +Externals/scons-local/* diff --git a/SConstruct b/SConstruct index a563823859..8503a46372 100755 --- a/SConstruct +++ b/SConstruct @@ -2,6 +2,7 @@ # -*- python -*- import os +import re import sys import platform @@ -92,7 +93,10 @@ if not env.has_key('install') or env['install'] == 'local': if env['flavor'] == 'debug' or env['flavor'] == 'prof': env['prefix'] += '-' + env['flavor'] -env['svnrev'] = os.popen('svnversion -n .').read().split(':')[0] +env['gitrev'] = os.popen('git rev-parse HEAD').read().split('\n')[0] +env['gitdesc'] = re.sub('-[^-]+(-dirty)?$', '', + os.popen('git describe --always --long --dirty').read().split('\n')[0]) +env['gitbranch'] = os.popen('git rev-parse --abbrev-ref HEAD').read().split('\n')[0] # OS X specifics if sys.platform == 'darwin': diff --git a/Source/Core/Common/SConscript b/Source/Core/Common/SConscript index 74eebdd611..f26dfc044c 100644 --- a/Source/Core/Common/SConscript +++ b/Source/Core/Common/SConscript @@ -4,16 +4,16 @@ Import('env') import os import sys -def createVersion(env, target, source): - tmpstr = open(source[0].path, 'r').read().\ - replace("$WCMODS?$WCREV$M:$WCREV$$", env['svnrev']) - outfile = open(target[0].path, 'w') - outfile.write(tmpstr + '\n') - outfile.close() +out_contents =\ + '#define SCM_REV_STR "' + env['gitrev'] + '"\n' +\ + '#define SCM_DESC_STR "' + env['gitdesc'] + '"\n' +\ + '#define SCM_BRANCH_STR "' + env['gitbranch'] + '"\n' +\ + '#define SCM_IS_MASTER ' + ('1' if env['gitbranch'] == 'master' else '0') + '\n\n' -Execute(Delete('Src/svnrev.h')) -env.Command('Src/svnrev.h', 'Src/svnrev_template.h', - [Delete('${TARGET.srcpath}'), createVersion]) +Execute(Delete('Src/scmrev.h')) +outfile = open('Src/scmrev.h', 'w') +outfile.write(out_contents) +outfile.close() files = [ 'Src/ABI.cpp', diff --git a/Source/Core/DolphinWX/SConscript b/Source/Core/DolphinWX/SConscript index e59d98aaf0..3d3d1e56c2 100644 --- a/Source/Core/DolphinWX/SConscript +++ b/Source/Core/DolphinWX/SConscript @@ -114,7 +114,7 @@ elif sys.platform == 'darwin': CFBundleIdentifier = 'com.dolphin-emulator.dolphin', CFBundleLocalizations = languages, CFBundlePackageType = 'APPL', - CFBundleShortVersionString = env['svnrev'], + CFBundleShortVersionString = env['gitdesc'], CFBundleVersion = '3.0', LSMinimumSystemVersion = '10.5.4', LSRequiresCarbon = True,