add actual wine-built code for VST support
[ardour.git] / SConstruct
index 04d1b3545fe21caed7d8dc61084c9cc1832963fa..94da428f2cbf16b24c993bcfa02eb19bd920e45d 100644 (file)
@@ -8,13 +8,14 @@ import glob
 import errno
 import time
 import platform
+import string
 from sets import Set
 import SCons.Node.FS
 
 SConsignFile()
 EnsureSConsVersion(0, 96)
 
-version = '2.0alpha2'
+version = '2.0beta2'
 
 subst_dict = { }
 
@@ -25,18 +26,21 @@ subst_dict = { }
 opts = Options('scache.conf')
 opts.AddOptions(
   ('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''),
-    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('COREAUDIO', 'Compile with Apple\'s CoreAudio library', 0),
     BoolOption('DEBUG', 'Set to build with debugging information and no optimizations', 0),
     PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'),
-    BoolOption('DEVBUILD', 'Use shared libardour (developers only)', 0),
+    EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'tiger', 'panther', 'none' ), ignorecase=2),
+    BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0),
+    BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0),
+    BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
+    BoolOption('LIBLO', 'Compile with support for liblo library', 1),
     BoolOption('NLS', 'Set to turn on i18n support', 1),
     PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'),
-    BoolOption('VST', 'Compile with support for VST', 0),
+    BoolOption('SURFACES', 'Build support for control surfaces', 0),
+    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('VERSIONED', 'Add version information to ardour/gtk executable name inside the build directory', 0),
-    EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'tiger', 'panther', 'none' ), ignorecase=2),
-    BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
-       BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0)
-  )
+    BoolOption('VST', 'Compile with support for VST', 0)
+)
 
 #----------------------------------------------------------------------
 # a handy helper that provides a way to merge compile/link information
@@ -55,8 +59,8 @@ class LibraryInfo(Environment):
             self.Append (LINKFLAGS = other.get('LINKFLAGS', []))
        self.Replace(LIBPATH = list(Set(self.get('LIBPATH', []))))
        self.Replace(CPPPATH = list(Set(self.get('CPPPATH',[]))))
-       #doing LINKFLAGS breaks -framework
-    #doing LIBS break link order dependency
+        #doing LINKFLAGS breaks -framework
+        #doing LIBS break link order dependency
 
 
 env = LibraryInfo (options = opts,
@@ -342,6 +346,21 @@ tarball_bld = Builder (action = tarballer,
 env.Append (BUILDERS = {'Distribute' : dist_bld})
 env.Append (BUILDERS = {'Tarball' : tarball_bld})
 
+#
+# Make sure they know what they are doing
+#
+
+if env['VST']:
+    sys.stdout.write ("Are you building Ardour for personal use (rather than distributiont to others)? [no]: ")
+    answer = sys.stdin.readline ()
+    answer = string.strip (string.rstrip (answer));
+    if answer != "yes" and answer != "y":
+        print 'You cannot build Ardour with VST support for distribution to others.\nIt is a violation of several different licenses. VST support disabled.'
+        env['VST'] = 0;
+    else:
+        print "OK, VST support will be enabled"
+        
+
 # ----------------------------------------------------------------------
 # Construction environment setup
 # ----------------------------------------------------------------------
@@ -350,8 +369,8 @@ libraries = { }
 
 libraries['core'] = LibraryInfo (CCFLAGS = '-Ilibs')
 
-libraries['sndfile'] = LibraryInfo()
-libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile')
+#libraries['sndfile'] = LibraryInfo()
+#libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile')
 
 libraries['lrdf'] = LibraryInfo()
 libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf')
@@ -372,10 +391,14 @@ libraries['jack'].ParseConfig('pkg-config --cflags --libs jack')
 libraries['xml'] = LibraryInfo()
 libraries['xml'].ParseConfig('pkg-config --cflags --libs libxml-2.0')
 
+libraries['xslt'] = LibraryInfo()
+libraries['xslt'].ParseConfig('pkg-config --cflags --libs libxslt')
+
 libraries['glib2'] = LibraryInfo()
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0')
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0')
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gmodule-2.0')
+libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gthread-2.0')
 
 libraries['gtk2'] = LibraryInfo()
 libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
@@ -386,12 +409,14 @@ libraries['pango'].ParseConfig ('pkg-config --cflags --libs pango')
 libraries['libgnomecanvas2'] = LibraryInfo()
 libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomecanvas-2.0')
 
-libraries['glade2'] = LibraryInfo()
-libraries['glade2'].ParseConfig ('pkg-config --cflags --libs libglade-2.0')
+#libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
+
+# The Ardour Control Protocol Library
 
-libraries['usb'] = LibraryInfo (LIBS='usb')
+libraries['ardour_cp'] = LibraryInfo (LIBS='ardour_cp', LIBPATH='#libs/surfaces/control_protocol',
+                                      CPPPATH='#libs/surfaces/control_protocol')
 
-#libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
+# The Ardour backend/engine
 
 libraries['ardour'] = LibraryInfo (LIBS='ardour', LIBPATH='#libs/ardour', CPPPATH='#libs/ardour')
 libraries['midi++2'] = LibraryInfo (LIBS='midi++', LIBPATH='#libs/midi++2', CPPPATH='#libs/midi++2')
@@ -399,9 +424,59 @@ libraries['pbd3']    = LibraryInfo (LIBS='pbd', LIBPATH='#libs/pbd3', CPPPATH='#
 libraries['gtkmm2ext'] = LibraryInfo (LIBS='gtkmm2ext', LIBPATH='#libs/gtkmm2ext', CPPPATH='#libs/gtkmm2ext')
 #libraries['cassowary'] = LibraryInfo(LIBS='cassowary', LIBPATH='#libs/cassowary', CPPPATH='#libs/cassowary')
 
-libraries['fst'] = LibraryInfo()
-if env['VST']:
-    libraries['fst'].ParseConfig('pkg-config --cflags --libs libfst')
+#
+# Check for libusb
+
+libraries['usb'] = LibraryInfo ()
+
+conf = Configure (libraries['usb'])
+if conf.CheckLib ('usb', 'usb_interrupt_write'):
+    have_libusb = True
+else:
+    have_libusb = False
+    
+libraries['usb'] = conf.Finish ()
+
+#
+# Check for FLAC
+
+libraries['flac'] = LibraryInfo ()
+
+conf = Configure (libraries['flac'])
+conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new')
+libraries['flac'] = conf.Finish ()
+
+#
+# Check for liblo
+
+if env['LIBLO']:
+    libraries['lo'] = LibraryInfo ()
+
+    conf = Configure (libraries['lo'])
+    if conf.CheckLib ('lo', 'lo_server_new') == False:
+        print "liblo does not appear to be installed."
+        sys.exit (1)
+    
+    libraries['lo'] = conf.Finish ()
+
+#
+# Check for dmalloc
+
+libraries['dmalloc'] = LibraryInfo ()
+
+#
+# look for the threaded version
+#
+
+conf = Configure (libraries['dmalloc'])
+if conf.CheckLib ('dmallocth', 'dmalloc_shutdown'):
+    have_libdmalloc = True
+else:
+    have_libdmalloc = False
+    
+libraries['dmalloc'] = conf.Finish ()
+
+#
 
 #
 # Audio/MIDI library (needed for MIDI, since audio is all handled via JACK)
@@ -420,7 +495,10 @@ elif conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/Co
     env['SYSMIDI'] = 'CoreMIDI'
     subst_dict['%MIDITAG%'] = "ardour"
     subst_dict['%MIDITYPE%'] = "coremidi"
-
+else:
+    print "It appears you don't have the required MIDI libraries installed."
+    sys.exit (1)
+        
 env = conf.Finish()
 
 if env['SYSLIBS']:
@@ -439,8 +517,17 @@ if env['SYSLIBS']:
     libraries['pangomm'].ParseConfig ('pkg-config --cflags --libs pangomm-1.4')
     libraries['libgnomecanvasmm'] = LibraryInfo()
     libraries['libgnomecanvasmm'].ParseConfig ('pkg-config --cflags --libs libgnomecanvasmm-2.6')
-    libraries['libglademm'] = LibraryInfo()
-    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
+
+#
+# cannot use system one for the time being
+#
+
+    libraries['sndfile'] = LibraryInfo(LIBS='libsndfile',
+                                    LIBPATH='#libs/libsndfile',
+                                    CPPPATH=['#libs/libsndfile', '#libs/libsndfile/src'])
+
+#    libraries['libglademm'] = LibraryInfo()
+#    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
 
 #    libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
     libraries['soundtouch'] = LibraryInfo()
@@ -451,11 +538,15 @@ if env['SYSLIBS']:
     ]
 
     subdirs = [
+        'libs/libsndfile',
         'libs/pbd3',
         'libs/midi++2',
         'libs/ardour'
         ]
 
+    if env['VST']:
+        subdirs = ['libs/fst'] + subdirs + ['vst']
+
     gtk_subdirs = [
 #        'libs/flowcanvas',
         'libs/gtkmm2ext',
@@ -488,9 +579,12 @@ else:
     libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch',
                                           LIBPATH='#libs/soundtouch',
                                           CPPPATH=['#libs', '#libs/soundtouch'])
-    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
-                                          LIBPATH='#libs/libglademm',
-                                          CPPPATH='#libs/libglademm')
+    libraries['sndfile'] = LibraryInfo(LIBS='libsndfile',
+                                    LIBPATH='#libs/libsndfile',
+                                    CPPPATH=['#libs/libsndfile', '#libs/libsndfile/src'])
+#    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
+#                                          LIBPATH='#libs/libglademm',
+#                                          CPPPATH='#libs/libglademm')
 
     coredirs = [
         'libs/soundtouch',
@@ -498,31 +592,42 @@ else:
     ]
 
     subdirs = [
-#      'libs/cassowary',
+#          'libs/cassowary',
         'libs/sigc++2',
+        'libs/libsndfile',
         'libs/pbd3',
         'libs/midi++2',
         'libs/ardour'
         ]
 
+    if env['VST']:
+        subdirs = ['libs/fst'] + subdirs + ['vst']
+
     gtk_subdirs = [
        'libs/glibmm2',
        'libs/gtkmm2/pango',
        'libs/gtkmm2/atk',
        'libs/gtkmm2/gdk',
        'libs/gtkmm2/gtk',
-    'libs/libglademm',
        'libs/libgnomecanvasmm',
 #      'libs/flowcanvas',
     'libs/gtkmm2ext',
     'gtk2_ardour'
         ]
 
-surface_subdirs = [
-    'libs/surfaces/tranzport',
-    'libs/surfaces/generic_midi'
-    ]
+#
+# always build the LGPL control protocol lib, since we link against it ourselves
+# ditto for generic MIDI
+#
 
+surface_subdirs = [ 'libs/surfaces/control_protocol', 'libs/surfaces/generic_midi' ]
+
+if env['SURFACES']:
+    if have_libusb:
+        surface_subdirs += [ 'libs/surfaces/tranzport' ]
+    if os.access ('libs/surfaces/sony9pin', os.F_OK):
+        surface_subdirs += [ 'libs/surfaces/sony9pin' ]
+    
 opts.Save('scache.conf', env)
 Help(opts.GenerateHelpText(env))
 
@@ -545,6 +650,8 @@ if os.environ.has_key('DISTCC_HOSTS'):
 final_prefix = '$PREFIX'
 install_prefix = '$DESTDIR/$PREFIX'
 
+subst_dict['INSTALL_PREFIX'] = install_prefix;
+
 if env['PREFIX'] == '/usr':
     final_config_prefix = '/etc'
 else:
@@ -669,6 +776,12 @@ if env['FPU_OPTIMIZATION']:
             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)"
 # end optimization section
 
+#
+# save off guessed arch element in an env
+#
+env.Append(CONFIG_ARCH=config[config_arch])
+
+
 #
 # ARCH="..." overrides all 
 #
@@ -692,10 +805,15 @@ if env['DEBUG'] == 1:
 else:
     env.Append(CCFLAGS=" ".join (opt_flags))
 
+#
+# warnings flags
+#
+
 env.Append(CCFLAGS="-Wall")
+env.Append(CXXFLAGS="-Woverloaded-virtual")
 
-if env['VST']:
-    env.Append(CCFLAGS="-DVST_SUPPORT")
+if env['LIBLO']:
+    env.Append(CCFLAGS="-DHAVE_LIBLO")
 
 #
 # everybody needs this
@@ -796,10 +914,10 @@ env.AddPostAction (srcdist, Action ('rm -rf ' + str (File (env['DISTTREE']))))
 for subdir in coredirs:
     SConscript (subdir + '/SConscript')
 
-for sublistdir in [subdirs, gtk_subdirs, surface_subdirs]:
-       for subdir in sublistdir:
-               SConscript (subdir + '/SConscript')
-
+for sublistdir in [ subdirs, gtk_subdirs, surface_subdirs ]:
+    for subdir in sublistdir:
+        SConscript (subdir + '/SConscript')
+            
 # cleanup
 env.Clean ('scrub', [ 'scache.conf', '.sconf_temp', '.sconsign.dblite', 'config.log'])