diff options
author | David Robillard <d@drobilla.net> | 2009-02-26 02:24:16 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-02-26 02:24:16 +0000 |
commit | 76f242cb804bd3c612ae5abfd0d3d078c0317dd0 (patch) | |
tree | 399476dbb1cc4c0121d79ac048852d4b79097383 | |
parent | 593ffe80331f9cca68664f9dd501ce95b545f0c8 (diff) |
Version file building stuff.
Ardour should now compile from a fresh svn checkout using only waf.
git-svn-id: svn://localhost/ardour2/branches/3.0@4671 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | autowaf.py | 32 | ||||
-rw-r--r-- | gtk2_ardour/wscript | 9 | ||||
-rw-r--r-- | libs/ardour/wscript | 9 | ||||
-rw-r--r-- | libs/gtkmm2ext/wscript | 9 | ||||
-rw-r--r-- | libs/midi++2/wscript | 9 | ||||
-rw-r--r-- | libs/pbd/wscript | 9 | ||||
-rw-r--r-- | libs/taglib/wscript | 35 | ||||
-rw-r--r-- | wscript | 50 |
8 files changed, 140 insertions, 22 deletions
diff --git a/autowaf.py b/autowaf.py index b61a39f4bf..8dc9efffc3 100644 --- a/autowaf.py +++ b/autowaf.py @@ -338,6 +338,38 @@ def build_dox(bld, name, version, srcdir, blddir): out1.argv = [os.path.abspath(doc_dir) + '/reference.doxygen'] out1.command_is_external = True +# Version code file generation +def build_version_files(header_path, source_path, domain, major, minor, micro): + header_path = os.path.abspath(header_path) + source_path = os.path.abspath(source_path) + text = "int " + domain + "_major_version = " + str(major) + ";\n" + text += "int " + domain + "_minor_version = " + str(minor) + ";\n" + text += "int " + domain + "_micro_version = " + str(micro) + ";\n" + try: + o = file(source_path, 'w') + o.write(text) + o.close() + except IOError: + print "Could not open", source_path, " for writing\n" + sys.exit(-1) + + text = "#ifndef __" + domain + "_version_h__\n" + text += "#define __" + domain + "_version_h__\n" + text += "extern const char* " + domain + "_revision;\n" + text += "extern int " + domain + "_major_version;\n" + text += "extern int " + domain + "_minor_version;\n" + text += "extern int " + domain + "_micro_version;\n" + text += "#endif /* __" + domain + "_version_h__ */\n" + try: + o = file(header_path, 'w') + o.write(text) + o.close() + except IOError: + print "Could not open", header_path, " for writing\n" + sys.exit(-1) + + return None + def shutdown(): # This isn't really correct (for packaging), but people asking is annoying if Options.commands['install']: diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index f1a90deaf6..4381598761 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -3,7 +3,10 @@ import autowaf import os # Version of this package (even if built as a child) -GTK2_ARDOUR_VERSION = '3.0.0' +MAJOR = '1' +MINOR = '0' +MICRO = '2' +GTK2_ARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) # Variables for 'waf dist' APPNAME = 'gtk2_ardour' @@ -13,10 +16,14 @@ VERSION = GTK2_ARDOUR_VERSION srcdir = '.' blddir = 'build' +path_prefix = 'gtk2_ardour/' + def set_options(opt): autowaf.set_options(opt) def configure(conf): + autowaf.build_version_files(path_prefix+'version.h', path_prefix+'version.cc', + 'gtk2_ardour', MAJOR, MINOR, MICRO) autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') diff --git a/libs/ardour/wscript b/libs/ardour/wscript index e48632c6a0..e2b3200fd5 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -3,7 +3,10 @@ import autowaf import os # Version of this package (even if built as a child) -LIBARDOUR_VERSION = '3.0.0' +MAJOR = '3' +MINOR = '0' +MICRO = '0' +LIBARDOUR_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) # Library version (UNIX style major, minor, micro) # major increment <=> incompatible changes @@ -19,6 +22,8 @@ VERSION = LIBARDOUR_VERSION srcdir = '.' blddir = 'build' +path_prefix = 'libs/ardour/' + def set_options(opt): autowaf.set_options(opt) @@ -29,6 +34,8 @@ def check_header_and_define(conf, header, define): conf.env.append_value('CXXFLAGS', '-D' + define) def configure(conf): + autowaf.build_version_files(path_prefix+'ardour/version.h', path_prefix+'version.cc', + 'libardour3', MAJOR, MINOR, MICRO) autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO', atleast_version='0.3.2') diff --git a/libs/gtkmm2ext/wscript b/libs/gtkmm2ext/wscript index 78bdd69dab..2a5532b9ac 100644 --- a/libs/gtkmm2ext/wscript +++ b/libs/gtkmm2ext/wscript @@ -3,7 +3,10 @@ import autowaf import os # Version of this package (even if built as a child) -GTKMM2EXT_VERSION = '0.0.0' +MAJOR = '0' +MINOR = '8' +MICRO = '3' +GTKMM2EXT_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) # Library version (UNIX style major, minor, micro) # major increment <=> incompatible changes @@ -19,10 +22,14 @@ VERSION = GTKMM2EXT_VERSION srcdir = '.' blddir = 'build' +path_prefix = 'libs/gtkmm2ext/' + def set_options(opt): autowaf.set_options(opt) def configure(conf): + autowaf.build_version_files(path_prefix+'gtkmm2ext/version.h', path_prefix+'version.cc', + 'libgtkmm2ext', MAJOR, MINOR, MICRO) autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.8') diff --git a/libs/midi++2/wscript b/libs/midi++2/wscript index 43ec395b4b..8629d2c4c3 100644 --- a/libs/midi++2/wscript +++ b/libs/midi++2/wscript @@ -2,7 +2,10 @@ import autowaf # Version of this package (even if built as a child) -LIBMIDIPP_VERSION = '0.0.0' +MAJOR = '2' +MINOR = '1' +MICRO = '1' +LIBMIDIPP_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) # Library version (UNIX style major, minor, micro) # major increment <=> incompatible changes @@ -18,10 +21,14 @@ VERSION = LIBMIDIPP_VERSION srcdir = '.' blddir = 'build' +path_prefix = 'libs/midi++2/' + def set_options(opt): autowaf.set_options(opt) def configure(conf): + autowaf.build_version_files(path_prefix+'midi++/version.h', path_prefix+'version.cc', + 'midipp', MAJOR, MINOR, MICRO) autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.109.0') diff --git a/libs/pbd/wscript b/libs/pbd/wscript index a523956617..cf708c12b6 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -2,7 +2,10 @@ import autowaf # Version of this package (even if built as a child) -LIBPBD_VERSION = '0.0.0' +MAJOR = '4' +MINOR = '1' +MICRO = '0' +LIBPBD_VERSION = "%s.%s.%s" % (MAJOR, MINOR, MICRO) # Library version (UNIX style major, minor, micro) # major increment <=> incompatible changes @@ -18,10 +21,14 @@ VERSION = LIBPBD_VERSION srcdir = '.' blddir = 'build' +path_prefix = 'libs/pbd/' + def set_options(opt): autowaf.set_options(opt) def configure(conf): + autowaf.build_version_files(path_prefix+'pbd/version.h', path_prefix+'version.cc', + 'libpbd', MAJOR, MINOR, MICRO) autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML') diff --git a/libs/taglib/wscript b/libs/taglib/wscript index 12a707ab32..e8fd74a7d5 100644 --- a/libs/taglib/wscript +++ b/libs/taglib/wscript @@ -19,6 +19,8 @@ VERSION = LIBTAGLIB_VERSION srcdir = '.' blddir = 'build' +path_prefix = 'libs/taglib/' + def set_options(opt): autowaf.set_options(opt) @@ -29,25 +31,24 @@ def configure(conf): def build(bld): # Library obj = bld.new_task_gen('cxx', 'shlib') - prefix = 'libs/taglib/' - sources = glob.glob(prefix + 'taglib/*.cpp') - sources += glob.glob(prefix + 'taglib/flac/*.cpp') - sources += glob.glob(prefix + 'taglib/mpc/*.cpp') - sources += glob.glob(prefix + 'taglib/mpeg/*.cpp') - sources += glob.glob(prefix + 'taglib/mpeg/id3v1/*.cpp') - sources += glob.glob(prefix + 'taglib/mpeg/id3v2/*.cpp') - sources += glob.glob(prefix + 'taglib/mpeg/id3v2/frames/*.cpp') - sources += glob.glob(prefix + 'taglib/ogg/*.cpp') - sources += glob.glob(prefix + 'taglib/ogg/vorbis/*.cpp') - sources += glob.glob(prefix + 'taglib/ogg/speex/*.cpp') - sources += glob.glob(prefix + 'taglib/ogg/flac/*.cpp') - sources += glob.glob(prefix + 'taglib/trueaudio/*.cpp') - sources += glob.glob(prefix + 'taglib/wavpack/*.cpp') - sources += glob.glob(prefix + 'taglib/ape/*.cpp') - sources += glob.glob(prefix + 'taglib/toolkit/*.cpp') + sources = glob.glob(path_prefix + 'taglib/*.cpp') + sources += glob.glob(path_prefix + 'taglib/flac/*.cpp') + sources += glob.glob(path_prefix + 'taglib/mpc/*.cpp') + sources += glob.glob(path_prefix + 'taglib/mpeg/*.cpp') + sources += glob.glob(path_prefix + 'taglib/mpeg/id3v1/*.cpp') + sources += glob.glob(path_prefix + 'taglib/mpeg/id3v2/*.cpp') + sources += glob.glob(path_prefix + 'taglib/mpeg/id3v2/frames/*.cpp') + sources += glob.glob(path_prefix + 'taglib/ogg/*.cpp') + sources += glob.glob(path_prefix + 'taglib/ogg/vorbis/*.cpp') + sources += glob.glob(path_prefix + 'taglib/ogg/speex/*.cpp') + sources += glob.glob(path_prefix + 'taglib/ogg/flac/*.cpp') + sources += glob.glob(path_prefix + 'taglib/trueaudio/*.cpp') + sources += glob.glob(path_prefix + 'taglib/wavpack/*.cpp') + sources += glob.glob(path_prefix + 'taglib/ape/*.cpp') + sources += glob.glob(path_prefix + 'taglib/toolkit/*.cpp') obj.source = [] for i in sources: - obj.source += [ i.replace(prefix, '') ] + obj.source += [ i.replace(path_prefix, '') ] include_dirs = ''' taglib @@ -1,5 +1,7 @@ #!/usr/bin/env python import autowaf +import os +import commands # Variables for 'waf dist' VERSION = '3.0pre0' @@ -23,6 +25,53 @@ children = [ 'gtk2_ardour' ] + +# Version stuff + +def fetch_svn_revision (path): + cmd = "LANG= svn info " + path + " | awk '/^Revision:/ { print $2}'" + return commands.getoutput(cmd) + +def fetch_git_revision (path): + cmd = "LANG= git log --abbrev HEAD^..HEAD " + path + output = commands.getoutput(cmd).splitlines() + rev = output[0].replace ("commit", "git")[0:10] + for line in output: + try: + if "git-svn-id" in line: + line = line.split('@')[1].split(' ') + rev = line[0] + except: + pass + return rev + +def create_stored_revision(): + rev = "" + if os.path.exists('.svn'): + rev = fetch_svn_revision('.'); + elif os.path.exists('.git'): + rev = fetch_git_revision('.'); + elif os.path.exists('libs/ardour/svn_revision.cc'): + print "Using packaged svn revision" + return + else: + print "Missing libs/ardour/svn_revision.cc. Blame the packager." + sys.exit(-1) + + try: + text = '#include <ardour/svn_revision.h>\n' + text += 'namespace ARDOUR { extern const char* svn_revision = \"' + rev + '\"; }\n' + print 'Writing svn revision info to libs/ardour/svn_revision.cc\n' + o = file('libs/ardour/svn_revision.cc', 'w') + o.write(text) + o.close() + except IOError: + print 'Could not open libs/ardour/svn_revision.cc for writing\n' + sys.exit(-1) + + +# Waf stages + def set_options(opt): autowaf.set_options(opt) for i in children: @@ -33,6 +82,7 @@ def sub_config_and_use(conf, name, has_objects = True): autowaf.set_local_lib(conf, name, has_objects) def configure(conf): + create_stored_revision() autowaf.set_recursive() autowaf.configure(conf) autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2') |