avoid num-tracks repeat call EditorRegions::set_selected() when a region is selected...
[ardour.git] / wscript
diff --git a/wscript b/wscript
index 210573b7aa67b978b005888b0ee1c502c3b35c08..80596f3f5d059a99212ede4e93caa9f731822a1e 100644 (file)
--- a/wscript
+++ b/wscript
@@ -5,6 +5,8 @@ import os
 import commands
 import re
 import string
+import subprocess
+import sys
 
 # Variables for 'waf dist'
 VERSION = '3.0pre0'
@@ -25,10 +27,17 @@ children = [
        'libs/surfaces',
        'libs/ardour',
        'libs/gtkmm2ext',
+       'libs/clearlooks-newer',
+       'libs/audiographer',
        'gtk2_ardour'
 ]
 
 
+i18n_children = [
+       'gtk2_ardour',
+       'libs/ardour'
+]
+
 # Version stuff
 
 def fetch_svn_revision (path):
@@ -48,12 +57,23 @@ def fetch_git_revision (path):
                        pass
        return rev
 
+def fetch_bzr_revision (path):
+       cmd = subprocess.Popen("LANG= bzr log -l 1 " + path, stdout=subprocess.PIPE, shell=True)
+       out = cmd.communicate()[0]
+       svn = re.search('^svn revno: [0-9]*', out, re.MULTILINE)
+       str = svn.group(0)
+       chars = 'svnreio: '
+       return string.lstrip(str, chars)
+
 def create_stored_revision():
        rev = ""
        if os.path.exists('.svn'):
                rev = fetch_svn_revision('.');
        elif os.path.exists('.git'):
                rev = fetch_git_revision('.');
+       elif os.path.exists('.bzr'):
+               rev = fetch_bzr_revision('.');
+               print "Revision: " + rev;
        elif os.path.exists('libs/ardour/svn_revision.cc'):
                print "Using packaged svn revision"
                return
@@ -62,8 +82,8 @@ def create_stored_revision():
                sys.exit(-1)
 
        try:
-               text =  '#include <ardour/svn_revision.h>\n'
-               text += 'namespace ARDOUR { extern const char* svn_revision = \"' + rev + '\"; }\n'
+               text =  '#include "ardour/svn_revision.h"\n'
+               text += 'namespace ARDOUR { const char* svn_revision = \"' + rev + '\"; }\n'
                print 'Writing svn revision info to libs/ardour/svn_revision.cc'
                o = file('libs/ardour/svn_revision.cc', 'w')
                o.write(text)
@@ -72,13 +92,12 @@ def create_stored_revision():
                print 'Could not open libs/ardour/svn_revision.cc for writing\n'
                sys.exit(-1)
 
-
 def set_compiler_flags (conf,opt):
        #
        # Compiler flags and other system-dependent stuff
        #
 
-       build_host_supports_sse = 0
+       build_host_supports_sse = False
        optimization_flags = []
        if opt.gprofile:
                debug_flags = [ '-pg' ]
@@ -103,7 +122,7 @@ def set_compiler_flags (conf,opt):
                        # The [.] matches to the dot after the major version, "." would match any character
                        if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
                                conf.define ('build_target', 'panther')
-                       if re.search ("darwin8[.]", config[config_kernel]) != None:
+                       elif re.search ("darwin8[.]", config[config_kernel]) != None:
                                conf.define ('build_target', 'tiger')
                        else:
                                conf.define ('build_target', 'leopard')
@@ -116,9 +135,6 @@ def set_compiler_flags (conf,opt):
                                conf.define ('build_target', 'powerpc')
                        else:
                                conf.define ('build_target', 'i686')
-               print "\n*******************************"
-               print "detected DIST_TARGET = " + conf.env['build_target']
-               print "*******************************\n"
        else:
                conf.define ('build_target', opt.dist_target)
 
@@ -166,14 +182,14 @@ def set_compiler_flags (conf,opt):
                                if "mmx" in x86_flags:
                                        optimization_flags.append ("-mmmx")
                                if "sse" in x86_flags:
-                                       build_host_supports_sse = 1
+                                       build_host_supports_sse = True
                                if "3dnow" in x86_flags:
                                        optimization_flags.append ("-m3dnow")
             
-               if config[config_cpu] == "i586":
-                       optimization_flags.append ("-march=i586")
-               elif config[config_cpu] == "i686":
-                       optimization_flags.append ("-march=i686")
+                       if config[config_cpu] == "i586":
+                               optimization_flags.append ("-march=i586")
+                       elif config[config_cpu] == "i686":
+                               optimization_flags.append ("-march=i686")
     
                if ((conf.env['build_target'] == 'i686') or (conf.env['build_target'] == 'x86_64')) and build_host_supports_sse:
                        optimization_flags.extend (["-msse", "-mfpmath=sse", "-DUSE_XMMINTRIN"])
@@ -186,15 +202,19 @@ def set_compiler_flags (conf,opt):
                if conf.env['build_target'] == 'tiger' or conf.env['build_target'] == 'leopard':
                        optimization_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
                        debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS");
-                       libraries['core'].Append(LINKFLAGS= '-framework Accelerate')
+                       conf.env.append_value('LINKFLAGS', "-framework Accelerate")
                elif conf.env['build_target'] == 'i686' or conf.env['build_target'] == 'x86_64':
                        optimization_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
                        debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
-               if conf.env['build_target'] == 'x86_64':
+               elif conf.env['build_target'] == 'x86_64':
                        optimization_flags.append ("-DUSE_X86_64_ASM")
                        debug_flags.append ("-DUSE_X86_64_ASM")
-               if build_host_supports_sse != 1:
+               if not build_host_supports_sse:
                        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
+       if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', ccflags='-D_XOPEN_SOURCE=600') == False:
+               optimization_flags.append("-DNO_POSIX_MEMALIGN")
 
        # end optimization section
                        
@@ -204,7 +224,7 @@ def set_compiler_flags (conf,opt):
            
        if conf.env['build_target'] == 'x86_64' and opt.vst:
                print "\n\n=================================================="
-               print "You cannot use VST plugins with a 64 bit host. Please run scons with VST=0"
+               print "You cannot use VST plugins with a 64 bit host. Please run waf with --vst=0"
                print "\nIt is theoretically possible to build a 32 bit host on a 64 bit system."
                print "However, this is tricky and not recommended for beginners."
                sys.exit (-1)
@@ -217,13 +237,7 @@ def set_compiler_flags (conf,opt):
                conf.define ('IS_OSX', 1)
                # force tiger or later, to avoid issues on PPC which defaults
                # back to 10.1 if we don't tell it otherwise.
-               conf.env.append_value (CCFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
-
-               if conf.env['build_target'] == 'leopard':
-                       # need this to force build against the 10.4 SDK when building on later versions of OS X
-                       # ideally this would be configurable, but lets just do that later when we need it
-                       conf.env.append_value(CCFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk")
-                       conf.env.append_value(LINKFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+               conf.env.append_value('CCFLAGS', "-DMAC_OS_X_VERSION_MIN_REQUIRED=1040")
 
        else:
                conf.define ('IS_OSX', 0)
@@ -258,6 +272,7 @@ def set_compiler_flags (conf,opt):
                conf.env.append_value('LINKFLAGS', debug_flags)
        else:
                conf.env.append_value('CCFLAGS', optimization_flags)
+               conf.env.append_value('CXXFLAGS', optimization_flags)
                conf.env.append_value('LINKFLAGS', optimization_flags)
 
        if opt.stl_debug:
@@ -276,9 +291,9 @@ def set_compiler_flags (conf,opt):
        conf.env.append_value('CXXFLAGS', [ '-Wall', '-Woverloaded-virtual'])
 
        if opt.extra_warn:
-               conf.env.append_value('CCFLAGS', [ '-Wextra', '-pedantic', '-ansi' ])
-               conf.env.append_value('CXXFLAGS', [ '-Wextra', '-pedantic', '-ansi' ])
-               #conf.env.append_value('CFLAGS', "-iso")
+               flags = [ '-Wextra' ]
+               conf.env.append_value('CCFLAGS', flags )
+               conf.env.append_value('CXXFLAGS', flags )
 
 
        #
@@ -286,7 +301,7 @@ def set_compiler_flags (conf,opt):
        #
 
        conf.env.append_value('CCFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ])
-       conf.env.append_value('CXXFLAGS', [ '-D_LARGEFILE_SOURCE', '-D_LARGEFILE_SOURCE' ])
+       conf.env.append_value('CXXFLAGS', [ '-D_LARGEFILE64_SOURCE', '-D_LARGEFILE_SOURCE' ])
        if opt.nls:
                conf.env.append_value('CXXFLAGS', '-DENABLE_NLS')
                conf.env.append_value('CCFLAGS', '-DENABLE_NLS')
@@ -300,8 +315,8 @@ def set_options(opt):
        autowaf.set_options(opt)
        opt.add_option('--arch', type='string', action='store', dest='arch',
                        help='Architecture-specific compiler flags')
-       opt.add_option('--aubio', action='store_true', default=True, dest='aubio',
-                       help="Use Paul Brossier's aubio library for feature detection (if available)")
+       opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
+                       help='Compile with Boost shared pointer debugging')
        opt.add_option('--audiounits', action='store_true', default=False, dest='audiounits',
                        help='Compile with Apple\'s AudioUnit library (experimental)')
        opt.add_option('--coreaudio', action='store_true', default=False, dest='coreaudio',
@@ -311,7 +326,8 @@ def set_options(opt):
        opt.add_option('--extra-warn', action='store_true', default=False, dest='extra_warn',
                        help='Build with even more compiler warning flags')
        opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
-                       help='Build runtime checked assembler code')
+                       help='Build runtime checked assembler code (default)')
+       opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
        opt.add_option('--freedesktop', action='store_true', default=False, dest='freedesktop',
                        help='Install MIME type, icons and .desktop file as per freedesktop.org standards')
        opt.add_option('--freesound', action='store_true', default=False, dest='freesound',
@@ -323,11 +339,10 @@ def set_options(opt):
        opt.add_option('--lv2', action='store_true', default=False, dest='lv2',
                        help='Compile with support for LV2 (if slv2 is available)')
        opt.add_option('--nls', action='store_true', default=True, dest='nls',
-                       help='Enable i18n (native language support)')
+                       help='Enable i18n (native language support) (default)')
+       opt.add_option('--no-nls', action='store_false', dest='nls')
        opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
                        help='Build with debugging for the STL')
-       opt.add_option('--syslibs', action='store_true', default=True, dest='syslibs',
-                       help='Use existing system versions of various libraries instead of internal ones')
        opt.add_option('--tranzport', action='store_true', default=False, dest='tranzport',
                        help='Compile with support for Frontier Designs Tranzport (if libusb is available)')
        opt.add_option('--universal', action='store_true', default=False, dest='universal',
@@ -338,8 +353,10 @@ def set_options(opt):
                        help='Compile with support for VST')
        opt.add_option('--wiimote', action='store_true', default=False, dest='wiimote',
                        help='Build the wiimote control surface')
-       opt.add_option('--windows-key', type='string', dest='windows_key',
-                       help='Set X Modifier (Mod1,Mod2,Mod3,Mod4,Mod5) for "Windows" key [Default: Mod4]', default='Mod4><Super')
+       opt.add_option('--windows-key', type='string', action='store', dest='windows_key', default='Mod4><Super',
+                      help='X Modifier(s) (Mod1,Mod2, etc) for the Windows key (X11 builds only). ' +
+                      'Multiple modifiers must be separated by \'><\'')
+
        for i in children:
                opt.sub_options(i)
 
@@ -351,16 +368,113 @@ def configure(conf):
        create_stored_revision()
        autowaf.set_recursive()
        autowaf.configure(conf)
+       
+       if sys.platform == 'darwin':
+               #
+               #       Define OSX as a uselib to use when compiling
+               #       on Darwin to add all applicable flags at once
+               #
+               conf.env.append_value('CXXFLAGS_OSX', "-mmacosx-version-min=10.4")
+               conf.env.append_value('CCFLAGS_OSX', "-mmacosx-version-min=10.4")
+               conf.env.append_value('CXXFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+               conf.env.append_value('CCFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+               conf.env.append_value('LINKFLAGS_OSX', "-mmacosx-version-min=10.4")
+               conf.env.append_value('LINKFLAGS_OSX', "-isysroot /Developer/SDKs/MacOSX10.4u.sdk")
+
+               conf.env.append_value('LINKFLAGS_OSX', "-sysroot /Developer/SDKs/MacOSX10.4u.sdk")
+               conf.env.append_value('LINKFLAGS_OSX', "-F/System/Library/Frameworks")
+
+               conf.env.append_value('CXXFLAGS_OSX', "-msse")
+               conf.env.append_value('CCFLAGS_OSX', "-msse")
+               conf.env.append_value('CXXFLAGS_OSX', "-msse2")
+               conf.env.append_value('CCFLAGS_OSX', "-msse2")
+               #
+               #       TODO: The previous sse flags NEED to be based
+               #       off processor type.  Need to add in a check
+               #       for that.
+               #
+
+               conf.env.append_value('CPPPATH_OSX', "/System/Library/Frameworks/")
+               conf.env.append_value('CPPPATH_OSX', "/usr/include/")
+               conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0")
+               conf.env.append_value('CPPPATH_OSX', "/usr/include/c++/4.0.0/i686-apple-darwin8/")
+               #
+               #       TODO: Fix the above include path, it needs to be
+               #       defined based off what is read in the configuration
+               #       stage about the machine(PPC, X86, X86_64, etc.)
+               #
+               conf.env.append_value('CPPPATH_OSX', "/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/")
+               #
+               #       TODO: Likewise this needs to be defined not only
+               #       based off the machine characteristics, but also
+               #       based off the version of GCC being used.
+               #
+
+               conf.env.append_value('FRAMEWORK_OSX', ['CoreFoundation'])
+
+               conf.env.append_value('LINKFLAGS_OSX', ['-undefined', 'suppress'])
+               conf.env.append_value('LINKFLAGS_OSX', "-flat_namespace")
+               #
+               #       The previous 2 flags avoid circular dependencies
+               #       between libardour and libardour_cp on OS X.
+               #       ld reported -undefined suppress as an unknown option
+               #       in one of the tests ran, removing it for the moment
+               #
+               conf.env.append_value('CXXFLAGS_OSX', "-F/System/Library/Frameworks")
+               conf.env.append_value('CCFLAGS_OSX', "-F/System/Library/Frameworks")
+
+               # GTKOSX only builds on darwin anyways
+               if Options.options.gtkosx:
+                       #
+                       #       Define Include Paths for GTKOSX
+                       #
+                       conf.env.append_value('CXXFLAGS_GTKOSX', '-DTOP_MENUBAR')
+                       conf.env.append_value('CXXFLAGS_GTKOSX', '-DGTKOSX')
+                       conf.env.append_value('LINKFLAGS_GTKOSX', "-framework AppKit")
+                       conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker -headerpad")
+                       conf.env.append_value('LINKFLAGS_GTKOSX', "-Xlinker 2048")
+                       conf.env.append_value('CPPPATH_GTKOSX', "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/")
+       
+               if Options.options.coreaudio:
+                       conf.check_cc (header_name = '/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudio.h',
+                                      define_name = 'HAVE_COREAUDIO', linkflags = ['-framework CoreAudio'],
+                                      uselib_store="COREAUDIO")
+                       conf.check_cxx (header_name = '/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h',
+                                       linkflags = [ '-framework AudioToolbox' ], uselib_store="COREAUDIO")
+                       conf.check_cc (header_name = '/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h',
+                                      linkflags = ['-framework CoreServices'], uselib_store="COREAUDIO")
+
+               if Options.options.audiounits:
+                       #conf.env.append_value('CXXFLAGS_AUDIOUNIT', "-DHAVE_AUDIOUNITS")
+                       conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['AudioToolbox'])
+                       conf.env.append_value('FRAMEWORK_AUDIOUNIT', ['CoreServices'])
+                       conf.check_cc (header_name = '/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h',
+                                      define_name = 'HAVE_AUDIOUNITS', linkflags = [ '-framework AudioUnit' ],
+                                      uselib_store="AUDIOUNIT")
+
+       if Options.options.boost_sp_debug:
+               conf.env.append_value('CXXFLAGS', '-DBOOST_SP_ENABLE_DEBUG_HOOKS')
+
+       autowaf.check_header(conf, 'boost/signals2.hpp')
+
+       conf.check_cc(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
+                     execute = "1",
+                     mandatory = True,
+                     msg = 'Checking for boost library >= 1.39',
+                     okmsg = 'ok',
+                     errmsg = 'too old\nPlease install boost version 1.39 or higher.')
+
        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, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0')
+       if sys.platform == 'darwin':
+               sub_config_and_use(conf, 'libs/appleutility')
        for i in children:
                sub_config_and_use(conf, i)
 
        # Fix utterly braindead FLAC include path to not smash assert.h
        conf.env['CPPPATH_FLAC'] = []
 
-       set_compiler_flags (conf, Options.options)
-       
        # Tell everyone that this is a waf build
 
        conf.env.append_value('CCFLAGS', '-DWAF_BUILD')
@@ -373,6 +487,9 @@ def configure(conf):
        autowaf.display_msg(conf, 'Architecture flags', opts.arch)
        autowaf.display_msg(conf, 'Aubio', bool(conf.env['HAVE_AUBIO']))
        autowaf.display_msg(conf, 'AudioUnits', opts.audiounits)
+       autowaf.display_msg(conf, 'CoreAudio', bool(conf.env['HAVE_COREAUDIO']))
+       if bool(conf.env['HAVE_COREAUDIO']):
+               conf.define ('COREAUDIO', 1)
        if opts.audiounits:
                conf.define('AUDIOUNITS',1)
        autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization)
@@ -390,7 +507,8 @@ def configure(conf):
        autowaf.display_msg(conf, 'Samplerate', bool(conf.env['HAVE_SAMPLERATE']))
        autowaf.display_msg(conf, 'Soundtouch', bool(conf.env['HAVE_SOUNDTOUCH']))
        autowaf.display_msg(conf, 'Translation', opts.nls)
-       autowaf.display_msg(conf, 'System Libraries', opts.syslibs)
+       if opts.nls:
+               conf.define ('ENABLE_NLS', 1)
        autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
        if opts.tranzport:
                conf.define('TRANZPORT', 1)
@@ -401,17 +519,77 @@ def configure(conf):
        autowaf.display_msg(conf, 'Wiimote Support', opts.wiimote)
        if opts.wiimote:
                conf.define('WIIMOTE',1)
-       autowaf.display_msg(conf, 'Windows Key', opts.windows_key)
        if opts.windows_key:
                conf.define('WINDOWS_KEY', opts.windows_key)
+       autowaf.display_msg(conf, 'Windows Key', opts.windows_key)
+
+       set_compiler_flags (conf, Options.options)
+
        autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
        autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
 
+       # and dump the same stuff to a file for use in the build
+
+       config_text = open ('libs/ardour/config_text.cc',"w")
+       config_text.write ('#include "ardour/ardour.h"\n\nnamespace ARDOUR {\nconst char* const ardour_config_info = "\\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 ("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 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 ('Aubio '); config_text.write (str (bool(conf.env['HAVE_AUBIO']))); config_text.write ("\\n\\\n")
+       config_text.write ('AudioUnits '); config_text.write (str (opts.audiounits)); config_text.write ("\\n\\\n")
+       config_text.write ('CoreAudio '); config_text.write (str (bool(conf.env['HAVE_COREAUDIO']))); config_text.write ("\\n\\\n")
+       config_text.write ('FPU Optimization '); config_text.write (str (opts.fpu_optimization)); config_text.write ("\\n\\\n")
+       config_text.write ('Freedesktop Files '); config_text.write (str (opts.freedesktop)); config_text.write ("\\n\\\n")
+       config_text.write ('Freesound '); config_text.write (str (opts.freesound)); config_text.write ("\\n\\\n")
+       config_text.write ('GtkOSX '); config_text.write (str (opts.gtkosx)); config_text.write ("\\n\\\n")
+       config_text.write ('LV2 Support '); config_text.write (str (bool(conf.env['HAVE_SLV2']))); config_text.write ("\\n\\\n")
+       config_text.write ('Rubberband '); config_text.write (str (bool(conf.env['HAVE_RUBBERBAND']))); config_text.write ("\\n\\\n")
+       config_text.write ('Samplerate '); config_text.write (str (bool(conf.env['HAVE_SAMPLERATE']))); config_text.write ("\\n\\\n")
+       config_text.write ('Soundtouch '); config_text.write (str (bool(conf.env['HAVE_SOUNDTOUCH']))); config_text.write ("\\n\\\n")
+       config_text.write ('Translation '); config_text.write (str (opts.nls)); config_text.write ("\\n\\\n")
+       config_text.write ('Tranzport '); config_text.write (str (opts.tranzport)); config_text.write ("\\n\\\n")
+       config_text.write ('Universal Binary '); config_text.write (str (opts.universal)); config_text.write ("\\n\\\n")
+       config_text.write ('VST Support '); config_text.write (str (opts.vst)); config_text.write ("\\n\\\n")
+       config_text.write ('Wiimote Support '); config_text.write (str (opts.wiimote)); config_text.write ("\\n\\\n")
+       config_text.write ('Windows Key '); config_text.write (str (opts.windows_key)); config_text.write ("\\n\\\n")
+       config_text.write ('C Compiler flags '); config_text.write (str (conf.env['CCFLAGS'])); config_text.write ("\\n\\\n")
+       config_text.write ('C++ Compiler flags '); config_text.write (str (conf.env['CXXFLAGS'])); config_text.write ("\\n\\\n")
+       config_text.write ('";}\n')
+       config_text.close ()
+
 def build(bld):
        autowaf.set_recursive()
+       if sys.platform == 'darwin':
+               bld.add_subdirs('libs/appleutility')
        for i in children:
                bld.add_subdirs(i)
 
-def shutdown():
-       autowaf.shutdown()
+       # ideally, we'd like to use the OS-provided MIDI API
+       # for default ports. that doesn't work on at least
+       # Fedora (Nov 9th, 2009) so use JACK MIDI on linux.
+       
+       if sys.platform == 'darwin':
+               rc_subst_dict = {
+                       'MIDITAG'    : 'control',
+                       'MIDITYPE'   : 'coremidi',
+                       'JACK_INPUT' : 'auditioner'
+                       }
+       else:
+               rc_subst_dict = {
+                       'MIDITAG'    : 'control',
+                       'MIDITYPE'   : 'jack',
+                       'JACK_INPUT' : 'auditioner'
+                       }
+
+       obj              = bld.new_task_gen('subst')
+       obj.source       = 'ardour.rc.in'
+       obj.target       = 'ardour_system.rc'
+       obj.dict         = rc_subst_dict
+       obj.install_path = '${CONFIGDIR}/ardour3'
+
+def i18n(bld):
+       bld.recurse (i18n_children)