add OSC Lua bindings
[ardour.git] / gtk2_ardour / wscript
index e5e7322250c6d84cc2c707d30586360b503ea039..36223bd2cbdd0e9f0a41fc17803a178fb74da710 100644 (file)
@@ -9,6 +9,8 @@ import re
 import time
 from waflib.Task import Task
 from waflib.Tools import winres
+import subprocess
+import glob
 
 # Mandatory variables
 top = '.'
@@ -56,6 +58,7 @@ gtk2_ardour_sources = [
         'cursor_context.cc',
         'curvetest.cc',
         'debug.cc',
+        'duplicate_routes_dialog.cc',
         'edit_note_dialog.cc',
         'editing.cc',
         'editor.cc',
@@ -94,6 +97,7 @@ gtk2_ardour_sources = [
         'export_format_dialog.cc',
         'export_format_selector.cc',
         'export_preset_selector.cc',
+        'export_report.cc',
         'export_timespan_selector.cc',
         'fft.cc',
         'fft_graph.cc',
@@ -118,6 +122,9 @@ gtk2_ardour_sources = [
         'led.cc',
         'level_meter.cc',
         'location_ui.cc',
+        'lua_script_manager.cc',
+        'luainstance.cc',
+        'luawindow.cc',
         'main.cc',
         'main_clock.cc',
         'marker.cc',
@@ -203,6 +210,7 @@ gtk2_ardour_sources = [
         'ruler_dialog.cc',
         'save_as_dialog.cc',
         'search_path_option.cc',
+        'script_selector.cc',
         'selection.cc',
         'selection_memento.cc',
         'send_ui.cc',
@@ -242,7 +250,6 @@ gtk2_ardour_sources = [
         'utils.cc',
         'verbose_cursor.cc',
         'visibility_group.cc',
-        'volume_controller.cc',
         'window_manager.cc',
 # video-timeline related sources:
         'video_image_frame.cc',
@@ -260,6 +267,11 @@ gtk2_ardour_sources = [
 ]
 
 def enoify (major, minor):
+    # Code names based on
+    # https://en.wikipedia.org/wiki/Brian_Eno_discography
+    #
+    # sort Studio albums + Collaborative albums + Compilation albums by Month/Year.
+    # (no Singles, no EPs, no Video Albums, no Production)
     if major == 3:
         return "\\n\\\"E-No\\\""
     elif major == 4:
@@ -277,6 +289,10 @@ def enoify (major, minor):
             return "\\n\\\"Another Green World\\\""
         elif minor == 6:
             return "\\n\\\"Evening Star\\\""
+        elif minor == 7:
+            return "\\n\\\"Cluster and Eno\\\""
+        elif minor == 8:
+            return "\\n\\\"Before and After Science\\\""
     return "\\\"\\\""
 
 def options(opt):
@@ -337,7 +353,7 @@ def _doPyp(infileName, deps = False):
     inLines = fd.readlines()
     if fd != sys.stdin:
         fd.close()
-        
+
 
     for line in inLines:
         bits = re_spaces.split(line)
@@ -419,10 +435,12 @@ def build(bld):
 
         # now the shared library containing the GTK GUI for ardour
         obj = bld (features = 'cxx c cxxshlib')
-        obj.source    = gtk2_ardour_sources
+        # operate on copy to avoid adding sources twice
+        obj.source    = list(gtk2_ardour_sources)
         obj.includes  = [ '../libs/fst', '.' ]
         obj.name      = 'libgtk2_ardour'
         obj.target    = 'gtk2_ardour'
+        obj.cflags  = [ '-fPIC' ]
 
     else:
         # just the normal executable version of the GTK GUI
@@ -430,7 +448,8 @@ def build(bld):
             obj = bld (features = 'cxx c cxxprogram winres')
         else:
             obj = bld (features = 'cxx c cxxprogram')
-        obj.source    = gtk2_ardour_sources
+        # operate on copy to avoid adding sources twice
+        obj.source    = list(gtk2_ardour_sources)
         obj.target = 'ardour-' + str (bld.env['VERSION'])
         obj.includes = ['.']
         obj.ldflags = ['-no-undefined']
@@ -459,13 +478,11 @@ def build(bld):
         'LOCALEDIR="' + os.path.normpath(bld.env['LOCALEDIR']) + '"',
         ]
     obj.install_path = bld.env['DLLDIR']
-    obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL'
-    obj.uselib       += ' GTKMM CANVAS FFTW3F'
-    obj.uselib       += ' AUDIOUNITS OSX GTKOSX LO '
-    obj.uselib       += ' TAGLIB '
+    obj.linkflags    = ''
+    obj.uselib       = 'UUID FLAC FONTCONFIG GLIBMM GTHREAD GTK OGG CURL DL GTKMM CANVAS FFTW3F LO TAGLIB XML '
 
     if sys.platform == 'darwin':
-        obj.uselib += ' AUDIOUNITS OSX GTKOSX'
+        obj.uselib += ' AUDIOUNITS OSX '
         obj.use    += ' libappleutility'
         obj.source += [ 'cocoacarbon.mm', 'bundle_env_cocoa.cc' ]
     elif bld.env['build_target'] == 'mingw':
@@ -479,24 +496,24 @@ def build(bld):
     obj.use += 'libptformat'
 
     if bld.env['build_target'] == 'mingw':
-        obj.linkflags = ['-mwindows']
+        obj.linkflags += ' -mwindows'
 
     if bld.is_defined('HAVE_SUIL'):
         obj.source += [ 'lv2_plugin_ui.cc' ]
         obj.use += [ 'SUIL' ]
 
     if bld.is_defined('HAVE_FFTW35F') and bld.env['build_target'] != 'mingw':
-        obj.linkflags = ' -lfftw3f_threads'
+        bld.env['LIB_FFTW3F'] += ['fftw3f_threads']
 
     if bld.is_defined('NEED_INTL'):
-        obj.linkflags = ' -lintl'
+        obj.linkflags += ' -lintl'
 
     if bld.is_defined('WINDOWS_VST_SUPPORT'):
         obj.source += [ 'windows_vst_plugin_ui.cc' ]
         obj.defines += [ 'WINDOWS_VST_SUPPORT' ]
         if bld.env['build_target'] != 'mingw':
             obj.use += [ 'X11' ]
-        
+
     if bld.is_defined('LXVST_SUPPORT'):
         obj.source += [ 'linux_vst_gui_support.cc', 'lxvst_plugin_ui.cc' ]
         obj.defines += [ 'LXVST_SUPPORT' ]
@@ -504,7 +521,7 @@ def build(bld):
 
     if bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT'):
         obj.source += [ 'vst_plugin_ui.cc' ]
-        
+
     if bld.is_defined('PHONE_HOME'):
         obj.defines += [ 'PHONE_HOME' ]
 
@@ -562,7 +579,7 @@ def build(bld):
     base_font       = ""
 
     # Set up font sizes
-    if bld.is_defined('GTKOSX'): # OS X fonts
+    if sys.platform == 'darwin':
         basefont = ""
         font_sizes = {
                 'SMALLER' : '9',
@@ -575,9 +592,9 @@ def build(bld):
                 'HUGER' : '36',
                 'MASSIVE' : '60',
         }
-        
+
         # There is no acceptable monospace font available on older versions of OS X
-        # and no API on those versions to load TTF files that will work with 
+        # and no API on those versions to load TTF files that will work with
         # GTK/fontconfig/pango.
         #
         # In addition, the ArdourMono font gets clipped for some reason on OS X
@@ -617,9 +634,9 @@ def build(bld):
             else:
                 key = "_".join (['FONT',sizename])
                 fontstyle = " ".join ([basefont,points])
-                
+
             font_subst_dict[key] = fontstyle
-            
+
     # @FONT_SIZE_XXXX@
     for sizename,points in iter(font_sizes.items()):
             key = "_".join (['FONT_SIZE',sizename])
@@ -646,8 +663,8 @@ def build(bld):
 
     # Menus
     menus_argv = []
-    if bld.is_defined('GTKOSX'):
-        menus_argv = [ '-E', '-P', '-DGTKOSX' ]
+    if sys.platform == 'darwin':
+        menus_argv = [ '-E', '-P', '-D__APPLE__', '-' ]
     else:
         menus_argv = [ '-E', '-P' ]
 
@@ -667,27 +684,52 @@ def build(bld):
         obj.stdout = program + '.menus'
         bld.install_files (bld.env['CONFDIR'], program + '.menus')
 
-    # Keybindings
+    # Freedesktop
+    freedesktop_subst_dict = {
+                    'ARDOUR_EXEC' : str (bld.env['lwrcase_dirname']),
+                    'ARDOUR_ICON' : str (bld.env['lwrcase_dirname']),
+                    'VERSION': str (bld.env['VERSION']),
+    }
 
-    # 'SAE-de-keypad', 'SAE-de-nokeypad', 'SAE-us-keypad',
-    # 'SAE-us-nokeypad', 'ergonomic-us'
+    if bld.env['FREEDESKTOP']:
+        obj              = bld(features = 'subst')
+        obj.source       = 'ardour.desktop.in'
+        obj.target       = str (bld.env['lwrcase_dirname']) + '.desktop'
+        obj.chmod        = Utils.O644
+        obj.dict         = freedesktop_subst_dict
+        set_subst_dict(obj, freedesktop_subst_dict)
 
-    #
+        obj              = bld(features = 'subst')
+        obj.source       = 'ardour-mime-info.xml'
+        obj.target       = 'ardour.xml'
+        obj.chmod        = Utils.O644
+
+        # build appdata with translations
+        appdata_i18n_mo(bld)
+        appdata_i18n_xmlin(bld)
+        obj              = bld(features = 'subst')
+        obj.source       = 'ardour.appdata.xml.in'
+        obj.target       = str (bld.env['lwrcase_dirname']) + '.appdata.xml'
+        obj.chmod        = Utils.O644
+        obj.dict         = freedesktop_subst_dict
+        set_subst_dict(obj, freedesktop_subst_dict)
+
+    # Keybindings
+
+    # NATIVE ARDOUR BINDING FILES
     # explicitly state the use of perl here so that it works on windows too
     # 
-    a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap <${SRC} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
-    for b in [ 'mnemonic-us' ] :
+    a_rule = 'perl ../tools/fmt-bindings --platform="%s" --winkey="%s" --accelmap ${SRC[0].abspath()} >${TGT}' % (sys.platform, bld.env['WINDOWS_KEY'] )
+    for b in [ 'ardour' ] :
         obj = bld(
-            target = b + '.bindings',
-            source = b + '.bindings.in',
+            target = b + '.keys',
+            source = [ b + '.keys.in', 'mixer.bindings', 'processor_box.bindings', 'step_editing.bindings', 'monitor.bindings' ],
             rule = a_rule
             )
         obj.install_path = bld.env['CONFDIR']
-
+        
     # not modified at present
     bld.install_files(bld.env['CONFDIR'], 'dark.colors')
-    bld.install_files(bld.env['CONFDIR'], 'step_editing.bindings')
-    bld.install_files(bld.env['CONFDIR'], 'mixer.bindings')
 
     # Icons/Images
     bld.install_files(os.path.join (bld.env['DATADIR'], 'icons'), bld.path.ant_glob('icons/*.png'))
@@ -722,18 +764,60 @@ def i18n(bld):
         I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
         autowaf.build_i18n(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
                            'Paul Davis')
-        
+        appdata_i18n_pot(bld)
+        appdata_i18n_po(bld)
+
 def i18n_pot(bld):
         I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
         autowaf.build_i18n_pot(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
                                'Paul Davis')
+        appdata_i18n_pot(bld)
 
 def i18n_po(bld):
         I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
         autowaf.build_i18n_po(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
                               'Paul Davis')
-        
+        appdata_i18n_po(bld)
+
 def i18n_mo(bld):
         I18N_PACKAGE = 'gtk2_ardour' + bld.env['MAJOR']
         autowaf.build_i18n_mo(bld, top, 'gtk2_ardour', I18N_PACKAGE, gtk2_ardour_sources,
                               'Paul Davis')
+
+def appdata_i18n_pot(bld):
+    potfile = os.path.join(bld.top_dir, 'gtk2_ardour', 'appdata',
+            'ardour.appdata.pot')
+    if bld.cmd == 'build':
+        Logs.info('Generating pot file from Ardour appdata')
+        itsfile = os.path.join(bld.top_dir, 'tools', 'as-metainfo.its')
+        adsource = os.path.join(bld.top_dir, 'gtk2_ardour',
+                'ardour.appdata.xml.in.in')
+        Logs.info('Updating ' + potfile)
+        subprocess.call(('itstool', '-i', itsfile, '-o', potfile, adsource))
+    elif bld.cmd == 'clean' and os.path.exists(potfile):
+        Logs.info('Removing Ardour appdata pot file')
+        os.remove(potfile)
+
+def appdata_i18n_po(bld):
+    autowaf.build_i18n_po(bld, bld.top_dir, os.path.join(
+        'gtk2_ardour', 'appdata'), 'ardour.appdata', 'dummy', 'dummy')
+
+def appdata_i18n_mo(bld):
+    autowaf.build_i18n_mo(bld, bld.top_dir, os.path.join(
+        'gtk2_ardour', 'appdata'), 'ardour.appdata', 'dummy', 'dummy')
+
+def appdata_i18n_xmlin(bld):
+    adxmlinfile = os.path.join(bld.top_dir, 'gtk2_ardour',
+            'ardour.appdata.xml.in')
+    if bld.cmd == 'build':
+        itsfile = os.path.join(bld.top_dir, 'tools', 'as-metainfo.its')
+        adxmlininfile = os.path.join(bld.top_dir, 'gtk2_ardour',
+                'ardour.appdata.xml.in.in')
+        mo_glob = os.path.join(bld.top_dir, 'gtk2_ardour', 'appdata', 'po', '*.mo')
+        mo_files = glob.glob(mo_glob)
+        Logs.info('Generating ' + adxmlinfile)
+        subprocess.call(['itstool', '-i', itsfile, '-o', adxmlinfile,
+            '-j', adxmlininfile] + mo_files)
+    elif bld.cmd == 'clean' and os.path.exists(adxmlinfile):
+        Logs.info('Removing ' + adxmlinfile)
+        os.remove(adxmlinfile)