Comment.
[ardour.git] / wscript
diff --git a/wscript b/wscript
index 210573b7aa67b978b005888b0ee1c502c3b35c08..2e5d3066759943902160f680eb6e69ad83b00bc9 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'
@@ -29,6 +31,11 @@ children = [
 ]
 
 
+i18n_children = [
+       'gtk2_ardour',
+       'libs/ardour'
+]
+
 # Version stuff
 
 def fetch_svn_revision (path):
@@ -48,12 +55,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
@@ -116,9 +134,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)
 
@@ -186,7 +201,7 @@ 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")
@@ -195,6 +210,8 @@ def set_compiler_flags (conf,opt):
                        debug_flags.append ("-DUSE_X86_64_ASM")
                if build_host_supports_sse != 1:
                        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)"
+               if conf.check_cc(function_name='posix_memalign', header_name='stdlib.h') == False:
+                       optimization_flags.append("-DNO_POSIX_MEMALIGN")
 
        # end optimization section
                        
@@ -204,7 +221,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 +234,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 +269,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:
@@ -286,7 +298,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')
@@ -338,8 +350,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)
 
@@ -353,14 +367,14 @@ def configure(conf):
        autowaf.configure(conf)
        autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', 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')
@@ -385,11 +399,15 @@ def configure(conf):
        autowaf.display_msg(conf, 'GtkOSX', opts.gtkosx)
        if opts.gtkosx:
                conf.define ('GTKOSX', 1)
+       if opts.coreaudio:
+               conf.define ('COREAUDIO', 1)
        autowaf.display_msg(conf, 'LV2 Support', bool(conf.env['HAVE_SLV2']))
        autowaf.display_msg(conf, 'Rubberband', bool(conf.env['HAVE_RUBBERBAND']))
        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)
+       if opts.nls:
+               conf.define ('ENABLE_NLS', 1)
        autowaf.display_msg(conf, 'System Libraries', opts.syslibs)
        autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
        if opts.tranzport:
@@ -401,17 +419,22 @@ 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'])
 
 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()
+def i18n(bld):
+       bld.recurse (i18n_children)