[waf] add --nodeps option to build with no dependency
authorPaul Brossier <piem@piem.org>
Thu, 2 Jul 2020 12:49:15 +0000 (14:49 +0200)
committerPaul Brossier <piem@piem.org>
Thu, 2 Jul 2020 12:49:15 +0000 (14:49 +0200)
wscript

diff --git a/wscript b/wscript
index dc15783..b9687c1 100644 (file)
--- a/wscript
+++ b/wscript
@@ -48,6 +48,9 @@ def options(ctx):
     ctx.add_option('--debug', action = 'store_const',
             dest = 'build_type', const = 'debug',
             help = 'build in debug mode (see --build-type)')
+    ctx.add_option('--nodeps', action = 'store_const',
+            dest = 'nodeps', const = 'debug',
+            help = 'build with no external dependencies')
     add_option_enable_disable(ctx, 'fftw3f', default = False,
             help_str = 'compile with fftw3f instead of ooura (recommended)',
             help_disable_str = 'do not compile with fftw3f')
@@ -126,6 +129,27 @@ def configure(ctx):
     if ctx.options.target_platform:
         target_platform = ctx.options.target_platform
 
+    if ctx.options.nodeps:
+        external_deps = [
+                'sndfile',
+                'samplerate',
+                'jack',
+                'avcodec',
+                'blas',
+                'fftw3',
+                'fftw3f',
+        ]
+        for d in external_deps:
+            if not hasattr(ctx.options, 'enable_' + d):
+                raise ctx.errors.ConfigurationError ('--enable-%s missing from options' % d)
+            if getattr(ctx.options, 'enable_' + d) == True:
+                msg = 'Option --nodeps can not be used along with --enable-%s' % d
+                raise ctx.errors.ConfigurationError (msg)
+            elif getattr(ctx.options, 'enable_' + d) is None:
+                msg = 'Option --nodeps used but automatic detection with --enable-%s' % d
+                ctx.msg('Warning', msg)
+            setattr(ctx.options, 'enable_' + d, False)
+
     from waflib import Options
 
     if target_platform=='emscripten':