wscript: improve notes in header
[aubio.git] / wscript
diff --git a/wscript b/wscript
index 3d5aab4..83ad7b8 100644 (file)
--- a/wscript
+++ b/wscript
@@ -1,13 +1,14 @@
 #! /usr/bin/python
 #
-# waf build system, see http://code.google.com/p/waf/
-#
 # usage:
-#     $ ./waf distclean configure build
+#   $ python waf --help
+#
+# example:
+#   $ ./waf distclean configure build
 #
-# TODO
-#  - doc: add doxygen
-#  - tests: move to new unit test system
+# Note: aubio uses the waf build system, which relies on Python. Provided you
+# have Python installed, you do *not* need to install anything to build aubio.
+# For more info about waf, see http://code.google.com/p/waf/ .
 
 APPNAME = 'aubio'
 
@@ -84,15 +85,22 @@ def configure(ctx):
     ctx.load('compiler_c')
     ctx.load('waf_unit_test')
     ctx.load('gnu_dirs')
-    ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra', '-fPIC']
 
     target_platform = Options.platform
     if ctx.options.target_platform:
         target_platform = ctx.options.target_platform
     ctx.env['DEST_OS'] = target_platform
 
-    if target_platform == 'win32':
-        ctx.env['shlib_PATTERN'] = 'lib%s.dll'
+    if 'CL.exe' not in ctx.env.CC[0]:
+        ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra']
+    else:
+        ctx.env.CFLAGS += ['-Wall']
+
+    if target_platform not in ['win32', 'win64']:
+        ctx.env.CFLAGS += ['-fPIC']
+    else:
+        ctx.define('HAVE_WIN_HACKS', 1)
+        ctx.env['cshlib_PATTERN'] = 'lib%s.dll'
 
     if target_platform == 'darwin':
         ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
@@ -147,7 +155,8 @@ def configure(ctx):
 
     if ctx.check_cc(fragment = check_c99_varargs,
             type='cstlib',
-            msg = 'Checking for C99 __VA_ARGS__ macro'):
+            msg = 'Checking for C99 __VA_ARGS__ macro',
+            mandatory = False):
         ctx.define('HAVE_C99_VARARGS_MACROS', 1)
 
     # double precision mode
@@ -213,6 +222,15 @@ def configure(ctx):
                 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)
         ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
                 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)
+        if all ( 'HAVE_' + i in ctx.env.define_key
+                for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
+            ctx.define('HAVE_LIBAV', 1)
+            ctx.msg('Checking for all libav libraries', 'yes')
+        else:
+            ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW')
+
+    ctx.define('HAVE_WAVREAD', 1)
+    ctx.define('HAVE_WAVWRITE', 1)
 
     # use memcpy hacks
     if (ctx.options.enable_memcpy == True):
@@ -233,6 +251,12 @@ def configure(ctx):
     except ctx.errors.ConfigurationError:
       ctx.to_log('txt2man was not found (ignoring)')
 
+    # check if doxygen is installed, optional
+    try:
+      ctx.find_program('doxygen', var='DOXYGEN')
+    except ctx.errors.ConfigurationError:
+      ctx.to_log('doxygen was not found (ignoring)')
+
 def build(bld):
     bld.env['VERSION'] = VERSION
     bld.env['LIB_VERSION'] = LIB_VERSION
@@ -247,7 +271,7 @@ def build(bld):
 
     bld( source = 'aubio.pc.in' )
 
-    # build manpages from sgml files
+    # build manpages from txt files using txt2man
     if bld.env['TXT2MAN']:
         from waflib import TaskGen
         if 'MANDIR' not in bld.env:
@@ -266,10 +290,15 @@ def build(bld):
                 )
         bld( source = bld.path.ant_glob('doc/*.txt') )
 
-    """
-    bld(rule = 'doxygen ${SRC}', source = 'web.cfg') #, target = 'doc/web/index.html')
-    """
-
+    # build documentation from source files using doxygen
+    if bld.env['DOXYGEN']:
+        bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null',
+                source = 'doc/web.cfg',
+                cwd = 'doc')
+        bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc',
+                bld.path.ant_glob('doc/web/html/**'),
+                cwd = bld.path.find_dir ('doc/web'),
+                relative_trick = True)
 
 def shutdown(bld):
     from waflib import Logs
@@ -287,3 +316,4 @@ def dist(ctx):
     ctx.excl += ' **/doc/full/* **/doc/web/*'
     ctx.excl += ' **/python/*.db'
     ctx.excl += ' **/python.old/*'
+    ctx.excl += ' **/python/tests/sounds'