From 310d68b953fca09b057aaa87703747546e98d354 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 25 Feb 2009 21:48:32 +0000 Subject: [PATCH] Waf building of libardour (yay!). git-svn-id: svn://localhost/ardour2/branches/3.0@4661 d708f5d6-7413-0410-9779-e7cbd77b26cf --- autowaf.py | 7 + libs/ardour/ardour/route.h | 2 +- libs/ardour/audioengine.cc | 18 +- libs/ardour/port.cc | 3 +- libs/ardour/wscript | 216 ++++++++++++++++++ libs/pbd/wscript | 7 +- libs/surfaces/wscript | 59 +++++ libs/taglib/SConscript | 1 + libs/taglib/taglib/mpeg/id3v2/id3v2frame.cpp | 2 + .../taglib/mpeg/id3v2/id3v2framefactory.cpp | 2 + libs/taglib/wscript | 3 +- wscript | 5 +- 12 files changed, 309 insertions(+), 16 deletions(-) create mode 100644 libs/ardour/wscript create mode 100644 libs/surfaces/wscript diff --git a/autowaf.py b/autowaf.py index df6b43beff..1015afdb9d 100644 --- a/autowaf.py +++ b/autowaf.py @@ -52,6 +52,8 @@ def set_options(opt): help="Header files [Default: PREFIX/include]") opt.add_option('--datadir', type='string', help="Shared data [Default: PREFIX/share]") + opt.add_option('--configdir', type='string', + help="Configuration data [Default: PREFIX/etc]") opt.add_option('--mandir', type='string', help="Manual pages [Default: DATADIR/man]") opt.add_option('--htmldir', type='string', @@ -163,6 +165,10 @@ def configure(conf): conf.env['DATADIR'] = Options.options.datadir else: conf.env['DATADIR'] = conf.env['PREFIX'] + '/share/' + if Options.options.configdir: + conf.env['CONFIGDIR'] = Options.options.configdir + else: + conf.env['CONFIGDIR'] = conf.env['PREFIX'] + '/etc/' if Options.options.htmldir: conf.env['HTMLDIR'] = Options.options.htmldir else: @@ -188,6 +194,7 @@ def configure(conf): conf.env['BINDIRNAME'] = chop_prefix(conf, 'BINDIR') conf.env['LIBDIRNAME'] = chop_prefix(conf, 'LIBDIR') conf.env['DATADIRNAME'] = chop_prefix(conf, 'DATADIR') + conf.env['CONFIGDIRNAME'] = chop_prefix(conf, 'CONFIGDIR') conf.env['LV2DIRNAME'] = chop_prefix(conf, 'LV2DIR') if Options.options.debug: diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 9bf2eb8710..a5bd751d22 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -153,7 +153,7 @@ class Route : public IO boost::shared_ptr nth_processor (uint32_t n) { Glib::RWLock::ReaderLock lm (_processor_lock); ProcessorList::iterator i; - for (i = _processors.begin(); i != _processors.end() && n; ++i, --n); + for (i = _processors.begin(); i != _processors.end() && n; ++i, --n) {} if (i == _processors.end()) { return boost::shared_ptr (); } else { diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 4a0b73524e..3d2c4b7e9d 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -55,12 +55,6 @@ using namespace PBD; gint AudioEngine::m_meter_exit; -static void -ardour_jack_error (const char* msg) -{ - error << "JACK: " << msg << endmsg; -} - AudioEngine::AudioEngine (string client_name) : ports (new Ports) { @@ -887,7 +881,7 @@ AudioEngine::n_physical_outputs (DataType type) const return 0; } - for (i = 0; ports[i]; ++i); + for (i = 0; ports[i]; ++i) {} free (ports); return i; @@ -908,7 +902,7 @@ AudioEngine::n_physical_inputs (DataType type) const } if (ports) { - for (i = 0; ports[i]; ++i); + for (i = 0; ports[i]; ++i) {} free (ports); } return i; @@ -982,7 +976,7 @@ AudioEngine::get_nth_physical (DataType type, uint32_t n, int flag) return ""; } - for (i = 0; i < n && ports[i]; ++i); + for (i = 0; i < n && ports[i]; ++i) {} if (ports[i]) { ret = ports[i]; @@ -1116,6 +1110,12 @@ AudioEngine::remove_connections_for (Port& port) #ifdef HAVE_JACK_CLIENT_OPEN +static void +ardour_jack_error (const char* msg) +{ + error << "JACK: " << msg << endmsg; +} + int AudioEngine::connect_to_jack (string client_name) { diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index 676a6a0e4f..8078dfbe08 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -19,12 +19,13 @@ #include "ardour/port.h" #include "ardour/audioengine.h" -#include "ardour/i18n.h" #include "pbd/failed_constructor.h" #include "pbd/error.h" #include "pbd/compose.h" #include +#include "i18n.h" + using namespace std; using namespace ARDOUR; diff --git a/libs/ardour/wscript b/libs/ardour/wscript new file mode 100644 index 0000000000..39e9b5836c --- /dev/null +++ b/libs/ardour/wscript @@ -0,0 +1,216 @@ +#!/usr/bin/env python +import autowaf +import os + +# Version of this package (even if built as a child) +LIBARDOUR_VERSION = '3.0.0' + +# Library version (UNIX style major, minor, micro) +# major increment <=> incompatible changes +# minor increment <=> compatible changes (additions) +# micro increment <=> no interface changes +LIBARDOUR_LIB_VERSION = '3.0.0' + +# Variables for 'waf dist' +APPNAME = 'libardour' +VERSION = LIBARDOUR_VERSION + +# Mandatory variables +srcdir = '.' +blddir = 'build' + +def set_options(opt): + autowaf.set_options(opt) + +def check_header_and_define(conf, header, define): + conf.check(header_name=header, define_name=define) + if conf.env[define]: + conf.env.append_value('CCFLAGS', '-D' + define) + conf.env.append_value('CXXFLAGS', '-D' + define) + +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) + + check_header_and_define(conf, 'wordexp.h', 'HAVE_WORDEXP') + check_header_and_define(conf, 'sys/vfs.h', 'HAVE_SYS_VFS_H') + + conf.env.append_value('CCFLAGS', '-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE') + conf.env.append_value('CXXFLAGS', '-DENABLE_NLS') + + 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 = ''' + amp.cc + analyser.cc + audio_buffer.cc + audio_diskstream.cc + audio_library.cc + audio_playlist.cc + audio_playlist_importer.cc + audio_port.cc + audio_region_importer.cc + audio_track.cc + audio_track_importer.cc + audioanalyser.cc + audioengine.cc + audiofile_tagger.cc + audiofilesource.cc + audioregion.cc + audiosource.cc + auditioner.cc + automatable.cc + automation.cc + automation_control.cc + automation_list.cc + beats_frames_converter.cc + broadcast_info.cc + buffer.cc + buffer_set.cc + bundle.cc + chan_count.cc + configuration.cc + control_protocol_manager.cc + control_protocol_search_path.cc + crossfade.cc + cycle_timer.cc + default_click.cc + directory_names.cc + diskstream.cc + element_import_handler.cc + element_importer.cc + enums.cc + event_type_map.cc + export_channel.cc + export_channel_configuration.cc + export_file_io.cc + export_filename.cc + export_format_base.cc + export_format_manager.cc + export_format_specification.cc + export_formats.cc + export_handler.cc + export_preset.cc + export_processor.cc + export_profile_manager.cc + export_status.cc + export_timespan.cc + export_utilities.cc + filename_extensions.cc + file_source.cc + filesystem_paths.cc + filter.cc + find_session.cc + gain.cc + gdither.cc + globals.cc + import.cc + io.cc + io_processor.cc + jack_slave.cc + ladspa_plugin.cc + location.cc + location_importer.cc + meter.cc + midi_buffer.cc + midi_clock_slave.cc + midi_diskstream.cc + midi_model.cc + midi_patch_manager.cc + midi_playlist.cc + midi_port.cc + midi_region.cc + midi_ring_buffer.cc + midi_source.cc + midi_state_tracker.cc + midi_stretch.cc + midi_track.cc + mix.cc + mtc_slave.cc + named_selection.cc + onset_detector.cc + panner.cc + pcm_utils.cc + playlist.cc + playlist_factory.cc + plugin.cc + plugin_insert.cc + plugin_manager.cc + port.cc + port_insert.cc + port_set.cc + processor.cc + quantize.cc + recent_sessions.cc + region.cc + region_factory.cc + resampled_source.cc + reverse.cc + route.cc + route_group.cc + send.cc + session.cc + session_butler.cc + session_click.cc + session_command.cc + session_directory.cc + session_events.cc + session_export.cc + session_metadata.cc + session_midi.cc + session_process.cc + session_state.cc + session_state_utils.cc + session_time.cc + session_transport.cc + session_utils.cc + smf_source.cc + sndfile_helpers.cc + sndfileimportable.cc + sndfilesource.cc + source.cc + source_factory.cc + svn_revision.cc + tape_file_matcher.cc + template_utils.cc + tempo.cc + tempo_map_importer.cc + ticker.cc + track.cc + transient_detector.cc + user_bundle.cc + utils.cc + version.cc + ''' + obj.export_incdirs = ['.'] + obj.includes = ['.', '../surfaces/control_protocol'] + obj.name = 'libardour' + obj.target = 'ardour' + obj.uselib = 'GLIBMM SIGCPP XML UUID' + obj.uselib_local = 'libpbd libmidipp libevoral libvamp libtaglib' + obj.vnum = LIBARDOUR_LIB_VERSION + obj.install_path = '' + obj.cxxflags = ' -DPACKAGE=\\\"libardour3\\\"' + obj.cxxflags += ' -DDATA_DIR=\\\"' + os.path.normpath(bld.env['DATADIRNAME']) + '\\\"' + obj.cxxflags += ' -DCONFIG_DIR=\\\"' + os.path.normpath(bld.env['CONFIGDIRNAME']) + '\\\"' + obj.cxxflags += ' -DMODULE_DIR=\\\"' + os.path.normpath(bld.env['LIBDIRNAME']) + '\\\"' + obj.cxxflags += ' -DLOCALEDIR=\\\"' + os.path.join( + os.path.normpath(bld.env['DATADIRNAME']), 'locale') + '\\\"' + obj.cxxflags += ' -DVAMP_DIR=\\\"' + os.path.join( + os.path.normpath(bld.env['LIBDIRNAME']), 'ardour3', 'vamp') + '\\\"' + +def shutdown(): + autowaf.shutdown() + diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 9b5dc4cbb2..12a3791b64 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -31,7 +31,9 @@ def configure(conf): 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') + + # This must be defined for libpbd only, it breaks ardour + conf.check(header_name='execinfo.h', define_name='PBD_HAVE_EXECINFO') conf.env.append_value('CXXFLAGS', '-DHAVE_WAFCONFIG_H') conf.write_config_header('wafconfig.h') @@ -77,6 +79,9 @@ def build(bld): xml++.cc ''' obj.export_incdirs = ['.'] + obj.cxxflags = '-DPACKAGE=\\\"libpbd\\\"' + if bld.env['PBD_HAVE_EXECINFO']: + obj.cxxflags += ' -DHAVE_EXECINFO ' obj.includes = ['.'] obj.name = 'libpbd' obj.target = 'pbd' diff --git a/libs/surfaces/wscript b/libs/surfaces/wscript new file mode 100644 index 0000000000..520dd7ff47 --- /dev/null +++ b/libs/surfaces/wscript @@ -0,0 +1,59 @@ +#!/usr/bin/env python +import autowaf + +# Version of this package (even if built as a child) +LIBSURFACES_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 +LIBSURFACES_LIB_VERSION = '4.1.0' + +# Variables for 'waf dist' +APPNAME = 'libsurfaces' +VERSION = LIBSURFACES_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.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 = ''' + control_protocol/basic_ui.cc + control_protocol/control_protocol.cc + control_protocol/smpte.cc + ''' + obj.export_incdirs = ['./control_protocol'] + obj.cxxflags = '-DPACKAGE=\\\"ardour_cp\\\"' + obj.includes = ['.', './control_protocol'] + obj.name = 'libsurfaces' + obj.target = 'surfaces' + obj.uselib_local = 'libardour' + obj.vnum = LIBSURFACES_LIB_VERSION + obj.install_path = '' + +def shutdown(): + autowaf.shutdown() + diff --git a/libs/taglib/SConscript b/libs/taglib/SConscript index d9062889b6..26c90aaba9 100644 --- a/libs/taglib/SConscript +++ b/libs/taglib/SConscript @@ -28,6 +28,7 @@ taglib_files += glob.glob ('taglib/toolkit/*.cpp') domain = 'taglib' taglib.Append(CCFLAGS = "-DPACKAGE=\\\"" + domain + "\\\"") +taglib.Append(CCFLAGS = "-DHAVE_CONFIG_H=1") # mingw may need this #taglib.Append(CCFLAGS="-no-undefined") taglib.Append(PACKAGE = domain) diff --git a/libs/taglib/taglib/mpeg/id3v2/id3v2frame.cpp b/libs/taglib/taglib/mpeg/id3v2/id3v2frame.cpp index 7c76ac7b94..52f0849af3 100644 --- a/libs/taglib/taglib/mpeg/id3v2/id3v2frame.cpp +++ b/libs/taglib/taglib/mpeg/id3v2/id3v2frame.cpp @@ -24,8 +24,10 @@ ***************************************************************************/ #ifndef HAVE_ZLIB +#ifdef HAVE_CONFIG_H #include #endif +#endif #if HAVE_ZLIB #include diff --git a/libs/taglib/taglib/mpeg/id3v2/id3v2framefactory.cpp b/libs/taglib/taglib/mpeg/id3v2/id3v2framefactory.cpp index 48a202216c..0c6f7706f5 100644 --- a/libs/taglib/taglib/mpeg/id3v2/id3v2framefactory.cpp +++ b/libs/taglib/taglib/mpeg/id3v2/id3v2framefactory.cpp @@ -24,8 +24,10 @@ ***************************************************************************/ #ifndef HAVE_ZLIB +#ifdef HAVE_CONFIG_H #include #endif +#endif #include diff --git a/libs/taglib/wscript b/libs/taglib/wscript index f463ff2ae4..2aad178596 100644 --- a/libs/taglib/wscript +++ b/libs/taglib/wscript @@ -25,7 +25,6 @@ def set_options(opt): def configure(conf): autowaf.configure(conf) autowaf.check_tool(conf, 'compiler_cxx') - conf.write_config_header('config.h') def build(bld): # Library @@ -66,7 +65,7 @@ def build(bld): taglib/ogg/speex taglib/ogg/flac '''.split() - obj.export_incdirs = include_dirs + obj.export_incdirs = ['.', 'taglib', 'taglib/toolkit'] obj.includes = include_dirs obj.name = 'libtaglib' obj.target = 'taglib' diff --git a/wscript b/wscript index bbea7aacfc..321e70f1ca 100644 --- a/wscript +++ b/wscript @@ -15,8 +15,8 @@ children = [ 'libs/evoral', 'libs/vamp-sdk', 'libs/taglib', -# 'libs/surfaces', -# 'libs/ardour' + 'libs/surfaces', + 'libs/ardour' ] def set_options(opt): @@ -31,6 +31,7 @@ def sub_config_and_use(conf, name, has_objects = True): def configure(conf): autowaf.set_recursive() autowaf.configure(conf) + #conf.env.append_value('CXXFLAGS', '-DBOOST_NO_STD_LOCALE=1') for i in children: sub_config_and_use(conf, i) -- 2.30.2