fixup! Bump waf to 2.0.27.
[asdcplib.git] / wscript
diff --git a/wscript b/wscript
index f8a7c92e08acf462c481e9c47062a2fba577df18..2dd72283b814551c88cdf64c6fe2def456aa89cb 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,11 +1,23 @@
+from __future__ import print_function
+
 import subprocess
+import shlex
 import os
 import sys
 import distutils.spawn
 from waflib import Logs
 
 APPNAME = 'libasdcp-cth'
-VERSION = '0.1.3'
+
+if os.path.exists('.git'):
+    this_version = subprocess.Popen(shlex.split('git tag -l --points-at HEAD'), stdout=subprocess.PIPE).communicate()[0].decode('utf-8')
+    last_version = subprocess.Popen(shlex.split('git describe --tags --abbrev=0'), stdout=subprocess.PIPE).communicate()[0]
+    if this_version == '':
+        VERSION = '%sdevel' % last_version[1:].strip()
+    else:
+        VERSION = this_version[1:].strip()
+else:
+    VERSION = open('VERSION').read().strip()
 
 def options(opt):
     opt.load('compiler_cxx')
@@ -64,6 +76,8 @@ def configure(conf):
                    lib=['boost_filesystem%s' % boost_lib_suffix, 'boost_system%s' % boost_lib_suffix],
                    uselib_store='BOOST_FILESYSTEM')
 
+    conf.check(header_name='valgrind/memcheck.h', mandatory=False)
+
     conf.recurse('src')
 
 def build(bld):
@@ -91,3 +105,8 @@ def post(ctx):
 
 def tags(bld):
     os.system('etags src/*.cc src/*.h')
+
+def dist(bld):
+    f = open('VERSION', 'w')
+    print(VERSION, file=f)
+    f.close()