From 16d97766465ba87cd69412836d65e68395e84943 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 25 Feb 2009 17:51:42 +0000 Subject: Move waf up to top level, waf building of pbd, evoral, midi++ git-svn-id: svn://localhost/ardour2/branches/3.0@4654 d708f5d6-7413-0410-9779-e7cbd77b26cf --- autowaf.py | 334 ++++++++++++++++++++++++++++++++++++++++++++++ libs/evoral/autowaf.py | 334 ---------------------------------------------- libs/evoral/waf | Bin 77546 -> 0 bytes libs/midi++2/wscript | 78 +++++++++++ libs/pbd/mountpoint.cc | 4 + libs/pbd/pbd/stacktrace.h | 4 + libs/pbd/wscript | 89 ++++++++++++ waf | Bin 0 -> 77546 bytes 8 files changed, 509 insertions(+), 334 deletions(-) create mode 100644 autowaf.py delete mode 100644 libs/evoral/autowaf.py delete mode 100755 libs/evoral/waf create mode 100644 libs/midi++2/wscript create mode 100644 libs/pbd/wscript create mode 100755 waf diff --git a/autowaf.py b/autowaf.py new file mode 100644 index 0000000000..3439db9d78 --- /dev/null +++ b/autowaf.py @@ -0,0 +1,334 @@ +#!/usr/bin/env python +# Waf utilities for easily building standard unixey packages/libraries +# Licensed under the GNU GPL v2 or later, see COPYING file for details. +# Copyright (C) 2008 Dave Robillard +# Copyright (C) 2008 Nedko Arnaudov + +import os +import misc +import Configure +import Options +import Utils +import sys +from TaskGen import feature, before, after + +global g_is_child +g_is_child = False + +# Only run autowaf hooks once (even if sub projects call several times) +global g_step +g_step = 0 + +# Compute dependencies globally +#import preproc +#preproc.go_absolute = True + +@feature('cc', 'cxx') +@after('apply_lib_vars') +@before('apply_obj_vars_cc', 'apply_obj_vars_cxx') +def include_config_h(self): + self.env.append_value('INC_PATHS', self.bld.srcnode) + +def set_options(opt): + "Add standard autowaf options if they havn't been added yet" + global g_step + if g_step > 0: + return + opt.tool_options('compiler_cc') + opt.tool_options('compiler_cxx') + opt.add_option('--debug', action='store_true', default=False, dest='debug', + help="Build debuggable binaries [Default: False]") + opt.add_option('--strict', action='store_true', default=False, dest='strict', + help="Use strict compiler flags and show all warnings [Default: False]") + opt.add_option('--build-docs', action='store_true', default=False, dest='build_docs', + help="Build documentation - requires doxygen [Default: False]") + opt.add_option('--bundle', action='store_true', default=False, + help="Build a self-contained bundle [Default: False]") + opt.add_option('--bindir', type='string', + help="Executable programs [Default: PREFIX/bin]") + opt.add_option('--libdir', type='string', + help="Libraries [Default: PREFIX/lib]") + opt.add_option('--includedir', type='string', + help="Header files [Default: PREFIX/include]") + opt.add_option('--datadir', type='string', + help="Shared data [Default: PREFIX/share]") + opt.add_option('--mandir', type='string', + help="Manual pages [Default: DATADIR/man]") + opt.add_option('--htmldir', type='string', + help="HTML documentation [Default: DATADIR/doc/PACKAGE]") + opt.add_option('--lv2-user', action='store_true', default=False, dest='lv2_user', + help="Install LV2 bundles to user-local location [Default: False]") + if sys.platform == "darwin": + opt.add_option('--lv2dir', type='string', + help="LV2 bundles [Default: /Library/Audio/Plug-Ins/LV2]") + else: + opt.add_option('--lv2dir', type='string', + help="LV2 bundles [Default: LIBDIR/lv2]") + g_step = 1 + +def check_header(conf, name, define='', mandatory=False): + "Check for a header iff it hasn't been checked for yet" + if type(conf.env['AUTOWAF_HEADERS']) != dict: + conf.env['AUTOWAF_HEADERS'] = {} + + checked = conf.env['AUTOWAF_HEADERS'] + if not name in checked: + checked[name] = True + if define != '': + conf.check(header_name=name, define_name=define, mandatory=mandatory) + else: + conf.check(header_name=name, mandatory=mandatory) + +def check_tool(conf, name): + "Check for a tool iff it hasn't been checked for yet" + if type(conf.env['AUTOWAF_TOOLS']) != dict: + conf.env['AUTOWAF_TOOLS'] = {} + + checked = conf.env['AUTOWAF_TOOLS'] + if not name in checked: + conf.check_tool(name) + checked[name] = True + +def check_pkg(conf, name, **args): + "Check for a package iff it hasn't been checked for yet" + var_name = 'HAVE_' + args['uselib_store'].replace('/', '_') + check = not var_name in conf.env + if not check and 'atleast_version' in args: + # Re-check if version is newer than previous check + checked_version = conf.env['VERSION_' + name] + if checked_version and checked_version < args['atleast_version']: + check = True; + if check: + conf.check_cfg(package=name, args="--cflags --libs", **args) + found = bool(conf.env[var_name]) + if found: + conf.define(var_name, int(found)) + if 'atleast_version' in args: + conf.env['VERSION_' + name] = args['atleast_version'] + else: + conf.undefine(var_name) + if args['mandatory'] == True: + 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): + global g_step + if g_step > 1: + return + def append_cxx_flags(val): + conf.env.append_value('CCFLAGS', val) + conf.env.append_value('CXXFLAGS', val) + conf.line_just = 42 + check_tool(conf, 'misc') + check_tool(conf, 'compiler_cc') + check_tool(conf, 'compiler_cxx') + conf.env['BUILD_DOCS'] = Options.options.build_docs + conf.env['DEBUG'] = Options.options.debug + conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX']))) + if Options.options.bundle: + conf.env['BUNDLE'] = True + conf.define('BUNDLE', 1) + conf.env['BINDIR'] = conf.env['PREFIX'] + conf.env['INCLUDEDIR'] = conf.env['PREFIX'] + '/Headers/' + conf.env['LIBDIR'] = conf.env['PREFIX'] + '/Libraries/' + conf.env['DATADIR'] = conf.env['PREFIX'] + '/Resources/' + conf.env['HTMLDIR'] = conf.env['PREFIX'] + '/Resources/Documentation/' + conf.env['MANDIR'] = conf.env['PREFIX'] + '/Resources/Man/' + conf.env['LV2DIR'] = conf.env['PREFIX'] + '/PlugIns/' + else: + conf.env['BUNDLE'] = False + if Options.options.bindir: + conf.env['BINDIR'] = Options.options.bindir + else: + conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin/' + if Options.options.includedir: + conf.env['INCLUDEDIR'] = Options.options.includedir + else: + conf.env['INCLUDEDIR'] = conf.env['PREFIX'] + '/include/' + if Options.options.libdir: + conf.env['LIBDIR'] = Options.options.libdir + else: + conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib/' + if Options.options.datadir: + conf.env['DATADIR'] = Options.options.datadir + else: + conf.env['DATADIR'] = conf.env['PREFIX'] + '/share/' + if Options.options.htmldir: + conf.env['HTMLDIR'] = Options.options.htmldir + else: + conf.env['HTMLDIR'] = conf.env['DATADIR'] + 'doc/' + Utils.g_module.APPNAME + '/' + if Options.options.mandir: + conf.env['MANDIR'] = Options.options.mandir + else: + conf.env['MANDIR'] = conf.env['DATADIR'] + 'man/' + if Options.options.lv2dir: + conf.env['LV2DIR'] = Options.options.lv2dir + else: + if Options.options.lv2_user: + if sys.platform == "darwin": + conf.env['LV2DIR'] = os.getenv('HOME') + '/Library/Audio/Plug-Ins/LV2' + else: + conf.env['LV2DIR'] = os.getenv('HOME') + '/.lv2' + else: + if sys.platform == "darwin": + conf.env['LV2DIR'] = '/Library/Audio/Plug-Ins/LV2' + else: + conf.env['LV2DIR'] = conf.env['LIBDIR'] + 'lv2/' + + conf.env['BINDIRNAME'] = chop_prefix(conf, 'BINDIR') + conf.env['LIBDIRNAME'] = chop_prefix(conf, 'LIBDIR') + conf.env['DATADIRNAME'] = chop_prefix(conf, 'DATADIR') + conf.env['LV2DIRNAME'] = chop_prefix(conf, 'LV2DIR') + + if Options.options.debug: + conf.env['CCFLAGS'] = '-O0 -g -std=c99' + conf.env['CXXFLAGS'] = '-O0 -g -ansi' + if Options.options.strict: + conf.env['CCFLAGS'] = '-O0 -g -std=c99 -pedantic' + append_cxx_flags('-Wall -Wextra -Wno-unused-parameter') + conf.env.append_value('CXXFLAGS', '-Woverloaded-virtual') + append_cxx_flags('-fPIC -DPIC') + g_step = 2 + +def set_local_lib(conf, name, has_objects): + conf.define('HAVE_' + name.upper().replace('/', '_'), 1) + if has_objects: + if type(conf.env['AUTOWAF_LOCAL_LIBS']) != dict: + conf.env['AUTOWAF_LOCAL_LIBS'] = {} + conf.env['AUTOWAF_LOCAL_LIBS'][name.lower()] = True + else: + if type(conf.env['AUTOWAF_LOCAL_HEADERS']) != dict: + conf.env['AUTOWAF_LOCAL_HEADERS'] = {} + conf.env['AUTOWAF_LOCAL_HEADERS'][name.lower()] = True + +def use_lib(bld, obj, libs): + abssrcdir = os.path.abspath('.') + libs_list = libs.split() + for l in libs_list: + in_headers = l.lower() in bld.env['AUTOWAF_LOCAL_HEADERS'] + in_libs = l.lower() in bld.env['AUTOWAF_LOCAL_LIBS'] + if in_libs: + if hasattr(obj, 'uselib_local'): + obj.uselib_local += ' lib' + l.lower() + ' ' + else: + obj.uselib_local = 'lib' + l.lower() + ' ' + + if in_headers or in_libs: + inc_flag = '-iquote ' + abssrcdir + '/' + l.lower() + for f in ['CCFLAGS', 'CXXFLAGS']: + if not inc_flag in bld.env[f]: + bld.env.prepend_value(f, inc_flag) + else: + if hasattr(obj, 'uselib'): + obj.uselib += ' ' + l + else: + obj.uselib = l + + +def display_header(title): + Utils.pprint('BOLD', title) + +def display_msg(conf, msg, status = None, color = None): + color = 'CYAN' + if type(status) == bool and status or status == "True": + color = 'GREEN' + elif type(status) == bool and not status or status == "False": + color = 'YELLOW' + Utils.pprint('NORMAL', "%s :" % msg.ljust(conf.line_just), sep='') + 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, "Build documentation", str(conf.env['BUILD_DOCS'])) + print + g_step = 3 + +def link_flags(env, lib): + return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib])) + +def compile_flags(env, lib): + return ' '.join(map(lambda x: env['CPPPATH_ST'] % x, env['CPPPATH_' + lib])) + +def set_recursive(): + global g_is_child + g_is_child = True + +def is_child(): + global g_is_child + return g_is_child + +# Pkg-config file +def build_pc(bld, name, version, libs): + '''Build a pkg-config file for a library. + name -- uppercase variable name (e.g. 'SOMENAME') + version -- version string (e.g. '1.2.3') + libs -- string/list of dependencies (e.g. 'LIBFOO GLIB') + ''' + + obj = bld.new_task_gen('subst') + obj.source = name.lower() + '.pc.in' + obj.target = name.lower() + '.pc' + obj.install_path = '${PREFIX}/${LIBDIRNAME}/pkgconfig' + pkg_prefix = bld.env['PREFIX'] + if pkg_prefix[-1] == '/': + pkg_prefix = pkg_prefix[:-1] + obj.dict = { + 'prefix' : pkg_prefix, + 'exec_prefix' : '${prefix}', + 'libdir' : '${exec_prefix}/lib', + 'includedir' : '${prefix}/include', + name + '_VERSION' : version, + } + if type(libs) != list: + libs = libs.split() + for i in libs: + obj.dict[i + '_LIBS'] = link_flags(bld.env, i) + obj.dict[i + '_CFLAGS'] = compile_flags(bld.env, i) + +# Doxygen API documentation +def build_dox(bld, name, version, srcdir, blddir): + if not bld.env['BUILD_DOCS']: + return + obj = bld.new_task_gen('subst') + obj.source = 'doc/reference.doxygen.in' + obj.target = 'doc/reference.doxygen' + if is_child(): + src_dir = srcdir + '/' + name.lower() + doc_dir = blddir + '/default/' + name.lower() + '/doc' + else: + src_dir = srcdir + doc_dir = blddir + '/default/doc' + obj.dict = { + name + '_VERSION' : version, + name + '_SRCDIR' : os.path.abspath(src_dir), + name + '_DOC_DIR' : os.path.abspath(doc_dir) + } + obj.install_path = '' + out1 = bld.new_task_gen('command-output') + out1.stdout = '/doc/doxygen.out' + out1.stdin = '/doc/reference.doxygen' # whatever.. + out1.command = 'doxygen' + out1.argv = [os.path.abspath(doc_dir) + '/reference.doxygen'] + out1.command_is_external = True + +def shutdown(): + # This isn't really correct (for packaging), but people asking is annoying + if Options.commands['install']: + try: os.popen("/sbin/ldconfig") + except: pass + diff --git a/libs/evoral/autowaf.py b/libs/evoral/autowaf.py deleted file mode 100644 index 20e3ef3426..0000000000 --- a/libs/evoral/autowaf.py +++ /dev/null @@ -1,334 +0,0 @@ -#!/usr/bin/env python -# Waf utilities for easily building standard unixey packages/libraries -# Licensed under the GNU GPL v2 or later, see COPYING file for details. -# Copyright (C) 2008 Dave Robillard -# Copyright (C) 2008 Nedko Arnaudov - -import os -import misc -import Configure -import Options -import Utils -import sys -from TaskGen import feature, before, after - -global g_is_child -g_is_child = False - -# Only run autowaf hooks once (even if sub projects call several times) -global g_step -g_step = 0 - -# Compute dependencies globally -#import preproc -#preproc.go_absolute = True - -@feature('cc', 'cxx') -@after('apply_lib_vars') -@before('apply_obj_vars_cc', 'apply_obj_vars_cxx') -def include_config_h(self): - self.env.append_value('INC_PATHS', self.bld.srcnode) - -def set_options(opt): - "Add standard autowaf options if they havn't been added yet" - global g_step - if g_step > 0: - return - opt.tool_options('compiler_cc') - opt.tool_options('compiler_cxx') - opt.add_option('--debug', action='store_true', default=False, dest='debug', - help="Build debuggable binaries [Default: False]") - opt.add_option('--strict', action='store_true', default=False, dest='strict', - help="Use strict compiler flags and show all warnings [Default: False]") - opt.add_option('--build-docs', action='store_true', default=False, dest='build_docs', - help="Build documentation - requires doxygen [Default: False]") - opt.add_option('--bundle', action='store_true', default=False, - help="Build a self-contained bundle [Default: False]") - opt.add_option('--bindir', type='string', - help="Executable programs [Default: PREFIX/bin]") - opt.add_option('--libdir', type='string', - help="Libraries [Default: PREFIX/lib]") - opt.add_option('--includedir', type='string', - help="Header files [Default: PREFIX/include]") - opt.add_option('--datadir', type='string', - help="Shared data [Default: PREFIX/share]") - opt.add_option('--mandir', type='string', - help="Manual pages [Default: DATADIR/man]") - opt.add_option('--htmldir', type='string', - help="HTML documentation [Default: DATADIR/doc/PACKAGE]") - opt.add_option('--lv2-user', action='store_true', default=False, dest='lv2_user', - help="Install LV2 bundles to user-local location [Default: False]") - if sys.platform == "darwin": - opt.add_option('--lv2dir', type='string', - help="LV2 bundles [Default: /Library/Audio/Plug-Ins/LV2]") - else: - opt.add_option('--lv2dir', type='string', - help="LV2 bundles [Default: LIBDIR/lv2]") - g_step = 1 - -def check_header(conf, name, define='', mandatory=False): - "Check for a header iff it hasn't been checked for yet" - if type(conf.env['AUTOWAF_HEADERS']) != dict: - conf.env['AUTOWAF_HEADERS'] = {} - - checked = conf.env['AUTOWAF_HEADERS'] - if not name in checked: - checked[name] = True - if define != '': - conf.check(header_name=name, define_name=define, mandatory=mandatory) - else: - conf.check(header_name=name, mandatory=mandatory) - -def check_tool(conf, name): - "Check for a tool iff it hasn't been checked for yet" - if type(conf.env['AUTOWAF_TOOLS']) != dict: - conf.env['AUTOWAF_TOOLS'] = {} - - checked = conf.env['AUTOWAF_TOOLS'] - if not name in checked: - conf.check_tool(name) - checked[name] = True - -def check_pkg(conf, name, **args): - "Check for a package iff it hasn't been checked for yet" - var_name = 'HAVE_' + args['uselib_store'] - check = not var_name in conf.env - if not check and 'atleast_version' in args: - # Re-check if version is newer than previous check - checked_version = conf.env['VERSION_' + name] - if checked_version and checked_version < args['atleast_version']: - check = True; - if check: - conf.check_cfg(package=name, args="--cflags --libs", **args) - found = bool(conf.env['HAVE_' + args['uselib_store']]) - if found: - conf.define('HAVE_' + args['uselib_store'], int(found)) - if 'atleast_version' in args: - conf.env['VERSION_' + name] = args['atleast_version'] - else: - conf.undefine('HAVE_' + args['uselib_store']) - if args['mandatory'] == True: - 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): - global g_step - if g_step > 1: - return - def append_cxx_flags(val): - conf.env.append_value('CCFLAGS', val) - conf.env.append_value('CXXFLAGS', val) - conf.line_just = 42 - check_tool(conf, 'misc') - check_tool(conf, 'compiler_cc') - check_tool(conf, 'compiler_cxx') - conf.env['BUILD_DOCS'] = Options.options.build_docs - conf.env['DEBUG'] = Options.options.debug - conf.env['PREFIX'] = os.path.abspath(os.path.expanduser(os.path.normpath(conf.env['PREFIX']))) - if Options.options.bundle: - conf.env['BUNDLE'] = True - conf.define('BUNDLE', 1) - conf.env['BINDIR'] = conf.env['PREFIX'] - conf.env['INCLUDEDIR'] = conf.env['PREFIX'] + '/Headers/' - conf.env['LIBDIR'] = conf.env['PREFIX'] + '/Libraries/' - conf.env['DATADIR'] = conf.env['PREFIX'] + '/Resources/' - conf.env['HTMLDIR'] = conf.env['PREFIX'] + '/Resources/Documentation/' - conf.env['MANDIR'] = conf.env['PREFIX'] + '/Resources/Man/' - conf.env['LV2DIR'] = conf.env['PREFIX'] + '/PlugIns/' - else: - conf.env['BUNDLE'] = False - if Options.options.bindir: - conf.env['BINDIR'] = Options.options.bindir - else: - conf.env['BINDIR'] = conf.env['PREFIX'] + '/bin/' - if Options.options.includedir: - conf.env['INCLUDEDIR'] = Options.options.includedir - else: - conf.env['INCLUDEDIR'] = conf.env['PREFIX'] + '/include/' - if Options.options.libdir: - conf.env['LIBDIR'] = Options.options.libdir - else: - conf.env['LIBDIR'] = conf.env['PREFIX'] + '/lib/' - if Options.options.datadir: - conf.env['DATADIR'] = Options.options.datadir - else: - conf.env['DATADIR'] = conf.env['PREFIX'] + '/share/' - if Options.options.htmldir: - conf.env['HTMLDIR'] = Options.options.htmldir - else: - conf.env['HTMLDIR'] = conf.env['DATADIR'] + 'doc/' + Utils.g_module.APPNAME + '/' - if Options.options.mandir: - conf.env['MANDIR'] = Options.options.mandir - else: - conf.env['MANDIR'] = conf.env['DATADIR'] + 'man/' - if Options.options.lv2dir: - conf.env['LV2DIR'] = Options.options.lv2dir - else: - if Options.options.lv2_user: - if sys.platform == "darwin": - conf.env['LV2DIR'] = os.getenv('HOME') + '/Library/Audio/Plug-Ins/LV2' - else: - conf.env['LV2DIR'] = os.getenv('HOME') + '/.lv2' - else: - if sys.platform == "darwin": - conf.env['LV2DIR'] = '/Library/Audio/Plug-Ins/LV2' - else: - conf.env['LV2DIR'] = conf.env['LIBDIR'] + 'lv2/' - - conf.env['BINDIRNAME'] = chop_prefix(conf, 'BINDIR') - conf.env['LIBDIRNAME'] = chop_prefix(conf, 'LIBDIR') - conf.env['DATADIRNAME'] = chop_prefix(conf, 'DATADIR') - conf.env['LV2DIRNAME'] = chop_prefix(conf, 'LV2DIR') - - if Options.options.debug: - conf.env['CCFLAGS'] = '-O0 -g -std=c99' - conf.env['CXXFLAGS'] = '-O0 -g -ansi' - if Options.options.strict: - conf.env['CCFLAGS'] = '-O0 -g -std=c99 -pedantic' - append_cxx_flags('-Wall -Wextra -Wno-unused-parameter') - conf.env.append_value('CXXFLAGS', '-Woverloaded-virtual') - append_cxx_flags('-fPIC -DPIC') - g_step = 2 - -def set_local_lib(conf, name, has_objects): - conf.define('HAVE_' + name.upper(), 1) - if has_objects: - if type(conf.env['AUTOWAF_LOCAL_LIBS']) != dict: - conf.env['AUTOWAF_LOCAL_LIBS'] = {} - conf.env['AUTOWAF_LOCAL_LIBS'][name.lower()] = True - else: - if type(conf.env['AUTOWAF_LOCAL_HEADERS']) != dict: - conf.env['AUTOWAF_LOCAL_HEADERS'] = {} - conf.env['AUTOWAF_LOCAL_HEADERS'][name.lower()] = True - -def use_lib(bld, obj, libs): - abssrcdir = os.path.abspath('.') - libs_list = libs.split() - for l in libs_list: - in_headers = l.lower() in bld.env['AUTOWAF_LOCAL_HEADERS'] - in_libs = l.lower() in bld.env['AUTOWAF_LOCAL_LIBS'] - if in_libs: - if hasattr(obj, 'uselib_local'): - obj.uselib_local += ' lib' + l.lower() + ' ' - else: - obj.uselib_local = 'lib' + l.lower() + ' ' - - if in_headers or in_libs: - inc_flag = '-iquote ' + abssrcdir + '/' + l.lower() - for f in ['CCFLAGS', 'CXXFLAGS']: - if not inc_flag in bld.env[f]: - bld.env.prepend_value(f, inc_flag) - else: - if hasattr(obj, 'uselib'): - obj.uselib += ' ' + l - else: - obj.uselib = l - - -def display_header(title): - Utils.pprint('BOLD', title) - -def display_msg(conf, msg, status = None, color = None): - color = 'CYAN' - if type(status) == bool and status or status == "True": - color = 'GREEN' - elif type(status) == bool and not status or status == "False": - color = 'YELLOW' - Utils.pprint('NORMAL', "%s :" % msg.ljust(conf.line_just), sep='') - 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, "Build documentation", str(conf.env['BUILD_DOCS'])) - print - g_step = 3 - -def link_flags(env, lib): - return ' '.join(map(lambda x: env['LIB_ST'] % x, env['LIB_' + lib])) - -def compile_flags(env, lib): - return ' '.join(map(lambda x: env['CPPPATH_ST'] % x, env['CPPPATH_' + lib])) - -def set_recursive(): - global g_is_child - g_is_child = True - -def is_child(): - global g_is_child - return g_is_child - -# Pkg-config file -def build_pc(bld, name, version, libs): - '''Build a pkg-config file for a library. - name -- uppercase variable name (e.g. 'SOMENAME') - version -- version string (e.g. '1.2.3') - libs -- string/list of dependencies (e.g. 'LIBFOO GLIB') - ''' - - obj = bld.new_task_gen('subst') - obj.source = name.lower() + '.pc.in' - obj.target = name.lower() + '.pc' - obj.install_path = '${PREFIX}/${LIBDIRNAME}/pkgconfig' - pkg_prefix = bld.env['PREFIX'] - if pkg_prefix[-1] == '/': - pkg_prefix = pkg_prefix[:-1] - obj.dict = { - 'prefix' : pkg_prefix, - 'exec_prefix' : '${prefix}', - 'libdir' : '${exec_prefix}/lib', - 'includedir' : '${prefix}/include', - name + '_VERSION' : version, - } - if type(libs) != list: - libs = libs.split() - for i in libs: - obj.dict[i + '_LIBS'] = link_flags(bld.env, i) - obj.dict[i + '_CFLAGS'] = compile_flags(bld.env, i) - -# Doxygen API documentation -def build_dox(bld, name, version, srcdir, blddir): - if not bld.env['BUILD_DOCS']: - return - obj = bld.new_task_gen('subst') - obj.source = 'doc/reference.doxygen.in' - obj.target = 'doc/reference.doxygen' - if is_child(): - src_dir = srcdir + '/' + name.lower() - doc_dir = blddir + '/default/' + name.lower() + '/doc' - else: - src_dir = srcdir - doc_dir = blddir + '/default/doc' - obj.dict = { - name + '_VERSION' : version, - name + '_SRCDIR' : os.path.abspath(src_dir), - name + '_DOC_DIR' : os.path.abspath(doc_dir) - } - obj.install_path = '' - out1 = bld.new_task_gen('command-output') - out1.stdout = '/doc/doxygen.out' - out1.stdin = '/doc/reference.doxygen' # whatever.. - out1.command = 'doxygen' - out1.argv = [os.path.abspath(doc_dir) + '/reference.doxygen'] - out1.command_is_external = True - -def shutdown(): - # This isn't really correct (for packaging), but people asking is annoying - if Options.commands['install']: - try: os.popen("/sbin/ldconfig") - except: pass - diff --git a/libs/evoral/waf b/libs/evoral/waf deleted file mode 100755 index f9a5c97b6f..0000000000 Binary files a/libs/evoral/waf and /dev/null differ diff --git a/libs/midi++2/wscript b/libs/midi++2/wscript new file mode 100644 index 0000000000..3b5401b327 --- /dev/null +++ b/libs/midi++2/wscript @@ -0,0 +1,78 @@ +#!/usr/bin/env python +import autowaf + +# Version of this package (even if built as a child) +LIBMIDIPP_VERSION = '0.0.0' + +# Library version (UNIX style major, minor, micro) +# major increment <=> incompatible changes +# minor increment <=> compatible changes (additions) +# micro increment <=> no interface changes +LIBMIDIPP_LIB_VERSION = '4.1.0' + +# Variables for 'waf dist' +APPNAME = 'libmidipp' +VERSION = LIBMIDIPP_VERSION + +# Mandatory variables +srcdir = '.' +blddir = 'build' + +def set_options(opt): + autowaf.set_options(opt) + +def configure(conf): + autowaf.configure(conf) + autowaf.check_tool(conf, 'compiler_cxx') + autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2', mandatory=True) + autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=True) + autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0', mandatory=True) + autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML', mandatory=True) + autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.109.0', mandatory=True) + + conf.env.append_value('CXXFLAGS', '-DHAVE_WAFCONFIG_H') + conf.write_config_header('wafconfig.h') + + # TODO + conf.env['SYSMIDI'] == 'JACK MIDI' + conf.env.append_value('CXXFLAGS', '-DWITH_JACK_MIDI') + + # Boost headers + autowaf.check_header(conf, 'boost/shared_ptr.hpp', mandatory=True) + autowaf.check_header(conf, 'boost/weak_ptr.hpp', mandatory=True) + +def build(bld): + # Library + obj = bld.new_task_gen('cxx', 'shlib') + obj.source = ''' + fd_midiport.cc + fifomidi.cc + midi.cc + midichannel.cc + midifactory.cc + midimanager.cc + midiparser.cc + midiport.cc + midnam_patch.cc + mmc.cc + mtc.cc + version.cc + ''' + if bld.env['SYSMIDI'] == 'JACK MIDI': + obj.source += ' jack_midiport.cc ' + elif bld.env['SYSMIDI'] == 'Alsa Sequencer': + obj.source += ' alsa_sequencer_midiport.cc ' + elif bld.env['SYSMIDI'] == 'CoreMIDI': + obj.source += ' coremidi_midiport.cc ' + obj.export_incdirs = ['.'] + obj.includes = ['.'] + obj.name = 'libmidipp' + obj.target = 'midipp' + obj.uselib = 'GLIBMM SIGCPP XML JACK' + obj.uselib_local = 'libpbd libevoral' + obj.vnum = LIBMIDIPP_LIB_VERSION + obj.install_path = '' + +def shutdown(): + autowaf.shutdown() + diff --git a/libs/pbd/mountpoint.cc b/libs/pbd/mountpoint.cc index f273146343..a4063a0e40 100644 --- a/libs/pbd/mountpoint.cc +++ b/libs/pbd/mountpoint.cc @@ -28,6 +28,10 @@ using std::string; +#ifdef HAVE_WAFCONFIG_H +#include "wafconfig.h" +#endif + #if HAVE_GETMNTENT #include diff --git a/libs/pbd/pbd/stacktrace.h b/libs/pbd/pbd/stacktrace.h index 0a349dcaeb..18f7b993e1 100644 --- a/libs/pbd/pbd/stacktrace.h +++ b/libs/pbd/pbd/stacktrace.h @@ -29,6 +29,10 @@ namespace PBD { void stacktrace (std::ostream& out, int levels = 0); void trace_twb(); +#ifdef HAVE_WAFCONFIG_H +#include "wafconfig.h" +#endif + #ifdef HAVE_EXECINFO #include #include diff --git a/libs/pbd/wscript b/libs/pbd/wscript new file mode 100644 index 0000000000..9b5dc4cbb2 --- /dev/null +++ b/libs/pbd/wscript @@ -0,0 +1,89 @@ +#!/usr/bin/env python +import autowaf + +# Version of this package (even if built as a child) +LIBPBD_VERSION = '0.0.0' + +# Library version (UNIX style major, minor, micro) +# major increment <=> incompatible changes +# minor increment <=> compatible changes (additions) +# micro increment <=> no interface changes +LIBPBD_LIB_VERSION = '4.1.0' + +# Variables for 'waf dist' +APPNAME = 'libpbd' +VERSION = LIBPBD_VERSION + +# Mandatory variables +srcdir = '.' +blddir = 'build' + +def set_options(opt): + autowaf.set_options(opt) + +def configure(conf): + autowaf.configure(conf) + autowaf.check_tool(conf, 'compiler_cxx') + autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2', mandatory=True) + autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=True) + autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0', mandatory=True) + autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML', mandatory=True) + autowaf.check_pkg(conf, 'uuid', uselib_store='UUID', mandatory=True) + + conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT') + conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO') + + conf.env.append_value('CXXFLAGS', '-DHAVE_WAFCONFIG_H') + conf.write_config_header('wafconfig.h') + + # Boost headers + autowaf.check_header(conf, 'boost/shared_ptr.hpp', mandatory=True) + autowaf.check_header(conf, 'boost/weak_ptr.hpp', mandatory=True) + +def build(bld): + # Library + obj = bld.new_task_gen('cxx', 'shlib') + obj.source = ''' + basename.cc + base_ui.cc + command.cc + convert.cc + controllable.cc + enumwriter.cc + dmalloc.cc + error.cc + filesystem.cc + filesystem_paths.cc + file_utils.cc + fpu.cc + id.cc + mountpoint.cc + pathscanner.cc + pool.cc + pthread_utils.cc + receiver.cc + search_path.cc + shortpath.cc + stacktrace.cc + stateful.cc + strreplace.cc + strsplit.cc + textreceiver.cc + transmitter.cc + undo.cc + uuid.cc + version.cc + whitespace.cc + xml++.cc + ''' + obj.export_incdirs = ['.'] + obj.includes = ['.'] + obj.name = 'libpbd' + obj.target = 'pbd' + obj.uselib = 'GLIBMM SIGCPP XML UUID' + obj.vnum = LIBPBD_LIB_VERSION + obj.install_path = '' + +def shutdown(): + autowaf.shutdown() + diff --git a/waf b/waf new file mode 100755 index 0000000000..f9a5c97b6f Binary files /dev/null and b/waf differ -- cgit v1.2.3