# source VERSION
for l in open('VERSION').readlines(): exec (l.strip())
+def get_git_revision_hash( short=True):
+ import os
+ def which(program):
+ def is_exe(fpath):
+ return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+ fpath, fname = os.path.split(program)
+ if fpath:
+ if is_exe(program):
+ return program
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ path = path.strip('"')
+ exe_file = os.path.join(path, program)
+ if is_exe(exe_file):
+ return exe_file
+
+ return None
+
+ if not which('git'):
+ print 'no git found on this system : can\'t get sha'
+ return ""
+
+ import subprocess
+ aubio_dir = os.path.abspath(os.curdir)
+ if not os.path.exists(aubio_dir):
+ raise SystemError("git / root folder not found")
+ gitcmd = ['git','-C',aubio_dir ,'rev-parse']
+ if short:
+ gitcmd.append('--short')
+ gitcmd.append('HEAD')
+ return subprocess.check_output(gitcmd).strip()
+
+AUBIO_GIT_SHA = get_git_revision_hash()
+""" append sha to version in alpha release
+"""
+if '~alpha' in AUBIO_VERSION_STATUS :
+ if AUBIO_GIT_SHA:
+ AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA
+
+
+
+
VERSION = '.'.join ([str(x) for x in [
AUBIO_MAJOR_VERSION,
AUBIO_MINOR_VERSION,
default = "release",
choices = ('debug', 'release'),
dest = 'build_type',
- help = 'whether to compile with (--build_type=release) or without (--build_type=debug) '\
+ help = 'whether to compile with (--build-type=release) or without (--build-type=debug) '\
' compiler opimizations [default: release]')
add_option_enable_disable(ctx, 'fftw3f', default = False,
help_str = 'compile with fftw3f instead of ooura (recommended)',
target_platform = ctx.options.target_platform
ctx.env['DEST_OS'] = target_platform
+ ctx.define('AUBIO_VERSION',VERSION)
+ ctx.define('AUBIO_MAJOR_VERSION',AUBIO_MAJOR_VERSION)
+ ctx.define('AUBIO_MINOR_VERSION',AUBIO_MINOR_VERSION)
+ ctx.define('AUBIO_PATCH_VERSION',AUBIO_PATCH_VERSION)
+ ctx.define('AUBIO_VERSION_STATUS',AUBIO_VERSION_STATUS)
+ ctx.define('AUBIO_GIT_SHA',AUBIO_GIT_SHA)
if ctx.options.build_type == "debug":
ctx.define('DEBUG', 1)
else:
ctx.define('NDEBUG', 1)
-
+
if ctx.env.CC_NAME != 'msvc':
+ if ctx.options.build_type == "debug":
+ # no optimization in debug mode
+ ctx.env.prepend_value('CFLAGS', ['-O0'])
+ else:
+ # default to -O2 in release mode
+ ctx.env.prepend_value('CFLAGS', ['-O2'])
# enable debug symbols and configure warnings
- ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
- if ctx.options.build_type == "release":
- # set optimization level
- ctx.env.CFLAGS += ['-O2']
+ ctx.env.prepend_value('CFLAGS', ['-g', '-Wall', '-Wextra'])
else:
# enable debug symbols
ctx.env.CFLAGS += ['/Z7', '/FS']
ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
# configure warnings
ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS']
- # set optimization level and runtime libs
+ # set optimization level and runtime libs
if (ctx.options.build_type == "release"):
ctx.env.CFLAGS += ['/Ox']
ctx.env.CFLAGS += ['/MD']
else:
assert(ctx.options.build_type == "debug")
ctx.env.CFLAGS += ['/MDd']
-
+
ctx.check_cc(lib='m', uselib_store='M', mandatory=False)
if target_platform not in ['win32', 'win64']:
from waflib import TaskGen
if 'MANDIR' not in bld.env:
bld.env['MANDIR'] = bld.env['DATAROOTDIR'] + '/man'
+ bld.env.VERSION = VERSION
rule_str = '${TXT2MAN} -t `basename ${TGT} | cut -f 1 -d . | tr a-z A-Z`'
rule_str += ' -r ${PACKAGE}\\ ${VERSION} -P ${PACKAGE}'
rule_str += ' -v ${PACKAGE}\\ User\\\'s\\ manual'
if bld.env['DOXYGEN']:
bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null',
source = 'doc/web.cfg',
+ target = '../doc/web/html/index.html',
cwd = 'doc')
bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc',
bld.path.ant_glob('doc/web/html/**'),
# build documentation from source files using sphinx-build
# note: build in ../doc/_build/html, otherwise waf wont install unsigned files
if bld.env['SPHINX']:
+ bld.env.VERSION = VERSION
bld( name = 'sphinx',
- rule = '${SPHINX} -b html -a -q `dirname ${SRC}` `dirname ${TGT}`',
+ rule = '${SPHINX} -b html -D release=${VERSION} -D version=${VERSION} -a -q `dirname ${SRC}` `dirname ${TGT}`',
source = 'doc/conf.py',
target = '../doc/_build/html/index.html')
bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc/sphinx',