6 # Variables for 'waf dist'
31 def fetch_svn_revision (path):
32 cmd = "LANG= svn info " + path + " | awk '/^Revision:/ { print $2}'"
33 return commands.getoutput(cmd)
35 def fetch_git_revision (path):
36 cmd = "LANG= git log --abbrev HEAD^..HEAD " + path
37 output = commands.getoutput(cmd).splitlines()
38 rev = output[0].replace ("commit", "git")[0:10]
41 if "git-svn-id" in line:
42 line = line.split('@')[1].split(' ')
48 def create_stored_revision():
50 if os.path.exists('.svn'):
51 rev = fetch_svn_revision('.');
52 elif os.path.exists('.git'):
53 rev = fetch_git_revision('.');
54 elif os.path.exists('libs/ardour/svn_revision.cc'):
55 print "Using packaged svn revision"
58 print "Missing libs/ardour/svn_revision.cc. Blame the packager."
62 text = '#include <ardour/svn_revision.h>\n'
63 text += 'namespace ARDOUR { extern const char* svn_revision = \"' + rev + '\"; }\n'
64 print 'Writing svn revision info to libs/ardour/svn_revision.cc\n'
65 o = file('libs/ardour/svn_revision.cc', 'w')
69 print 'Could not open libs/ardour/svn_revision.cc for writing\n'
76 autowaf.set_options(opt)
80 def sub_config_and_use(conf, name, has_objects = True):
82 autowaf.set_local_lib(conf, name, has_objects)
85 create_stored_revision()
86 autowaf.set_recursive()
87 autowaf.configure(conf)
88 autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
89 autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
91 sub_config_and_use(conf, i)
94 autowaf.set_recursive()