fix SVN merge SNAFU causing double deletion
[ardour.git] / SConstruct
index fcc5382e92b6b2080018952aa6c29396a921f758..f150d30cb045dc2878574a544a5260064d18b98a 100644 (file)
@@ -9,13 +9,14 @@ import errno
 import time
 import platform
 import string
+import commands
 from sets import Set
 import SCons.Node.FS
 
 SConsignFile()
 EnsureSConsVersion(0, 96)
 
-version = '2.0beta2'
+version = '2.0beta6.1'
 
 subst_dict = { }
 
@@ -25,7 +26,8 @@ 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"', '/'),
@@ -235,35 +237,44 @@ def i18n (buildenv, sources, installenv):
 # note: requires that DOMAIN, MAJOR, MINOR, MICRO are set in the construction environment
 # note: assumes one source files, the header that declares the version variables
 #
+
 def version_builder (target, source, env):
-   text  = "int " + env['DOMAIN'] + "_major_version = " + str (env['MAJOR']) + ";\n"
-   text += "int " + env['DOMAIN'] + "_minor_version = " + str (env['MINOR']) + ";\n"
-   text += "int " + env['DOMAIN'] + "_micro_version = " + str (env['MICRO']) + ";\n"
-   
-   try:
-      o = file (target[0].get_path(), 'w')
-      o.write (text)
-      o.close ()
-   except IOError:
-      print "Could not open", target[0].get_path(), " for writing\n"
-      sys.exit (-1)
-   
-   text  = "#ifndef __" + env['DOMAIN'] + "_version_h__\n"
-   text += "#define __" + env['DOMAIN'] + "_version_h__\n"
-   text += "extern int " + env['DOMAIN'] + "_major_version;\n"
-   text += "extern int " + env['DOMAIN'] + "_minor_version;\n"
-   text += "extern int " + env['DOMAIN'] + "_micro_version;\n"
-   text += "#endif /* __" + env['DOMAIN'] + "_version_h__ */\n"
-   
-   try:
-      o = file (target[1].get_path(), 'w')
-      o.write (text)
-      o.close ();
-   except IOError:
-      print "Could not open", target[1].get_path(), " for writing\n"
-      sys.exit (-1)
-   
-   return None
+    cmd = "svn info "
+    cmd += source[0].get_path()
+    cmd += " | awk '/^Revision:/ { print $2}'"
+    
+    rev = commands.getoutput (cmd)
+        
+    text  = "const char* " + env['DOMAIN'] + "_revision = \"" + rev + "\";\n"
+    text += "int " + env['DOMAIN'] + "_major_version = " + str (env['MAJOR']) + ";\n"
+    text += "int " + env['DOMAIN'] + "_minor_version = " + str (env['MINOR']) + ";\n"
+    text += "int " + env['DOMAIN'] + "_micro_version = " + str (env['MICRO']) + ";\n"
+    
+    try:
+        o = file (target[0].get_path(), 'w')
+        o.write (text)
+        o.close ()
+    except IOError:
+        print "Could not open", target[0].get_path(), " for writing\n"
+        sys.exit (-1)
+
+    text  = "#ifndef __" + env['DOMAIN'] + "_version_h__\n"
+    text += "#define __" + env['DOMAIN'] + "_version_h__\n"
+    text += "extern const char* " + env['DOMAIN'] + "_revision;\n"
+    text += "extern int " + env['DOMAIN'] + "_major_version;\n"
+    text += "extern int " + env['DOMAIN'] + "_minor_version;\n"
+    text += "extern int " + env['DOMAIN'] + "_micro_version;\n"
+    text += "#endif /* __" + env['DOMAIN'] + "_version_h__ */\n"
+    
+    try:
+        o = file (target[1].get_path(), 'w')
+        o.write (text)
+        o.close ();
+    except IOError:
+        print "Could not open", target[1].get_path(), " for writing\n"
+        sys.exit (-1)
+        
+    return None
 
 version_bld = Builder (action = version_builder)
 env.Append (BUILDERS = {'VersionBuild' : version_bld})
@@ -364,8 +375,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"
 
@@ -457,6 +468,16 @@ libraries['flac'] = conf.Finish ()
 # or if that fails...
 #libraries['flac']    = LibraryInfo (LIBS='FLAC')
 
+# boost (we don't link against boost, just use some header files)
+
+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
 
@@ -487,8 +508,6 @@ else:
 
 libraries['dmalloc'] = conf.Finish ()
 
-#
-
 #
 # Audio/MIDI library (needed for MIDI, since audio is all handled via JACK)
 #
@@ -542,7 +561,7 @@ if env['SYSLIBS']:
 
 #    libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
     libraries['soundtouch'] = LibraryInfo()
-    libraries['soundtouch'].ParseConfig ('pkg-config --cflags --libs libSoundTouch')
+    libraries['soundtouch'].ParseConfig ('pkg-config --cflags --libs soundtouch-1.0')
 
     libraries['appleutility'] = LibraryInfo(LIBS='libappleutility',
                                             LIBPATH='#libs/appleutility',
@@ -556,15 +575,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']
-
-    if env['COREAUDIO']:
-        subdirs = subdirs + ['libs/appleutility']
-    
     gtk_subdirs = [
 #        'libs/flowcanvas',
         'libs/gtkmm2ext',
@@ -617,15 +639,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']
-
-    if env['COREAUDIO']:
-        subdirs = subdirs + ['libs/appleutility']
-    
     gtk_subdirs = [
        'libs/glibmm2',
        'libs/gtkmm2/pango',
@@ -671,9 +696,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'
@@ -682,7 +713,6 @@ else:
 
 config_prefix = '$DESTDIR' + final_config_prefix
 
-
 # SCons should really do this for us
 
 conf = Configure (env)
@@ -934,7 +964,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*') +
@@ -946,6 +986,7 @@ env.Distribute (env['DISTTREE'],
 
 srcdist = env.Tarball(env['TARBALL'], env['DISTTREE'])
 env.Alias ('srctar', srcdist)
+
 #
 # don't leave the distree around
 #