fix (?) crash caused near program exit when using MCP. sort of a bandaid, but its...
[ardour.git] / SConstruct
index eaa2637f31a29163334bb432b63c62c801e6710c..c60aece0be1b225c6797ef7370ff19babc081259 100644 (file)
@@ -21,7 +21,7 @@ import SCons.Node.FS
 SConsignFile()
 EnsureSConsVersion(0, 96)
 
-ardour_version = '2.7.1'
+ardour_version = '2.8.3'
 
 subst_dict = { }
 
@@ -51,6 +51,7 @@ opts.AddOptions(
     PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'),
     BoolOption('SURFACES', 'Build support for control surfaces', 1),
     BoolOption('WIIMOTE', 'Build the wiimote control surface', 0),
+    ('DIST_LIBDIR', 'Explicitly set library dir. If not set, Fedora-style defaults are used (typically lib or lib64)', ''),
     BoolOption('SYSLIBS', 'USE AT YOUR OWN RISK: CANCELS ALL SUPPORT FROM ARDOUR AUTHORS: Use existing system versions of various libraries instead of internal ones', 0),
     BoolOption('UNIVERSAL', 'Compile as universal binary.  Requires that external libraries are already universal.', 0),
     BoolOption('VERSIONED', 'Add revision information to ardour/gtk executable name inside the build directory', 0),
@@ -71,6 +72,7 @@ opts.AddOptions(
 class LibraryInfo(Environment):
     def __init__(self,*args,**kw):
         Environment.__init__ (self,*args,**kw)
+        self.ENV_update(os.environ)
     
     def Merge (self,others):
         for other in others:
@@ -87,7 +89,7 @@ class LibraryInfo(Environment):
     def ENV_update(self, src_ENV):
         for k in src_ENV.keys():
             if k in self['ENV'].keys() and k in [ 'PATH', 'LD_LIBRARY_PATH',
-                                                  'LIB', 'INCLUDE' ]:
+                                                  'LIB', 'PKG_CONFIG_PATH', 'INCLUDE' ]:
                 self['ENV'][k]=SCons.Util.AppendPath(self['ENV'][k], src_ENV[k])
             else:
                 self['ENV'][k]=src_ENV[k]
@@ -400,10 +402,10 @@ env.Append (BUILDERS = {'Tarball' : tarball_bld})
 
 def pushEnvironment(context):
     if os.environ.has_key('PATH'):
-       context.Append(PATH = os.environ['PATH'])
+       context['ENV']['PATH'] = os.environ['PATH']
        
     if os.environ.has_key('PKG_CONFIG_PATH'):
-       context.Append(PKG_CONFIG_PATH = os.environ['PKG_CONFIG_PATH'])
+       context['ENV']['PKG_CONFIG_PATH'] = os.environ['PKG_CONFIG_PATH']
            
     if os.environ.has_key('CC'):
        context['CC'] = os.environ['CC']
@@ -432,6 +434,7 @@ deps = \
        'lrdf'                 : '0.4.0',
        'jack'                 : '0.109.0',
        'libgnomecanvas-2.0'   : '2.0',
+       'sndfile'              : '1.0.18'
 }
 
 def DependenciesRequiredMessage():
@@ -482,18 +485,6 @@ libraries = { }
 
 libraries['core'] = LibraryInfo (CCFLAGS = '-Ilibs')
 
-#libraries['sndfile'] = LibraryInfo()
-#libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile')
-
-libraries['lrdf'] = LibraryInfo()
-libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf')
-
-libraries['raptor'] = LibraryInfo()
-libraries['raptor'].ParseConfig('pkg-config --cflags --libs raptor')
-
-libraries['samplerate'] = LibraryInfo()
-libraries['samplerate'].ParseConfig('pkg-config --cflags --libs samplerate')
-
 conf = env.Configure (custom_tests = { 'CheckPKGExists' : CheckPKGExists } )
 
 if conf.CheckPKGExists ('fftw3f'):
@@ -569,6 +560,18 @@ libraries['xml'].ParseConfig('pkg-config --cflags --libs libxml-2.0')
 libraries['xslt'] = LibraryInfo()
 libraries['xslt'].ParseConfig('pkg-config --cflags --libs libxslt')
 
+libraries['lrdf'] = LibraryInfo()
+libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf')
+
+libraries['raptor'] = LibraryInfo()
+libraries['raptor'].ParseConfig('pkg-config --cflags --libs raptor')
+
+libraries['sndfile'] = LibraryInfo()
+libraries['sndfile'].ParseConfig ('pkg-config --cflags --libs sndfile')
+
+libraries['samplerate'] = LibraryInfo()
+libraries['samplerate'].ParseConfig('pkg-config --cflags --libs samplerate')
+
 libraries['glib2'] = LibraryInfo()
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0')
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0')
@@ -661,6 +664,12 @@ if env['DIST_TARGET'] == 'auto':
     print "detected DIST_TARGET = " + env['DIST_TARGET']
     print "*******************************\n"
 
+if env['DIST_TARGET'] != 'tiger' and env['DIST_TARGET'] != 'leopard':
+       # make sure this is all disabled for non-OS X builds
+       env['GTKOSX'] = 0
+       env['COREAUDIO'] = 0
+       env['AUDIOUNITS'] = 0
+       env['AUSTATE'] = 0
 
 if config[config_cpu] == 'powerpc' and env['DIST_TARGET'] != 'none':
     #
@@ -738,15 +747,29 @@ if env['FPU_OPTIMIZATION']:
             opt_flags.append ("-DUSE_X86_64_ASM")
             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)"
+            print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be anerror, especially if you are a package maintainer)"
 # end optimization section
 
 # handle x86/x86_64 libdir properly
 
-if env['DIST_TARGET'] == 'x86_64':
-    env['LIBDIR']='lib64'
+if env['DIST_LIBDIR'] == '':
+    if env['DIST_TARGET'] == 'x86_64':
+        env['LIBDIR']='lib64'
+    else:
+        env['LIBDIR']='lib'
 else:
-    env['LIBDIR']='lib'
+    env['LIBDIR'] = env['DIST_LIBDIR']
+
+#
+# no VST on x86_64
+#
+
+if env['DIST_TARGET'] == 'x86_64' and env['VST']:
+    print "\n\n=================================================="
+    print "You cannot use VST plugins with a 64 bit host. Please run scons 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)
 
 #
 # a single way to test if we're on OS X
@@ -909,29 +932,9 @@ if env['WIIMOTE']:
 
 
 #
-# Check for FLAC
-
-libraries['flac'] = LibraryInfo ()
-prep_libcheck(env, libraries['flac'])
-libraries['flac'].Append(CPPPATH="/usr/local/include", LIBPATH="/usr/local/lib")
-
-#
-# june 1st 2007: look for a function that is in FLAC 1.1.2 and not in later versions
-#                since the version of libsndfile we have internally does not support
-#                the new API that libFLAC has adopted
-#
-
-conf = Configure (libraries['flac'])
-if conf.CheckLib ('FLAC', 'FLAC__seekable_stream_decoder_init', language='CXX'):
-    conf.env.Append(CCFLAGS='-DHAVE_FLAC')
-    use_flac = True
-else:
-    use_flac = False
-    
-libraries['flac'] = conf.Finish ()
-
-# or if that fails...
-#libraries['flac']    = LibraryInfo (LIBS='FLAC')
+# need a way to see if the installed version of libsndfile supports
+# FLAC ....
+# 
 
 # boost (we don't link against boost, just use some header files)
 
@@ -1068,14 +1071,6 @@ if env['SYSLIBS']:
     libraries['libgnomecanvasmm'] = LibraryInfo()
     libraries['libgnomecanvasmm'].ParseConfig ('pkg-config --cflags --libs libgnomecanvasmm-2.6')
 
-#
-# cannot use system one for the time being
-#
-    
-    libraries['sndfile-ardour'] = LibraryInfo(LIBS='libsndfile-ardour',
-                                    LIBPATH='#libs/libsndfile',
-                                    CPPPATH=['#libs/libsndfile/src'])
-
 #    libraries['libglademm'] = LibraryInfo()
 #    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
 
@@ -1095,7 +1090,6 @@ if env['SYSLIBS']:
     ]
     
     subdirs = [
-        'libs/libsndfile',
         'libs/pbd',
         'libs/midi++2',
         'libs/ardour',
@@ -1148,9 +1142,6 @@ else:
     libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch',
                                           LIBPATH='#libs/soundtouch',
                                           CPPPATH=['#libs', '#libs/soundtouch'])
-    libraries['sndfile-ardour'] = LibraryInfo(LIBS='libsndfile-ardour',
-                                    LIBPATH='#libs/libsndfile',
-                                    CPPPATH=['#libs/libsndfile', '#libs/libsndfile/src'])
 #    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
 #                                          LIBPATH='#libs/libglademm',
 #                                          CPPPATH='#libs/libglademm')
@@ -1165,7 +1156,6 @@ else:
     
     subdirs = [
         'libs/sigc++2',
-        'libs/libsndfile',
         'libs/pbd',
         'libs/midi++2',
         'libs/ardour',
@@ -1299,7 +1289,7 @@ env = conf.Finish()
 if env['NLS'] == 1:
     env.Append(CCFLAGS="-DENABLE_NLS")
 
-Export('env install_prefix final_prefix config_prefix final_config_prefix libraries i18n ardour_version subst_dict use_flac')
+Export('env install_prefix final_prefix config_prefix final_config_prefix libraries i18n ardour_version subst_dict')
 
 #
 # the configuration file may be system dependent