prepare standalone VST scanner tool.. part one
authorRobin Gareus <robin@gareus.org>
Tue, 25 Feb 2014 04:37:55 +0000 (05:37 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 25 Feb 2014 13:57:57 +0000 (14:57 +0100)
libs/ardour/vst_info_file.cc
libs/fst/scanner.cc [new file with mode: 0644]
libs/fst/scanner.wine [new file with mode: 0644]
libs/fst/wscript [new file with mode: 0644]
wscript

index ee103bf91eefd853722eb42f06c0113a5b35c1ed..04e18f75939438e3c74d01ef83d3d14c1be89938 100644 (file)
@@ -237,7 +237,7 @@ vstfx_write_info_file (FILE* fp, vector<VSTInfo *> *infos)
                 * plugins contained in this shell
                 */
                vstfx_write_info_block(fp, *x);
-               fprintf( fp, "%d\n", infos->size() - 1 );
+               fprintf( fp, "%d\n", (int)infos->size() - 1 );
                ++x;
                /* Now write out the info for each plugin */
                for (; x != infos->end(); ++x) {
diff --git a/libs/fst/scanner.cc b/libs/fst/scanner.cc
new file mode 100644 (file)
index 0000000..8225993
--- /dev/null
@@ -0,0 +1,59 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vector>
+
+#include "ardour/filesystem_paths.h"
+#include "ardour/linux_vst_support.h"
+#include "ardour/vst_info_file.h"
+
+/* make stupid waf happy.
+ * waf cannot build multiple variants of .o object files from the same
+ * source using different wscripts.. it mingles e.g.
+ * build/libs/ardour/vst_info_file.cc.1.o for
+ * both lib/ardour/wscript and lib/fst/wscript
+ *
+ * ...but waf does track include dependencies.
+ */
+#include "../ardour/vst_info_file.cc"
+#include "../ardour/linux_vst_support.cc"
+#include "../ardour/filesystem_paths.cc"
+#include "../ardour/directory_names.cc"
+#include "../pbd/error.cc"
+#include "../pbd/basename.cc"
+#include "../pbd/search_path.cc"
+#include "../pbd/transmitter.cc"
+#include "../pbd/whitespace.cc"
+
+#ifdef LXVST_SUPPORT
+void
+vstfx_destroy_editor (VSTState* /*vstfx*/) { }
+#endif
+
+int main (int argc, char **argv) {
+       if (argc != 2) {
+               fprintf(stderr, "usage: %s <vst>\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+
+       char *dllpath = argv[1];
+       std::vector<VSTInfo *> *infos;
+#ifdef LXVST_SUPPORT
+       if (strstr (dllpath, ".so" ) == 0) {
+               infos = vstfx_get_info_lx(dllpath);
+       }
+#endif
+
+#ifdef WINDOWS_VST_SUPPORT
+       if (strstr (dllpath, ".dll" ) == 0) {
+               infos = vstfx_get_info_fst(dllpath);
+       }
+#endif
+
+       if (infos->empty()) {
+               return EXIT_FAILURE;
+       } else {
+               return EXIT_SUCCESS;
+       }
+}
+
diff --git a/libs/fst/scanner.wine b/libs/fst/scanner.wine
new file mode 100644 (file)
index 0000000..1e3b5e6
--- /dev/null
@@ -0,0 +1,2 @@
+#/bin/sh
+exec wine "`dirname "$0"`/ardour-@VERSION@-vst-scanner.exe.so" "$@"
diff --git a/libs/fst/wscript b/libs/fst/wscript
new file mode 100644 (file)
index 0000000..4f4de4e
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+from waflib.extras import autowaf as autowaf
+from waflib import Options, TaskGen
+import waflib.Logs as Logs, waflib.Utils as Utils
+import os
+import shutil
+import sys
+import re
+import time
+from waflib.Task import Task
+
+# Mandatory variables
+top = '.'
+out = 'build'
+
+scanner_app_src = [
+    'scanner.cc',
+    ]
+
+# needed for code used from libardour
+I18N_PACKAGE = 'ardour3'
+
+def options(opt):
+    autowaf.set_options(opt)
+
+def configure(conf):
+    conf.load('misc')
+    conf.load('compiler_cxx')
+    autowaf.configure(conf)
+
+# Add a waf `feature' to allow compilation of things using winegcc
+from waflib.TaskGen import feature
+@feature("wine")
+def set_winegcc(self):
+    self.env.LINK_CXX = self.env.LINK_CC = 'wineg++'
+    self.env.CC = 'winegcc'
+
+def build(bld):
+    VERSION = "%s.%s" % (bld.env['MAJOR'], bld.env['MINOR'])
+    if not (bld.is_defined('WINDOWS_VST_SUPPORT') or bld.is_defined('LXVST_SUPPORT')):
+        return
+
+    if bld.is_defined('WINDOWS_VST_SUPPORT') and bld.env['build_target'] != 'mingw':
+        # wine exec wrapper script
+        obj = bld(features = 'subst', rule= 'chmod 0755 ${TGT}')
+        obj.source = 'scanner.wine'
+        obj.target = 'ardour-' + bld.env['VERSION'] + '-vst-scanner'
+        obj.chmod  = Utils.O755
+        obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
+        obj.dict   = {
+            'VERSION' : bld.env['VERSION'],
+                }
+
+        obj = bld (features = 'c cxx cxxprogram wine')
+        obj.source = (
+            'scanner.cc',
+            'fst.c',
+            'vstwin.c',
+            )
+        obj.target = 'ardour-' + bld.env['VERSION'] + '-vst-scanner.exe.so'
+        obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
+    else:
+        obj = bld (features = 'cxx c cxxprogram')
+        obj.source = ( 'scanner.cc' )
+        obj.target = 'ardour-' + bld.env['VERSION'] + '-vst-scanner'
+
+    obj.includes  = [ '../pbd/', '../ardour/', '.' ]
+    obj.defines = [
+        '_POSIX_SOURCE',
+        'USE_WS_PREFIX',
+        'VST_SCANNER_APP',
+        'PACKAGE="' + I18N_PACKAGE + '"',
+        ]
+    obj.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3')
+    obj.uselib       = ['GIOMM', 'DL']
diff --git a/wscript b/wscript
index c4f7b42d285f47f2f82ca91ce4d99622863c5141..12295f56c06a631cbaa690b29e02b0471809c09a 100644 (file)
--- a/wscript
+++ b/wscript
@@ -74,6 +74,7 @@ children = [
         'mcp',
         'patchfiles',
         'headless',
+        'libs/fst',
 ]
 
 i18n_children = [