From 16ce39c2309769789784a1f74e41ce0c49a75282 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 20 Mar 2013 17:18:55 -0400 Subject: [PATCH] initial, prototype modifications to permit compilation of local libraries as static libs. required a "fix" to libs/pbd/debug.cc to even get the program up and running, and still does not work due to issues with boost::shared_ptr::enable_shared_from_this. controlled by configure-time --internal-{static,shared}-libs, set to shared by default (as has been the case for years) --- libs/ardour/wscript | 11 ++- libs/gtkmm2ext/wscript | 11 ++- libs/midi++2/wscript | 35 ++++---- libs/pbd/debug.cc | 7 +- libs/pbd/wscript | 112 +++++++++++++------------ libs/surfaces/control_protocol/wscript | 4 +- 6 files changed, 104 insertions(+), 76 deletions(-) diff --git a/libs/ardour/wscript b/libs/ardour/wscript index d36b3a04aa..e43cae4131 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -370,11 +370,16 @@ int main(int argc, char** argv) { def build(bld): # Library - obj = bld(features = 'c cxx cshlib cxxshlib') - obj.source = libardour_sources + if bld.is_defined ('INTERNAL_SHARED_LIBS'): + obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=libardour_sources) + else: + obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources) + obj.cxxflags = [ '-fPIC' ] + obj.cflags = [ '-fPIC' ] + obj.export_includes = ['.'] obj.includes = ['.', '../surfaces/control_protocol', '..'] - obj.name = 'libardour' + obj.name = 'ardour' obj.target = 'ardour' obj.uselib = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID', 'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS', diff --git a/libs/gtkmm2ext/wscript b/libs/gtkmm2ext/wscript index 2f7d8b77b4..f2d53117ad 100644 --- a/libs/gtkmm2ext/wscript +++ b/libs/gtkmm2ext/wscript @@ -1,5 +1,6 @@ #!/usr/bin/env python from waflib.extras import autowaf as autowaf +from waflib import Options import os # Version of this package (even if built as a child) @@ -82,14 +83,18 @@ def configure(conf): def build(bld): - obj = bld(features = 'c cxx cxxshlib cshlib') - obj.source = gtkmm2ext_sources + if bld.is_defined ('INTERNAL_SHARED_LIBS'): + obj = bld.shlib(features = 'c cxx cshlib cxxshlib', source=gtkmm2ext_sources) + else: + obj = bld.stlib(features = 'c cxx cstlib cxxstlib', source=gtkmm2ext_sources) + obj.cxxflags = [ '-fPIC' ] + obj.export_includes = ['.'] obj.includes = ['.'] obj.name = 'libgtkmm2ext' obj.target = 'gtkmm2ext' obj.uselib = 'GTKMM GTK GTKOSX OSX GDK' - obj.use = 'libpbd' + obj.use = [ 'libpbd' ] obj.vnum = GTKMM2EXT_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') obj.defines = [ diff --git a/libs/midi++2/wscript b/libs/midi++2/wscript index 9f2f297a4b..ea8988110d 100644 --- a/libs/midi++2/wscript +++ b/libs/midi++2/wscript @@ -1,5 +1,6 @@ #!/usr/bin/env python from waflib.extras import autowaf as autowaf +from waflib import Options import os import sys @@ -25,6 +26,20 @@ out = 'build' path_prefix = 'libs/midi++2/' +libmidi_sources = [ + 'midi.cc', + 'channel.cc', + 'ipmidi_port.cc', + 'jack_midi_port.cc', + 'manager.cc', + 'parser.cc', + 'port.cc', + 'midnam_patch.cc', + 'mmc.cc', + 'mtc.cc', + 'version.cc', +] + def options(opt): autowaf.set_options(opt) opt.add_option('--test', action='store_true', default=False, dest='build_tests', @@ -46,22 +61,12 @@ def configure(conf): def build(bld): # Library - obj = bld(features = 'cxx cxxshlib') - obj.source = ''' - midi.cc - channel.cc - ipmidi_port.cc - jack_midi_port.cc - manager.cc - parser.cc - port.cc - midnam_patch.cc - mmc.cc - mtc.cc - version.cc - ''' + if bld.is_defined ('INTERNAL_SHARED_LIBS'): + obj = bld.shlib(features = 'cxx cxxshlib', source=libmidi_sources) + else: + obj = bld.stlib(features = 'cxx cxxstlib', source=libmidi_sources) + obj.cxxflags = [ '-fPIC', '-DWITH_JACK_MIDI' ] # everybody loves JACK - obj.cxxflags = [ '-DWITH_JACK_MIDI' ] obj.export_includes = ['.'] obj.includes = ['.', '../surfaces/control_protocol'] obj.name = 'libmidipp' diff --git a/libs/pbd/debug.cc b/libs/pbd/debug.cc index 6b526c33ad..98d0fc5091 100644 --- a/libs/pbd/debug.cc +++ b/libs/pbd/debug.cc @@ -30,7 +30,12 @@ using namespace std; static uint64_t _debug_bit = 1; -static std::map _debug_bit_map; + +typedef std::map DebugMap; + +namespace PBD { + DebugMap _debug_bit_map; +} uint64_t PBD::DEBUG::Stateful = PBD::new_debug_bit ("stateful"); uint64_t PBD::DEBUG::Properties = PBD::new_debug_bit ("properties"); diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 0ec2747cb3..4cb4a20f3e 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -1,5 +1,6 @@ #!/usr/bin/env python from waflib.extras import autowaf as autowaf +from waflib import Options from waflib import TaskGen import os import sys @@ -27,6 +28,58 @@ out = 'build' path_prefix = 'libs/pbd/' +libpbd_sources = [ + 'basename.cc', + 'base_ui.cc', + 'boost_debug.cc', + 'cartesian.cc', + 'command.cc', + 'convert.cc', + 'controllable.cc', + 'controllable_descriptor.cc', + 'clear_dir.cc', + 'crossthread.cc', + 'cpus.cc', + 'debug.cc', + 'enumwriter.cc', + 'event_loop.cc', + 'dmalloc.cc', + 'enums.cc', + 'epa.cc', + 'error.cc', + 'file_manager.cc', + 'file_utils.cc', + 'fpu.cc', + 'id.cc', + 'locale_guard.cc', + 'malign.cc', + 'mountpoint.cc', + 'openuri.cc', + 'pathexpand.cc', + 'pathscanner.cc', + 'pool.cc', + 'property_list.cc', + 'pthread_utils.cc', + 'receiver.cc', + 'search_path.cc', + 'semutils.cc', + 'shortpath.cc', + 'signals.cc', + 'sndfile_manager.cc', + 'stacktrace.cc', + 'stateful_diff_command.cc', + 'stateful.cc', + 'strreplace.cc', + 'strsplit.cc', + 'textreceiver.cc', + 'transmitter.cc', + 'undo.cc', + 'uuid.cc', + 'version.cc', + 'whitespace.cc', + 'xml++.cc', +] + def options(opt): autowaf.set_options(opt) @@ -58,58 +111,13 @@ def build(bld): bld(rule = 'python ${SRC} ${TGT}', source = 'pbd/signals.py', target = 'pbd/signals_generated.h') # Library - obj = bld(features = 'cxx cxxshlib') - obj.source = ''' - basename.cc - base_ui.cc - boost_debug.cc - cartesian.cc - command.cc - convert.cc - controllable.cc - controllable_descriptor.cc - clear_dir.cc - crossthread.cc - cpus.cc - debug.cc - enumwriter.cc - event_loop.cc - dmalloc.cc - enums.cc - epa.cc - error.cc - file_manager.cc - file_utils.cc - fpu.cc - id.cc - locale_guard.cc - malign.cc - mountpoint.cc - openuri.cc - pathexpand.cc - pathscanner.cc - pool.cc - property_list.cc - pthread_utils.cc - receiver.cc - search_path.cc - semutils.cc - shortpath.cc - signals.cc - sndfile_manager.cc - stacktrace.cc - stateful_diff_command.cc - stateful.cc - strreplace.cc - strsplit.cc - textreceiver.cc - transmitter.cc - undo.cc - uuid.cc - version.cc - whitespace.cc - xml++.cc - ''' + if bld.is_defined ('INTERNAL_SHARED_LIBS'): + print 'BUILD SHARED LIB' + obj = bld.shlib(features = 'cxx cxxshlib', source=libpbd_sources) + else: + print 'BUILD STATIC LIB' + obj = bld.stlib(features = 'cxx cxxstlib', source=libpbd_sources) + obj.cxxflags = [ '-fPIC' ] if bld.is_defined('DEBUG_RT_ALLOC'): obj.source += 'debug_rt_alloc.c' diff --git a/libs/surfaces/control_protocol/wscript b/libs/surfaces/control_protocol/wscript index 8c083ba9ec..2ba48d5138 100644 --- a/libs/surfaces/control_protocol/wscript +++ b/libs/surfaces/control_protocol/wscript @@ -26,11 +26,11 @@ def build(bld): control_protocol.cc ''' obj.export_includes = ['.', './control_protocol' ] - obj.cxxflags = '-DPACKAGE="ardour_cp"' + obj.cxxflags = '-DPACKAGE="ardour_cp" -fPIC' obj.includes = ['.', './control_protocol'] obj.name = 'libardour_cp' obj.target = 'ardourcp' - obj.use = 'libardour libtimecode' + obj.use = 'ardour libtimecode' obj.vnum = LIBARDOUR_CP_LIB_VERSION obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')