VST=1 support working in build scripts
[ardour.git] / SConstruct
index 95664ec1ff555dd01d9d6b8fea9ebb03918dfbfc..9ab5434314bb1dfedd0eb96ba92663f38518e9de 100644 (file)
@@ -15,7 +15,7 @@ import SCons.Node.FS
 SConsignFile()
 EnsureSConsVersion(0, 96)
 
-version = '2.0beta2'
+version = '2.0beta5'
 
 subst_dict = { }
 
@@ -25,12 +25,14 @@ subst_dict = { }
 
 opts = Options('scache.conf')
 opts.AddOptions(
-  ('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''),
+    ('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''),
+    BoolOption('AUDIOUNITS', 'Compile with Apple\'s AudioUnit library. (experimental)', 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"', '/'),
     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('EXTRA_WARN', 'Compile with -Wextra, -ansi, and -pedantic.  Might break compilation.  For pedants', 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),
@@ -363,8 +365,8 @@ if env['VST']:
     answer = sys.stdin.readline ()
     answer = answer.rstrip().strip()
     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;
+        print 'You cannot build Ardour with VST support for distribution to others.\nIt is a violation of several different licenses. Build with VST=false.'
+        sys.exit (-1);
     else:
         print "OK, VST support will be enabled"
 
@@ -450,17 +452,21 @@ libraries['usb'] = conf.Finish ()
 libraries['flac'] = LibraryInfo ()
 
 conf = Configure (libraries['flac'])
-conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new')
+conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new', language='CXX')
 libraries['flac'] = conf.Finish ()
 
-#
-# Check for UUID stuff
+# or if that fails...
+#libraries['flac']    = LibraryInfo (LIBS='FLAC')
 
-libraries['uuid'] = LibraryInfo ()
+# boost (we don't link against boost, just use some header files)
 
-conf = Configure (libraries['uuid'])
-conf.CheckLib ('uuid', 'uuid_generate')
-libraries['uuid'] = conf.Finish ()
+libraries['boost'] = LibraryInfo ()
+conf = Configure (libraries['boost'])
+if conf.CheckHeader ('boost/shared_ptr.hpp', language='CXX') == 0:
+        print "Boost header files do not appear to be installed."
+        sys.exit (1)
+    
+libraries['boost'] = conf.Finish ()
 
 #
 # Check for liblo
@@ -492,8 +498,6 @@ else:
 
 libraries['dmalloc'] = conf.Finish ()
 
-#
-
 #
 # Audio/MIDI library (needed for MIDI, since audio is all handled via JACK)
 #
@@ -548,6 +552,10 @@ if env['SYSLIBS']:
 #    libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
     libraries['soundtouch'] = LibraryInfo()
     libraries['soundtouch'].ParseConfig ('pkg-config --cflags --libs soundtouch-1.0')
+
+    libraries['appleutility'] = LibraryInfo(LIBS='libappleutility',
+                                            LIBPATH='#libs/appleutility',
+                                            CPPPATH='#libs/appleutility')
     
     coredirs = [
         'templates'
@@ -557,12 +565,18 @@ if env['SYSLIBS']:
         'libs/libsndfile',
         'libs/pbd',
         'libs/midi++2',
-        'libs/ardour'
+        'libs/ardour',
+    # these are unconditionally included but have
+    # tests internally to avoid compilation etc
+    # if VST is not set
+        'libs/fst',
+        'vst',
+    # this is unconditionally included but has
+    # tests internally to avoid compilation etc
+    # if COREAUDIO is not set
+        'libs/appleutility'
         ]
     
-    if env['VST']:
-        subdirs = ['libs/fst'] + subdirs + ['vst']
-    
     gtk_subdirs = [
 #        'libs/flowcanvas',
         'libs/gtkmm2ext',
@@ -601,7 +615,10 @@ else:
 #    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
 #                                          LIBPATH='#libs/libglademm',
 #                                          CPPPATH='#libs/libglademm')
-    
+    libraries['appleutility'] = LibraryInfo(LIBS='libappleutility',
+                                            LIBPATH='#libs/appleutility',
+                                            CPPPATH='#libs/appleutility')
+
     coredirs = [
         'libs/soundtouch',
         'templates'
@@ -612,12 +629,18 @@ else:
         'libs/libsndfile',
         'libs/pbd',
         'libs/midi++2',
-        'libs/ardour'
+        'libs/ardour',
+    # these are unconditionally included but have
+    # tests internally to avoid compilation etc
+    # if VST is not set
+        'libs/fst',
+        'vst',
+    # this is unconditionally included but has
+    # tests internally to avoid compilation etc
+    # if COREAUDIO is not set
+        'libs/appleutility'
         ]
     
-    if env['VST']:
-        subdirs = ['libs/fst'] + subdirs + ['vst']
-    
     gtk_subdirs = [
        'libs/glibmm2',
        'libs/gtkmm2/pango',
@@ -663,9 +686,15 @@ if os.environ.has_key('DISTCC_HOSTS'):
     env['ENV']['HOME'] = os.environ['HOME']
 
 final_prefix = '$PREFIX'
-install_prefix = '$DESTDIR/$PREFIX'
 
-subst_dict['INSTALL_PREFIX'] = install_prefix;
+if env['DESTDIR'] :
+    install_prefix = '$DESTDIR/$PREFIX'
+else:
+    install_prefix = env['PREFIX']
+
+subst_dict['%INSTALL_PREFIX%'] = install_prefix;
+subst_dict['%FINAL_PREFIX%'] = final_prefix;
+subst_dict['%PREFIX%'] = final_prefix;
 
 if env['PREFIX'] == '/usr':
     final_config_prefix = '/etc'
@@ -674,7 +703,6 @@ else:
 
 config_prefix = '$DESTDIR' + final_config_prefix
 
-
 # SCons should really do this for us
 
 conf = Configure (env)
@@ -827,6 +855,10 @@ else:
 env.Append(CCFLAGS="-Wall")
 env.Append(CXXFLAGS="-Woverloaded-virtual")
 
+if env['EXTRA_WARN']:
+    env.Append(CCFLAGS="-Wextra -pedantic")
+    env.Append(CXXFLAGS="-ansi")
+
 if env['LIBLO']:
     env.Append(CCFLAGS="-DHAVE_LIBLO")
 
@@ -922,7 +954,17 @@ env.Distribute (env['DISTTREE'],
                   'COPYING', 'PACKAGER_README', 'README',
                   'ardour.rc.in',
                   'ardour_system.rc',
-                  'tools/config.guess'
+                  'tools/config.guess',
+                  'icons/icon/ardour_icon_mac_mask.png',
+                  'icons/icon/ardour_icon_mac.png',
+                  'icons/icon/ardour_icon_tango_16px_blue.png',
+                  'icons/icon/ardour_icon_tango_16px_red.png',
+                  'icons/icon/ardour_icon_tango_22px_blue.png',
+                  'icons/icon/ardour_icon_tango_22px_red.png',
+                  'icons/icon/ardour_icon_tango_32px_blue.png',
+                  'icons/icon/ardour_icon_tango_32px_red.png',
+                  'icons/icon/ardour_icon_tango_48px_blue.png',
+                  'icons/icon/ardour_icon_tango_48px_red.png'
                   ] +
                 glob.glob ('DOCUMENTATION/AUTHORS*') +
                 glob.glob ('DOCUMENTATION/CONTRIBUTORS*') +
@@ -934,6 +976,7 @@ env.Distribute (env['DISTTREE'],
 
 srcdist = env.Tarball(env['TARBALL'], env['DISTTREE'])
 env.Alias ('srctar', srcdist)
+
 #
 # don't leave the distree around
 #