mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
Upgrade to latest autowaf.
Tidy up configure output. git-svn-id: svn://localhost/ardour2/branches/3.0@7752 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
affa53e2f2
commit
aaf6ea8d28
5 changed files with 225 additions and 134 deletions
172
autowaf.py
172
autowaf.py
|
|
@ -1,16 +1,16 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Waf utilities for easily building standard unixey packages/libraries
|
# Waf utilities for easily building standard unixey packages/libraries
|
||||||
# Licensed under the GNU GPL v2 or later, see COPYING file for details.
|
# Licensed under the GNU GPL v2 or later, see COPYING file for details.
|
||||||
# Copyright (C) 2008 Dave Robillard
|
# Copyright (C) 2008 David Robillard
|
||||||
# Copyright (C) 2008 Nedko Arnaudov
|
# Copyright (C) 2008 Nedko Arnaudov
|
||||||
|
|
||||||
import os
|
|
||||||
import misc
|
|
||||||
import Configure
|
import Configure
|
||||||
import Options
|
import Options
|
||||||
import Utils
|
import Utils
|
||||||
|
import misc
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import glob
|
|
||||||
from TaskGen import feature, before, after
|
from TaskGen import feature, before, after
|
||||||
|
|
||||||
global g_is_child
|
global g_is_child
|
||||||
|
|
@ -41,7 +41,7 @@ def set_options(opt):
|
||||||
help="Build debuggable binaries [Default: False]")
|
help="Build debuggable binaries [Default: False]")
|
||||||
opt.add_option('--strict', action='store_true', default=False, dest='strict',
|
opt.add_option('--strict', action='store_true', default=False, dest='strict',
|
||||||
help="Use strict compiler flags and show all warnings [Default: False]")
|
help="Use strict compiler flags and show all warnings [Default: False]")
|
||||||
opt.add_option('--build-docs', action='store_true', default=False, dest='build_docs',
|
opt.add_option('--docs', action='store_true', default=False, dest='docs',
|
||||||
help="Build documentation - requires doxygen [Default: False]")
|
help="Build documentation - requires doxygen [Default: False]")
|
||||||
opt.add_option('--bundle', action='store_true', default=False,
|
opt.add_option('--bundle', action='store_true', default=False,
|
||||||
help="Build a self-contained bundle [Default: False]")
|
help="Build a self-contained bundle [Default: False]")
|
||||||
|
|
@ -77,10 +77,13 @@ def check_header(conf, name, define='', mandatory=False):
|
||||||
checked = conf.env['AUTOWAF_HEADERS']
|
checked = conf.env['AUTOWAF_HEADERS']
|
||||||
if not name in checked:
|
if not name in checked:
|
||||||
checked[name] = True
|
checked[name] = True
|
||||||
|
includes = '' # search default system include paths
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
includes = '/opt/local/include'
|
||||||
if define != '':
|
if define != '':
|
||||||
conf.check(header_name=name, define_name=define, mandatory=mandatory)
|
conf.check(header_name=name, includes=includes, define_name=define, mandatory=mandatory)
|
||||||
else:
|
else:
|
||||||
conf.check(header_name=name, mandatory=mandatory)
|
conf.check(header_name=name, includes=includes, mandatory=mandatory)
|
||||||
|
|
||||||
def nameify(name):
|
def nameify(name):
|
||||||
return name.replace('/', '_').replace('++', 'PP').replace('-', '_').replace('.', '_')
|
return name.replace('/', '_').replace('++', 'PP').replace('-', '_').replace('.', '_')
|
||||||
|
|
@ -108,14 +111,6 @@ def check_pkg(conf, name, **args):
|
||||||
if args['mandatory'] == True:
|
if args['mandatory'] == True:
|
||||||
conf.fatal("Required package " + name + " not found")
|
conf.fatal("Required package " + name + " not found")
|
||||||
|
|
||||||
def chop_prefix(conf, var):
|
|
||||||
name = conf.env[var][len(conf.env['PREFIX']):]
|
|
||||||
if len(name) > 0 and name[0] == '/':
|
|
||||||
name = name[1:]
|
|
||||||
if name == "":
|
|
||||||
name = "/"
|
|
||||||
return name;
|
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
global g_step
|
global g_step
|
||||||
if g_step > 1:
|
if g_step > 1:
|
||||||
|
|
@ -123,15 +118,14 @@ def configure(conf):
|
||||||
def append_cxx_flags(vals):
|
def append_cxx_flags(vals):
|
||||||
conf.env.append_value('CCFLAGS', vals.split())
|
conf.env.append_value('CCFLAGS', vals.split())
|
||||||
conf.env.append_value('CXXFLAGS', vals.split())
|
conf.env.append_value('CXXFLAGS', vals.split())
|
||||||
conf.line_just = 43
|
display_header('Global Configuration')
|
||||||
conf.check_tool('misc')
|
conf.check_tool('misc')
|
||||||
conf.check_tool('compiler_cc')
|
conf.check_tool('compiler_cc')
|
||||||
conf.check_tool('compiler_cxx')
|
conf.check_tool('compiler_cxx')
|
||||||
conf.env['BUILD_DOCS'] = Options.options.build_docs
|
conf.env['DOCS'] = Options.options.docs
|
||||||
conf.env['DEBUG'] = Options.options.debug
|
conf.env['DEBUG'] = Options.options.debug
|
||||||
conf.env['STRICT'] = Options.options.strict
|
conf.env['STRICT'] = Options.options.strict
|
||||||
conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX'])))
|
conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX'])))
|
||||||
|
|
||||||
if Options.options.bundle:
|
if Options.options.bundle:
|
||||||
conf.env['BUNDLE'] = True
|
conf.env['BUNDLE'] = True
|
||||||
conf.define('BUNDLE', 1)
|
conf.define('BUNDLE', 1)
|
||||||
|
|
@ -186,22 +180,40 @@ def configure(conf):
|
||||||
else:
|
else:
|
||||||
conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'lv2')
|
conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'lv2')
|
||||||
|
|
||||||
conf.env['BINDIRNAME'] = chop_prefix(conf, 'BINDIR')
|
conf.env['BINDIRNAME'] = os.path.basename(conf.env['BINDIR'])
|
||||||
conf.env['LIBDIRNAME'] = chop_prefix(conf, 'LIBDIR')
|
conf.env['LIBDIRNAME'] = os.path.basename(conf.env['LIBDIR'])
|
||||||
conf.env['DATADIRNAME'] = chop_prefix(conf, 'DATADIR')
|
conf.env['DATADIRNAME'] = os.path.basename(conf.env['DATADIR'])
|
||||||
conf.env['CONFIGDIRNAME'] = chop_prefix(conf, 'CONFIGDIR')
|
conf.env['CONFIGDIRNAME'] = os.path.basename(conf.env['CONFIGDIR'])
|
||||||
conf.env['LV2DIRNAME'] = chop_prefix(conf, 'LV2DIR')
|
conf.env['LV2DIRNAME'] = os.path.basename(conf.env['LV2DIR'])
|
||||||
|
|
||||||
|
if Options.options.docs:
|
||||||
|
doxygen = conf.find_program('doxygen')
|
||||||
|
if not doxygen:
|
||||||
|
conf.fatal("Doxygen is required to build documentation, configure without --docs")
|
||||||
|
|
||||||
|
dot = conf.find_program('dot')
|
||||||
|
if not dot:
|
||||||
|
conf.fatal("Graphviz (dot) is required to build documentation, configure without --docs")
|
||||||
|
|
||||||
if Options.options.debug:
|
if Options.options.debug:
|
||||||
conf.env['CCFLAGS'] = [ '-O0', '-g' ]
|
conf.env['CCFLAGS'] = [ '-O0', '-g' ]
|
||||||
conf.env['CXXFLAGS'] = [ '-O0', '-g' ]
|
conf.env['CXXFLAGS'] = [ '-O0', '-g' ]
|
||||||
else:
|
else:
|
||||||
append_cxx_flags('-DNDEBUG')
|
append_cxx_flags('-DNDEBUG')
|
||||||
|
|
||||||
if Options.options.strict:
|
if Options.options.strict:
|
||||||
conf.env.append_value('CCFLAGS', [ '-std=c99', '-pedantic' ])
|
conf.env.append_value('CCFLAGS', [ '-std=c99', '-pedantic' ])
|
||||||
conf.env.append_value('CXXFLAGS', [ '-ansi', '-Woverloaded-virtual'])
|
conf.env.append_value('CXXFLAGS', [ '-ansi', '-Woverloaded-virtual', '-Wnon-virtual-dtor'])
|
||||||
append_cxx_flags('-Wall -Wextra -Wno-unused-parameter')
|
append_cxx_flags('-Wall -Wextra -Wno-unused-parameter')
|
||||||
|
|
||||||
append_cxx_flags('-fPIC -DPIC -fshow-column')
|
append_cxx_flags('-fPIC -DPIC -fshow-column')
|
||||||
|
|
||||||
|
display_msg(conf, "Install prefix", conf.env['PREFIX'])
|
||||||
|
display_msg(conf, "Debuggable build", str(conf.env['DEBUG']))
|
||||||
|
display_msg(conf, "Strict compiler flags", str(conf.env['STRICT']))
|
||||||
|
display_msg(conf, "Build documentation", str(conf.env['DOCS']))
|
||||||
|
print
|
||||||
|
|
||||||
g_step = 2
|
g_step = 2
|
||||||
|
|
||||||
def set_local_lib(conf, name, has_objects):
|
def set_local_lib(conf, name, has_objects):
|
||||||
|
|
@ -248,24 +260,9 @@ def display_msg(conf, msg, status = None, color = None):
|
||||||
color = 'GREEN'
|
color = 'GREEN'
|
||||||
elif type(status) == bool and not status or status == "False":
|
elif type(status) == bool and not status or status == "False":
|
||||||
color = 'YELLOW'
|
color = 'YELLOW'
|
||||||
Utils.pprint('NORMAL', "%s :" % msg.ljust(conf.line_just), sep='')
|
Utils.pprint('BOLD', "%s :" % msg.ljust(conf.line_just), sep='')
|
||||||
Utils.pprint(color, status)
|
Utils.pprint(color, status)
|
||||||
|
|
||||||
def print_summary(conf):
|
|
||||||
global g_step
|
|
||||||
if g_step > 2:
|
|
||||||
print
|
|
||||||
return
|
|
||||||
e = conf.env
|
|
||||||
print
|
|
||||||
display_header('Global configuration')
|
|
||||||
display_msg(conf, "Install prefix", conf.env['PREFIX'])
|
|
||||||
display_msg(conf, "Debuggable build", str(conf.env['DEBUG']))
|
|
||||||
display_msg(conf, "Strict compiler flags", str(conf.env['STRICT']))
|
|
||||||
display_msg(conf, "Build documentation", str(conf.env['BUILD_DOCS']))
|
|
||||||
print
|
|
||||||
g_step = 3
|
|
||||||
|
|
||||||
def link_flags(env, lib):
|
def link_flags(env, lib):
|
||||||
return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib]))
|
return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib]))
|
||||||
|
|
||||||
|
|
@ -298,7 +295,7 @@ def build_pc(bld, name, version, libs):
|
||||||
obj.dict = {
|
obj.dict = {
|
||||||
'prefix' : pkg_prefix,
|
'prefix' : pkg_prefix,
|
||||||
'exec_prefix' : '${prefix}',
|
'exec_prefix' : '${prefix}',
|
||||||
'libdir' : '${exec_prefix}/lib',
|
'libdir' : '${prefix}/' + bld.env['LIBDIRNAME'],
|
||||||
'includedir' : '${prefix}/include',
|
'includedir' : '${prefix}/include',
|
||||||
name + '_VERSION' : version,
|
name + '_VERSION' : version,
|
||||||
}
|
}
|
||||||
|
|
@ -310,7 +307,7 @@ def build_pc(bld, name, version, libs):
|
||||||
|
|
||||||
# Doxygen API documentation
|
# Doxygen API documentation
|
||||||
def build_dox(bld, name, version, srcdir, blddir):
|
def build_dox(bld, name, version, srcdir, blddir):
|
||||||
if not bld.env['BUILD_DOCS']:
|
if not bld.env['DOCS']:
|
||||||
return
|
return
|
||||||
obj = bld.new_task_gen('subst')
|
obj = bld.new_task_gen('subst')
|
||||||
obj.source = 'doc/reference.doxygen.in'
|
obj.source = 'doc/reference.doxygen.in'
|
||||||
|
|
@ -367,42 +364,71 @@ def build_version_files(header_path, source_path, domain, major, minor, micro):
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Internationalisation (gettext)
|
def run_tests(ctx, appname, tests):
|
||||||
def build_i18n(bld,dir,name,sources):
|
orig_dir = os.path.abspath(os.curdir)
|
||||||
pwd = bld.get_curdir()
|
failures = 0
|
||||||
os.chdir(pwd)
|
base = '..'
|
||||||
|
|
||||||
pot_file = '%s.pot' % name
|
top_level = os.path.abspath(ctx.curdir) != os.path.abspath(os.curdir)
|
||||||
|
if top_level:
|
||||||
|
os.chdir('./build/default/' + appname)
|
||||||
|
base = '../..'
|
||||||
|
else:
|
||||||
|
os.chdir('./build/default')
|
||||||
|
|
||||||
args = [ 'xgettext',
|
lcov = True
|
||||||
'--keyword=_',
|
lcov_log = open('lcov.log', 'w')
|
||||||
'--keyword=N_',
|
try:
|
||||||
'--from-code=UTF-8',
|
# Clear coverage data
|
||||||
'-o', pot_file,
|
subprocess.call('lcov -d ./src -z'.split(),
|
||||||
'--copyright-holder="Paul Davis"' ]
|
stdout=lcov_log, stderr=lcov_log)
|
||||||
args += sources
|
except:
|
||||||
Utils.pprint('GREEN', 'Updating ' + pot_file, sep='')
|
lcov = False
|
||||||
os.spawnvp (os.P_WAIT, 'xgettext', args)
|
print "Failed to run lcov, no coverage report will be generated"
|
||||||
|
|
||||||
po_files = glob.glob ('po/*.po')
|
|
||||||
|
|
||||||
for po_file in po_files:
|
# Run all tests
|
||||||
args = [ 'msgmerge',
|
for i in tests:
|
||||||
'--update',
|
print
|
||||||
po_file,
|
Utils.pprint('BOLD', 'Running %s test %s' % (appname, i))
|
||||||
pot_file ]
|
if subprocess.call(i) == 0:
|
||||||
Utils.pprint('GREEN', 'Updating ' + po_file, sep='')
|
Utils.pprint('GREEN', 'Passed %s %s' % (appname, i))
|
||||||
os.spawnvp (os.P_WAIT, 'msgmerge', args)
|
else:
|
||||||
|
failures += 1
|
||||||
|
Utils.pprint('RED', 'Failed %s %s' % (appname, i))
|
||||||
|
|
||||||
for po_file in po_files:
|
if lcov:
|
||||||
mo_file = po_file.replace ('.po', '.mo')
|
# Generate coverage data
|
||||||
args = [ 'msgfmt',
|
coverage_lcov = open('coverage.lcov', 'w')
|
||||||
'-c',
|
subprocess.call(('lcov -c -d ./src -d ./test -b ' + base).split(),
|
||||||
'-o',
|
stdout=coverage_lcov, stderr=lcov_log)
|
||||||
mo_file,
|
coverage_lcov.close()
|
||||||
po_file ]
|
|
||||||
Utils.pprint('GREEN', 'Generating ' + po_file)
|
# Strip out unwanted stuff
|
||||||
os.spawnvp (os.P_WAIT, 'msgfmt', args)
|
coverage_stripped_lcov = open('coverage-stripped.lcov', 'w')
|
||||||
|
subprocess.call('lcov --remove coverage.lcov *boost* c++*'.split(),
|
||||||
|
stdout=coverage_stripped_lcov, stderr=lcov_log)
|
||||||
|
coverage_stripped_lcov.close()
|
||||||
|
|
||||||
|
# Generate HTML coverage output
|
||||||
|
if not os.path.isdir('./coverage'):
|
||||||
|
os.makedirs('./coverage')
|
||||||
|
subprocess.call('genhtml -o coverage coverage-stripped.lcov'.split(),
|
||||||
|
stdout=lcov_log, stderr=lcov_log)
|
||||||
|
|
||||||
|
lcov_log.close()
|
||||||
|
|
||||||
|
print
|
||||||
|
Utils.pprint('BOLD', 'Summary:', sep=''),
|
||||||
|
if failures == 0:
|
||||||
|
Utils.pprint('GREEN', 'All ' + appname + ' tests passed')
|
||||||
|
else:
|
||||||
|
Utils.pprint('RED', str(failures) + ' ' + appname + ' test(s) failed')
|
||||||
|
|
||||||
|
Utils.pprint('BOLD', 'Coverage:', sep='')
|
||||||
|
print os.path.abspath('coverage/index.html')
|
||||||
|
|
||||||
|
os.chdir(orig_dir)
|
||||||
|
|
||||||
def shutdown():
|
def shutdown():
|
||||||
# This isn't really correct (for packaging), but people asking is annoying
|
# This isn't really correct (for packaging), but people asking is annoying
|
||||||
|
|
|
||||||
|
|
@ -260,14 +260,8 @@ def configure(conf):
|
||||||
|
|
||||||
if flac_supported():
|
if flac_supported():
|
||||||
conf.define ('HAVE_FLAC', 1)
|
conf.define ('HAVE_FLAC', 1)
|
||||||
autowaf.display_msg(conf, 'Checking for FLAC support', True)
|
|
||||||
else:
|
|
||||||
autowaf.display_msg(conf, 'Checking for FLAC support', False)
|
|
||||||
if ogg_supported():
|
if ogg_supported():
|
||||||
conf.define ('HAVE_OGG', 1)
|
conf.define ('HAVE_OGG', 1)
|
||||||
autowaf.display_msg(conf, 'Checking for Ogg/Vorbis support', True)
|
|
||||||
else:
|
|
||||||
autowaf.display_msg(conf, 'Checking for Ogg/Vorbis Support', False)
|
|
||||||
|
|
||||||
conf.write_config_header('libardour-config.h')
|
conf.write_config_header('libardour-config.h')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# Waf utilities for easily building standard unixey packages/libraries
|
# Waf utilities for easily building standard unixey packages/libraries
|
||||||
# Licensed under the GNU GPL v2 or later, see COPYING file for details.
|
# Licensed under the GNU GPL v2 or later, see COPYING file for details.
|
||||||
# Copyright (C) 2008 Dave Robillard
|
# Copyright (C) 2008 David Robillard
|
||||||
# Copyright (C) 2008 Nedko Arnaudov
|
# Copyright (C) 2008 Nedko Arnaudov
|
||||||
|
|
||||||
import os
|
|
||||||
import misc
|
|
||||||
import Configure
|
import Configure
|
||||||
import Options
|
import Options
|
||||||
import Utils
|
import Utils
|
||||||
|
import misc
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from TaskGen import feature, before, after
|
from TaskGen import feature, before, after
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ def set_options(opt):
|
||||||
help="Build debuggable binaries [Default: False]")
|
help="Build debuggable binaries [Default: False]")
|
||||||
opt.add_option('--strict', action='store_true', default=False, dest='strict',
|
opt.add_option('--strict', action='store_true', default=False, dest='strict',
|
||||||
help="Use strict compiler flags and show all warnings [Default: False]")
|
help="Use strict compiler flags and show all warnings [Default: False]")
|
||||||
opt.add_option('--build-docs', action='store_true', default=False, dest='build_docs',
|
opt.add_option('--docs', action='store_true', default=False, dest='docs',
|
||||||
help="Build documentation - requires doxygen [Default: False]")
|
help="Build documentation - requires doxygen [Default: False]")
|
||||||
opt.add_option('--bundle', action='store_true', default=False,
|
opt.add_option('--bundle', action='store_true', default=False,
|
||||||
help="Build a self-contained bundle [Default: False]")
|
help="Build a self-contained bundle [Default: False]")
|
||||||
|
|
@ -77,10 +77,13 @@ def check_header(conf, name, define='', mandatory=False):
|
||||||
checked = conf.env['AUTOWAF_HEADERS']
|
checked = conf.env['AUTOWAF_HEADERS']
|
||||||
if not name in checked:
|
if not name in checked:
|
||||||
checked[name] = True
|
checked[name] = True
|
||||||
|
includes = '' # search default system include paths
|
||||||
|
if sys.platform == "darwin":
|
||||||
|
includes = '/opt/local/include'
|
||||||
if define != '':
|
if define != '':
|
||||||
conf.check(header_name=name, define_name=define, mandatory=mandatory)
|
conf.check(header_name=name, includes=includes, define_name=define, mandatory=mandatory)
|
||||||
else:
|
else:
|
||||||
conf.check(header_name=name, mandatory=mandatory)
|
conf.check(header_name=name, includes=includes, mandatory=mandatory)
|
||||||
|
|
||||||
def nameify(name):
|
def nameify(name):
|
||||||
return name.replace('/', '_').replace('++', 'PP').replace('-', '_').replace('.', '_')
|
return name.replace('/', '_').replace('++', 'PP').replace('-', '_').replace('.', '_')
|
||||||
|
|
@ -108,14 +111,6 @@ def check_pkg(conf, name, **args):
|
||||||
if args['mandatory'] == True:
|
if args['mandatory'] == True:
|
||||||
conf.fatal("Required package " + name + " not found")
|
conf.fatal("Required package " + name + " not found")
|
||||||
|
|
||||||
def chop_prefix(conf, var):
|
|
||||||
name = conf.env[var][len(conf.env['PREFIX']):]
|
|
||||||
if len(name) > 0 and name[0] == '/':
|
|
||||||
name = name[1:]
|
|
||||||
if name == "":
|
|
||||||
name = "/"
|
|
||||||
return name;
|
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
global g_step
|
global g_step
|
||||||
if g_step > 1:
|
if g_step > 1:
|
||||||
|
|
@ -124,10 +119,11 @@ def configure(conf):
|
||||||
conf.env.append_value('CCFLAGS', vals.split())
|
conf.env.append_value('CCFLAGS', vals.split())
|
||||||
conf.env.append_value('CXXFLAGS', vals.split())
|
conf.env.append_value('CXXFLAGS', vals.split())
|
||||||
conf.line_just = 43
|
conf.line_just = 43
|
||||||
|
display_header('Global Configuration')
|
||||||
conf.check_tool('misc')
|
conf.check_tool('misc')
|
||||||
conf.check_tool('compiler_cc')
|
conf.check_tool('compiler_cc')
|
||||||
conf.check_tool('compiler_cxx')
|
conf.check_tool('compiler_cxx')
|
||||||
conf.env['BUILD_DOCS'] = Options.options.build_docs
|
conf.env['DOCS'] = Options.options.docs
|
||||||
conf.env['DEBUG'] = Options.options.debug
|
conf.env['DEBUG'] = Options.options.debug
|
||||||
conf.env['STRICT'] = Options.options.strict
|
conf.env['STRICT'] = Options.options.strict
|
||||||
conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX'])))
|
conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX'])))
|
||||||
|
|
@ -185,22 +181,40 @@ def configure(conf):
|
||||||
else:
|
else:
|
||||||
conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'lv2')
|
conf.env['LV2DIR'] = os.path.join(conf.env['LIBDIR'], 'lv2')
|
||||||
|
|
||||||
conf.env['BINDIRNAME'] = chop_prefix(conf, 'BINDIR')
|
conf.env['BINDIRNAME'] = os.path.basename(conf.env['BINDIR'])
|
||||||
conf.env['LIBDIRNAME'] = chop_prefix(conf, 'LIBDIR')
|
conf.env['LIBDIRNAME'] = os.path.basename(conf.env['LIBDIR'])
|
||||||
conf.env['DATADIRNAME'] = chop_prefix(conf, 'DATADIR')
|
conf.env['DATADIRNAME'] = os.path.basename(conf.env['DATADIR'])
|
||||||
conf.env['CONFIGDIRNAME'] = chop_prefix(conf, 'CONFIGDIR')
|
conf.env['CONFIGDIRNAME'] = os.path.basename(conf.env['CONFIGDIR'])
|
||||||
conf.env['LV2DIRNAME'] = chop_prefix(conf, 'LV2DIR')
|
conf.env['LV2DIRNAME'] = os.path.basename(conf.env['LV2DIR'])
|
||||||
|
|
||||||
|
if Options.options.docs:
|
||||||
|
doxygen = conf.find_program('doxygen')
|
||||||
|
if not doxygen:
|
||||||
|
conf.fatal("Doxygen is required to build documentation, configure without --docs")
|
||||||
|
|
||||||
|
dot = conf.find_program('dot')
|
||||||
|
if not dot:
|
||||||
|
conf.fatal("Graphviz (dot) is required to build documentation, configure without --docs")
|
||||||
|
|
||||||
if Options.options.debug:
|
if Options.options.debug:
|
||||||
conf.env['CCFLAGS'] = [ '-O0', '-g' ]
|
conf.env['CCFLAGS'] = [ '-O0', '-g' ]
|
||||||
conf.env['CXXFLAGS'] = [ '-O0', '-g' ]
|
conf.env['CXXFLAGS'] = [ '-O0', '-g' ]
|
||||||
else:
|
else:
|
||||||
append_cxx_flags('-DNDEBUG')
|
append_cxx_flags('-DNDEBUG')
|
||||||
|
|
||||||
if Options.options.strict:
|
if Options.options.strict:
|
||||||
conf.env.append_value('CCFLAGS', [ '-std=c99', '-pedantic' ])
|
conf.env.append_value('CCFLAGS', [ '-std=c99', '-pedantic' ])
|
||||||
conf.env.append_value('CXXFLAGS', [ '-ansi'])
|
conf.env.append_value('CXXFLAGS', [ '-ansi', '-Woverloaded-virtual', '-Wnon-virtual-dtor'])
|
||||||
append_cxx_flags('-Wall -Wextra -Wno-unused-parameter -Woverloaded-virtual')
|
append_cxx_flags('-Wall -Wextra -Wno-unused-parameter')
|
||||||
|
|
||||||
append_cxx_flags('-fPIC -DPIC -fshow-column')
|
append_cxx_flags('-fPIC -DPIC -fshow-column')
|
||||||
|
|
||||||
|
display_msg(conf, "Install prefix", conf.env['PREFIX'])
|
||||||
|
display_msg(conf, "Debuggable build", str(conf.env['DEBUG']))
|
||||||
|
display_msg(conf, "Strict compiler flags", str(conf.env['STRICT']))
|
||||||
|
display_msg(conf, "Build documentation", str(conf.env['DOCS']))
|
||||||
|
print
|
||||||
|
|
||||||
g_step = 2
|
g_step = 2
|
||||||
|
|
||||||
def set_local_lib(conf, name, has_objects):
|
def set_local_lib(conf, name, has_objects):
|
||||||
|
|
@ -247,24 +261,9 @@ def display_msg(conf, msg, status = None, color = None):
|
||||||
color = 'GREEN'
|
color = 'GREEN'
|
||||||
elif type(status) == bool and not status or status == "False":
|
elif type(status) == bool and not status or status == "False":
|
||||||
color = 'YELLOW'
|
color = 'YELLOW'
|
||||||
Utils.pprint('NORMAL', "%s :" % msg.ljust(conf.line_just), sep='')
|
Utils.pprint('BOLD', "%s :" % msg.ljust(conf.line_just), sep='')
|
||||||
Utils.pprint(color, status)
|
Utils.pprint(color, status)
|
||||||
|
|
||||||
def print_summary(conf):
|
|
||||||
global g_step
|
|
||||||
if g_step > 2:
|
|
||||||
print
|
|
||||||
return
|
|
||||||
e = conf.env
|
|
||||||
print
|
|
||||||
display_header('Global configuration')
|
|
||||||
display_msg(conf, "Install prefix", conf.env['PREFIX'])
|
|
||||||
display_msg(conf, "Debuggable build", str(conf.env['DEBUG']))
|
|
||||||
display_msg(conf, "Strict compiler flags", str(conf.env['STRICT']))
|
|
||||||
display_msg(conf, "Build documentation", str(conf.env['BUILD_DOCS']))
|
|
||||||
print
|
|
||||||
g_step = 3
|
|
||||||
|
|
||||||
def link_flags(env, lib):
|
def link_flags(env, lib):
|
||||||
return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib]))
|
return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib]))
|
||||||
|
|
||||||
|
|
@ -297,7 +296,7 @@ def build_pc(bld, name, version, libs):
|
||||||
obj.dict = {
|
obj.dict = {
|
||||||
'prefix' : pkg_prefix,
|
'prefix' : pkg_prefix,
|
||||||
'exec_prefix' : '${prefix}',
|
'exec_prefix' : '${prefix}',
|
||||||
'libdir' : '${exec_prefix}/lib',
|
'libdir' : '${prefix}/' + bld.env['LIBDIRNAME'],
|
||||||
'includedir' : '${prefix}/include',
|
'includedir' : '${prefix}/include',
|
||||||
name + '_VERSION' : version,
|
name + '_VERSION' : version,
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +308,7 @@ def build_pc(bld, name, version, libs):
|
||||||
|
|
||||||
# Doxygen API documentation
|
# Doxygen API documentation
|
||||||
def build_dox(bld, name, version, srcdir, blddir):
|
def build_dox(bld, name, version, srcdir, blddir):
|
||||||
if not bld.env['BUILD_DOCS']:
|
if not bld.env['DOCS']:
|
||||||
return
|
return
|
||||||
obj = bld.new_task_gen('subst')
|
obj = bld.new_task_gen('subst')
|
||||||
obj.source = 'doc/reference.doxygen.in'
|
obj.source = 'doc/reference.doxygen.in'
|
||||||
|
|
@ -366,6 +365,72 @@ def build_version_files(header_path, source_path, domain, major, minor, micro):
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def run_tests(ctx, appname, tests):
|
||||||
|
orig_dir = os.path.abspath(os.curdir)
|
||||||
|
failures = 0
|
||||||
|
base = '..'
|
||||||
|
|
||||||
|
top_level = os.path.abspath(ctx.curdir) != os.path.abspath(os.curdir)
|
||||||
|
if top_level:
|
||||||
|
os.chdir('./build/default/' + appname)
|
||||||
|
base = '../..'
|
||||||
|
else:
|
||||||
|
os.chdir('./build/default')
|
||||||
|
|
||||||
|
lcov = True
|
||||||
|
lcov_log = open('lcov.log', 'w')
|
||||||
|
try:
|
||||||
|
# Clear coverage data
|
||||||
|
subprocess.call('lcov -d ./src -z'.split(),
|
||||||
|
stdout=lcov_log, stderr=lcov_log)
|
||||||
|
except:
|
||||||
|
lcov = False
|
||||||
|
print "Failed to run lcov, no coverage report will be generated"
|
||||||
|
|
||||||
|
|
||||||
|
# Run all tests
|
||||||
|
for i in tests:
|
||||||
|
print
|
||||||
|
Utils.pprint('BOLD', 'Running %s test %s' % (appname, i))
|
||||||
|
if subprocess.call(i) == 0:
|
||||||
|
Utils.pprint('GREEN', 'Passed %s %s' % (appname, i))
|
||||||
|
else:
|
||||||
|
failures += 1
|
||||||
|
Utils.pprint('RED', 'Failed %s %s' % (appname, i))
|
||||||
|
|
||||||
|
if lcov:
|
||||||
|
# Generate coverage data
|
||||||
|
coverage_lcov = open('coverage.lcov', 'w')
|
||||||
|
subprocess.call(('lcov -c -d ./src -d ./test -b ' + base).split(),
|
||||||
|
stdout=coverage_lcov, stderr=lcov_log)
|
||||||
|
coverage_lcov.close()
|
||||||
|
|
||||||
|
# Strip out unwanted stuff
|
||||||
|
coverage_stripped_lcov = open('coverage-stripped.lcov', 'w')
|
||||||
|
subprocess.call('lcov --remove coverage.lcov *boost* c++*'.split(),
|
||||||
|
stdout=coverage_stripped_lcov, stderr=lcov_log)
|
||||||
|
coverage_stripped_lcov.close()
|
||||||
|
|
||||||
|
# Generate HTML coverage output
|
||||||
|
if not os.path.isdir('./coverage'):
|
||||||
|
os.makedirs('./coverage')
|
||||||
|
subprocess.call('genhtml -o coverage coverage-stripped.lcov'.split(),
|
||||||
|
stdout=lcov_log, stderr=lcov_log)
|
||||||
|
|
||||||
|
lcov_log.close()
|
||||||
|
|
||||||
|
print
|
||||||
|
Utils.pprint('BOLD', 'Summary:', sep=''),
|
||||||
|
if failures == 0:
|
||||||
|
Utils.pprint('GREEN', 'All ' + appname + ' tests passed')
|
||||||
|
else:
|
||||||
|
Utils.pprint('RED', str(failures) + ' ' + appname + ' test(s) failed')
|
||||||
|
|
||||||
|
Utils.pprint('BOLD', 'Coverage:', sep='')
|
||||||
|
print os.path.abspath('coverage/index.html')
|
||||||
|
|
||||||
|
os.chdir(orig_dir)
|
||||||
|
|
||||||
def shutdown():
|
def shutdown():
|
||||||
# This isn't really correct (for packaging), but people asking is annoying
|
# This isn't really correct (for packaging), but people asking is annoying
|
||||||
if Options.commands['install']:
|
if Options.commands['install']:
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ def set_options(opt):
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
autowaf.configure(conf)
|
autowaf.configure(conf)
|
||||||
|
#autowaf.display_header('Evoral Configuration')
|
||||||
|
|
||||||
conf.check_tool('compiler_cxx')
|
conf.check_tool('compiler_cxx')
|
||||||
autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
|
autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
|
||||||
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
|
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
|
||||||
|
|
@ -41,10 +43,8 @@ def configure(conf):
|
||||||
|
|
||||||
conf.env['BUILD_TESTS'] = Options.options.build_tests
|
conf.env['BUILD_TESTS'] = Options.options.build_tests
|
||||||
|
|
||||||
autowaf.print_summary(conf)
|
#autowaf.display_msg(conf, "Unit tests", str(conf.env['BUILD_TESTS']))
|
||||||
autowaf.display_header('Evoral Configuration')
|
#print
|
||||||
autowaf.display_msg(conf, "Unit tests", str(conf.env['BUILD_TESTS']))
|
|
||||||
print
|
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
# Headers
|
# Headers
|
||||||
|
|
|
||||||
18
wscript
18
wscript
|
|
@ -120,7 +120,7 @@ def set_compiler_flags (conf,opt):
|
||||||
config_os = 3
|
config_os = 3
|
||||||
config = config_guess.split ("-")
|
config = config_guess.split ("-")
|
||||||
|
|
||||||
print "system triple: " + config_guess
|
autowaf.display_msg(conf, "System Triple", config_guess)
|
||||||
|
|
||||||
# Autodetect
|
# Autodetect
|
||||||
if opt.dist_target == 'auto':
|
if opt.dist_target == 'auto':
|
||||||
|
|
@ -219,7 +219,7 @@ def set_compiler_flags (conf,opt):
|
||||||
print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
|
print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
|
||||||
|
|
||||||
# check this even if we aren't using FPU optimization
|
# check this even if we aren't using FPU optimization
|
||||||
if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', ccflags='-D_XOPEN_SOURCE=600') == False:
|
if not conf.env['HAVE_POSIX_MEMALIGN']:
|
||||||
optimization_flags.append("-DNO_POSIX_MEMALIGN")
|
optimization_flags.append("-DNO_POSIX_MEMALIGN")
|
||||||
|
|
||||||
# end optimization section
|
# end optimization section
|
||||||
|
|
@ -380,8 +380,10 @@ def sub_config_and_use(conf, name, has_objects = True):
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
create_stored_revision()
|
create_stored_revision()
|
||||||
conf.env['VERSION'] = VERSION
|
conf.env['VERSION'] = VERSION
|
||||||
|
conf.line_just = 52
|
||||||
autowaf.set_recursive()
|
autowaf.set_recursive()
|
||||||
autowaf.configure(conf)
|
autowaf.configure(conf)
|
||||||
|
autowaf.display_header('Ardour Configuration')
|
||||||
|
|
||||||
gcc_versions = fetch_gcc_version()
|
gcc_versions = fetch_gcc_version()
|
||||||
if not Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
|
if not Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
|
||||||
|
|
@ -490,6 +492,7 @@ def configure(conf):
|
||||||
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
|
autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
|
||||||
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
|
autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
|
||||||
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
|
autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
|
||||||
|
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
sub_config_and_use(conf, 'libs/appleutility')
|
sub_config_and_use(conf, 'libs/appleutility')
|
||||||
for i in children:
|
for i in children:
|
||||||
|
|
@ -501,25 +504,26 @@ def configure(conf):
|
||||||
conf.check_cc(function_name='dlopen', header_name='dlfcn.h', linkflags='-ldl', uselib_store='DL')
|
conf.check_cc(function_name='dlopen', header_name='dlfcn.h', linkflags='-ldl', uselib_store='DL')
|
||||||
conf.check_cc(function_name='curl_global_init', header_name='curl/curl.h', linkflags='-lcurl', uselib_store='CURL')
|
conf.check_cc(function_name='curl_global_init', header_name='curl/curl.h', linkflags='-lcurl', uselib_store='CURL')
|
||||||
|
|
||||||
|
if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', ccflags='-D_XOPEN_SOURCE=600') == False:
|
||||||
|
conf.env['HAVE_POSIX_MEMALIGN'] = True
|
||||||
|
|
||||||
# Tell everyone that this is a waf build
|
# Tell everyone that this is a waf build
|
||||||
|
|
||||||
conf.env.append_value('CCFLAGS', '-DWAF_BUILD')
|
conf.env.append_value('CCFLAGS', '-DWAF_BUILD')
|
||||||
conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
|
conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
|
||||||
|
|
||||||
autowaf.print_summary(conf)
|
|
||||||
|
|
||||||
# debug builds should not call home
|
# debug builds should not call home
|
||||||
|
|
||||||
opts = Options.options
|
opts = Options.options
|
||||||
if opts.debug:
|
if opts.debug:
|
||||||
opts.phone_home = False;
|
opts.phone_home = False;
|
||||||
|
|
||||||
autowaf.display_header('Ardour Configuration')
|
|
||||||
autowaf.display_msg(conf, 'Build Target', conf.env['build_target'])
|
autowaf.display_msg(conf, 'Build Target', conf.env['build_target'])
|
||||||
autowaf.display_msg(conf, 'Architecture flags', opts.arch)
|
autowaf.display_msg(conf, 'Architecture flags', opts.arch)
|
||||||
autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
|
autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
|
||||||
autowaf.display_msg(conf, 'AudioUnits', opts.audiounits)
|
autowaf.display_msg(conf, 'AudioUnits', opts.audiounits)
|
||||||
autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
|
autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
|
||||||
|
autowaf.display_msg(conf, 'FLAC', bool(conf.env['HAVE_FLAC']))
|
||||||
if bool(conf.env['HAVE_COREAUDIO']):
|
if bool(conf.env['HAVE_COREAUDIO']):
|
||||||
conf.define ('COREAUDIO', 1)
|
conf.define ('COREAUDIO', 1)
|
||||||
if opts.audiounits:
|
if opts.audiounits:
|
||||||
|
|
@ -538,6 +542,7 @@ def configure(conf):
|
||||||
if opts.gtkosx:
|
if opts.gtkosx:
|
||||||
conf.define ('GTKOSX', 1)
|
conf.define ('GTKOSX', 1)
|
||||||
autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
|
autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
|
||||||
|
autowaf.display_msg(conf, 'OGG', bool(conf.env['HAVE_OGG']))
|
||||||
autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
|
autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
|
||||||
autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
|
autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
|
||||||
autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH']))
|
autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH']))
|
||||||
|
|
@ -568,6 +573,7 @@ def configure(conf):
|
||||||
|
|
||||||
autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
|
autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
|
||||||
autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
|
autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
|
||||||
|
print
|
||||||
|
|
||||||
# and dump the same stuff to a file for use in the build
|
# and dump the same stuff to a file for use in the build
|
||||||
|
|
||||||
|
|
@ -576,7 +582,7 @@ def configure(conf):
|
||||||
config_text.write ("Install prefix: "); config_text.write (str (conf.env['PREFIX'])); config_text.write ("\\n\\\n")
|
config_text.write ("Install prefix: "); config_text.write (str (conf.env['PREFIX'])); config_text.write ("\\n\\\n")
|
||||||
config_text.write ("Debuggable build: "); config_text.write (str (str(conf.env['DEBUG']))); config_text.write ("\\n\\\n")
|
config_text.write ("Debuggable build: "); config_text.write (str (str(conf.env['DEBUG']))); config_text.write ("\\n\\\n")
|
||||||
config_text.write ("Strict compiler flags: "); config_text.write (str (str(conf.env['STRICT']))); config_text.write ("\\n\\\n")
|
config_text.write ("Strict compiler flags: "); config_text.write (str (str(conf.env['STRICT']))); config_text.write ("\\n\\\n")
|
||||||
config_text.write ("Build documentation: "); config_text.write (str (str(conf.env['BUILD_DOCS']))); config_text.write ("\\n\\\n")
|
config_text.write ("Build documentation: "); config_text.write (str (str(conf.env['DOCS']))); config_text.write ("\\n\\\n")
|
||||||
config_text.write ('Build target: '); config_text.write (str (conf.env['build_target'])); config_text.write ("\\n\\\n")
|
config_text.write ('Build target: '); config_text.write (str (conf.env['build_target'])); config_text.write ("\\n\\\n")
|
||||||
config_text.write ('Architecture flags: '); config_text.write (str (opts.arch)); config_text.write ("\\n\\\n")
|
config_text.write ('Architecture flags: '); config_text.write (str (opts.arch)); config_text.write ("\\n\\\n")
|
||||||
config_text.write ('Aubio: '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
|
config_text.write ('Aubio: '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue