From 993ed5670175870c5b5930860e82db0efe158820 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 25 Feb 2014 05:37:55 +0100 Subject: [PATCH] prepare standalone VST scanner tool.. part one --- libs/ardour/vst_info_file.cc | 2 +- libs/fst/scanner.cc | 59 ++++++++++++++++++++++++++++ libs/fst/scanner.wine | 2 + libs/fst/wscript | 75 ++++++++++++++++++++++++++++++++++++ wscript | 1 + 5 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 libs/fst/scanner.cc create mode 100644 libs/fst/scanner.wine create mode 100644 libs/fst/wscript diff --git a/libs/ardour/vst_info_file.cc b/libs/ardour/vst_info_file.cc index ee103bf91e..04e18f7593 100644 --- a/libs/ardour/vst_info_file.cc +++ b/libs/ardour/vst_info_file.cc @@ -237,7 +237,7 @@ vstfx_write_info_file (FILE* fp, vector *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 index 0000000000..8225993b4e --- /dev/null +++ b/libs/fst/scanner.cc @@ -0,0 +1,59 @@ +#include +#include +#include +#include + +#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 \n", argv[0]); + return EXIT_FAILURE; + } + + char *dllpath = argv[1]; + std::vector *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 index 0000000000..1e3b5e627f --- /dev/null +++ b/libs/fst/scanner.wine @@ -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 index 0000000000..4f4de4e2ff --- /dev/null +++ b/libs/fst/wscript @@ -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 c4f7b42d28..12295f56c0 100644 --- a/wscript +++ b/wscript @@ -74,6 +74,7 @@ children = [ 'mcp', 'patchfiles', 'headless', + 'libs/fst', ] i18n_children = [