source: wscript @ dd3b1d5

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampler
Last change on this file since dd3b1d5 was dd3b1d5, checked in by Martin Hermant <martin.hermant@gmail.com>, 7 years ago

wscript : fix print with old py2 syntax

  • Property mode set to 100644
File size: 21.8 KB
RevLine 
[5c411dc]1#! /usr/bin/python
[110ac90]2#
[21ee709]3# usage:
[46b00690]4#   $ python waf --help
5#
6# example:
7#   $ ./waf distclean configure build
[21ee709]8#
[46b00690]9# Note: aubio uses the waf build system, which relies on Python. Provided you
10# have Python installed, you do *not* need to install anything to build aubio.
11# For more info about waf, see http://code.google.com/p/waf/ .
[000b090]12
[004b431]13import sys
14
[000b090]15APPNAME = 'aubio'
[5820107]16
[6b14351]17# source VERSION
[5820107]18for l in open('VERSION').readlines(): exec (l.strip())
19
[1eb8c0e]20def get_git_revision_hash( short=True):
21    import os
22    def which(program):
23        def is_exe(fpath):
24            return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
25
26        fpath, fname = os.path.split(program)
27        if fpath:
28            if is_exe(program):
29                return program
30        else:
31            for path in os.environ["PATH"].split(os.pathsep):
32                path = path.strip('"')
33                exe_file = os.path.join(path, program)
34                if is_exe(exe_file):
35                    return exe_file
36
37        return None
38       
39    if not which('git'):
[dd3b1d5]40        print('no git found on this system : can\'t get sha')
[1eb8c0e]41        return ""
42
43    import subprocess
44    aubio_dir = os.path.abspath(os.curdir)
45    if not os.path.exists(aubio_dir):
46        raise SystemError("git / root folder not found")
47    gitcmd = ['git','-C',aubio_dir ,'rev-parse']
48    if short:
49      gitcmd.append('--short')
50    gitcmd.append('HEAD')
51    return subprocess.check_output(gitcmd).strip()
52
53AUBIO_GIT_SHA = get_git_revision_hash()
54""" append sha to version in alpha release
55"""
56if '~alpha' in AUBIO_VERSION_STATUS :
57    if AUBIO_GIT_SHA:
58        AUBIO_VERSION_STATUS = '~git'+AUBIO_GIT_SHA
59
60
61
62
[6b14351]63VERSION = '.'.join ([str(x) for x in [
64    AUBIO_MAJOR_VERSION,
65    AUBIO_MINOR_VERSION,
66    AUBIO_PATCH_VERSION
67    ]]) + AUBIO_VERSION_STATUS
[e565c649]68
[6b14351]69LIB_VERSION = '.'.join ([str(x) for x in [
70    LIBAUBIO_LT_CUR,
71    LIBAUBIO_LT_REV,
72    LIBAUBIO_LT_AGE]])
[e565c649]73
[46378b3]74top = '.'
75out = 'build'
[000b090]76
[6b14351]77def add_option_enable_disable(ctx, name, default = None,
78        help_str = None, help_disable_str = None):
[a93dab3]79    if help_str == None:
80        help_str = 'enable ' + name + ' support'
81    if help_disable_str == None:
82        help_disable_str = 'do not ' + help_str
83    ctx.add_option('--enable-' + name, action = 'store_true',
84            default = default,
85            dest = 'enable_' + name.replace('-','_'),
86            help = help_str)
87    ctx.add_option('--disable-' + name, action = 'store_false',
88            #default = default,
89            dest = 'enable_' + name.replace('-','_'),
90            help = help_disable_str )
[3819aca]91
[d41bc4d]92def options(ctx):
[b4ce693]93    ctx.add_option('--build-type', action = 'store',
94            default = "release",
95            choices = ('debug', 'release'),
96            dest = 'build_type',
[fb6a0ff]97            help = 'whether to compile with (--build-type=release) or without (--build-type=debug) '\
[b4ce693]98              ' compiler opimizations [default: release]')
[a93dab3]99    add_option_enable_disable(ctx, 'fftw3f', default = False,
100            help_str = 'compile with fftw3f instead of ooura (recommended)',
101            help_disable_str = 'do not compile with fftw3f')
102    add_option_enable_disable(ctx, 'fftw3', default = False,
103            help_str = 'compile with fftw3 instead of ooura',
104            help_disable_str = 'do not compile with fftw3')
105    add_option_enable_disable(ctx, 'complex', default = False,
106            help_str ='compile with C99 complex',
107            help_disable_str = 'do not use C99 complex (default)' )
108    add_option_enable_disable(ctx, 'jack', default = None,
109            help_str = 'compile with jack (auto)',
110            help_disable_str = 'disable jack support')
111    add_option_enable_disable(ctx, 'sndfile', default = None,
112            help_str = 'compile with sndfile (auto)',
113            help_disable_str = 'disable sndfile')
114    add_option_enable_disable(ctx, 'avcodec', default = None,
115            help_str = 'compile with libavcodec (auto)',
116            help_disable_str = 'disable libavcodec')
117    add_option_enable_disable(ctx, 'samplerate', default = None,
118            help_str = 'compile with samplerate (auto)',
119            help_disable_str = 'disable samplerate')
120    add_option_enable_disable(ctx, 'memcpy', default = True,
121            help_str = 'use memcpy hacks (default)',
122            help_disable_str = 'do not use memcpy hacks')
123    add_option_enable_disable(ctx, 'double', default = False,
124            help_str = 'compile in double precision mode',
125            help_disable_str = 'compile in single precision mode (default)')
[a3de4be]126    add_option_enable_disable(ctx, 'fat', default = False,
127            help_str = 'build fat binaries (darwin only)',
128            help_disable_str = 'do not build fat binaries (default)')
[0309a22]129    add_option_enable_disable(ctx, 'accelerate', default = None,
130            help_str = 'use Accelerate framework (darwin only) (auto)',
131            help_disable_str = 'do not use Accelerate framework')
[cc81763]132    add_option_enable_disable(ctx, 'apple-audio', default = None,
133            help_str = 'use CoreFoundation (darwin only) (auto)',
134            help_disable_str = 'do not use CoreFoundation framework')
[f61ffb9]135    add_option_enable_disable(ctx, 'atlas', default = False,
136            help_str = 'use Atlas library (no)',
[f0ce36a1]137            help_disable_str = 'do not use Atlas library')
[f9a543e]138    add_option_enable_disable(ctx, 'wavread', default = True,
139            help_str = 'compile with source_wavread (default)',
140            help_disable_str = 'do not compile source_wavread')
141    add_option_enable_disable(ctx, 'wavwrite', default = True,
142            help_str = 'compile with source_wavwrite (default)',
143            help_disable_str = 'do not compile source_wavwrite')
[a93dab3]144
[a33d406]145    add_option_enable_disable(ctx, 'docs', default = None,
146            help_str = 'build documentation (auto)',
147            help_disable_str = 'do not build documentation')
148
[a93dab3]149    ctx.add_option('--with-target-platform', type='string',
150            help='set target platform for cross-compilation', dest='target_platform')
151
152    ctx.load('compiler_c')
153    ctx.load('waf_unit_test')
154    ctx.load('gnu_dirs')
[000b090]155
[d41bc4d]156def configure(ctx):
[a93dab3]157    from waflib import Options
158    ctx.load('compiler_c')
159    ctx.load('waf_unit_test')
160    ctx.load('gnu_dirs')
[06dba46]161
[bef979a]162    # check for common headers
163    ctx.check(header_name='stdlib.h')
164    ctx.check(header_name='stdio.h')
165    ctx.check(header_name='math.h')
166    ctx.check(header_name='string.h')
167    ctx.check(header_name='limits.h')
[f334300]168    ctx.check(header_name='stdarg.h')
[d746ef8]169    ctx.check(header_name='getopt.h', mandatory = False)
[06cf47d]170    ctx.check(header_name='unistd.h', mandatory = False)
[bef979a]171
[004b431]172    target_platform = sys.platform
[a93dab3]173    if ctx.options.target_platform:
174        target_platform = ctx.options.target_platform
175    ctx.env['DEST_OS'] = target_platform
176
[1eb8c0e]177    ctx.define('AUBIO_VERSION',VERSION)
178    ctx.define('AUBIO_MAJOR_VERSION',AUBIO_MAJOR_VERSION)
179    ctx.define('AUBIO_MINOR_VERSION',AUBIO_MINOR_VERSION)
180    ctx.define('AUBIO_PATCH_VERSION',AUBIO_PATCH_VERSION)
181    ctx.define('AUBIO_VERSION_STATUS',AUBIO_VERSION_STATUS)
182    ctx.define('AUBIO_GIT_SHA',AUBIO_GIT_SHA)
[b4ce693]183    if ctx.options.build_type == "debug":
184        ctx.define('DEBUG', 1)
185    else:
186        ctx.define('NDEBUG', 1)
[578d3a2]187
[ae36035]188    if ctx.env.CC_NAME != 'msvc':
[c04346d]189        if ctx.options.build_type == "debug":
190            # no optimization in debug mode
[a6ba5d9f]191            ctx.env.prepend_value('CFLAGS', ['-O0'])
192        else:
193            # default to -O2 in release mode
194            ctx.env.prepend_value('CFLAGS', ['-O2'])
195        # enable debug symbols and configure warnings
196        ctx.env.prepend_value('CFLAGS', ['-g', '-Wall', '-Wextra'])
[a341685]197    else:
[b4ce693]198        # enable debug symbols
199        ctx.env.CFLAGS += ['/Z7', '/FS']
200        ctx.env.LINKFLAGS += ['/DEBUG', '/INCREMENTAL:NO']
201        # configure warnings
202        ctx.env.CFLAGS += ['/W4', '/D_CRT_SECURE_NO_WARNINGS']
[578d3a2]203        # set optimization level and runtime libs
[b4ce693]204        if (ctx.options.build_type == "release"):
205            ctx.env.CFLAGS += ['/Ox']
206            ctx.env.CFLAGS += ['/MD']
207        else:
208            assert(ctx.options.build_type == "debug")
209            ctx.env.CFLAGS += ['/MDd']
[578d3a2]210
[70a304e]211    ctx.check_cc(lib='m', uselib_store='M', mandatory=False)
212
[06dba46]213    if target_platform not in ['win32', 'win64']:
214        ctx.env.CFLAGS += ['-fPIC']
215    else:
216        ctx.define('HAVE_WIN_HACKS', 1)
217        ctx.env['cshlib_PATTERN'] = 'lib%s.dll'
[a93dab3]218
[a3de4be]219    if target_platform == 'darwin' and ctx.options.enable_fat:
[a93dab3]220        ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
221        ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
[da1709f]222        MINSDKVER="10.4"
223        ctx.env.CFLAGS += [ '-mmacosx-version-min=' + MINSDKVER ]
224        ctx.env.LINKFLAGS += [ '-mmacosx-version-min=' + MINSDKVER ]
[9209c79]225
226    if target_platform in [ 'darwin', 'ios', 'iosimulator']:
[cc81763]227        if (ctx.options.enable_apple_audio != False):
228            ctx.env.FRAMEWORK += ['CoreFoundation', 'AudioToolbox']
229            ctx.define('HAVE_SOURCE_APPLE_AUDIO', 1)
230            ctx.define('HAVE_SINK_APPLE_AUDIO', 1)
[f61ffb9]231            ctx.msg('Checking for AudioToolbox.framework', 'yes')
232        else:
233            ctx.msg('Checking for AudioToolbox.framework', 'no (disabled)', color = 'YELLOW')
[0309a22]234        if (ctx.options.enable_accelerate != False):
235            ctx.define('HAVE_ACCELERATE', 1)
236            ctx.env.FRAMEWORK += ['Accelerate']
[f61ffb9]237            ctx.msg('Checking for Accelerate framework', 'yes')
238        else:
[488381e]239            ctx.msg('Checking for Accelerate framework', 'no (disabled)', color = 'YELLOW')
[a93dab3]240
241    if target_platform in [ 'ios', 'iosimulator' ]:
242        MINSDKVER="6.1"
243        ctx.env.CFLAGS += ['-std=c99']
[536bf70]244        if (ctx.options.enable_apple_audio != False):
[cc81763]245            ctx.define('HAVE_AUDIO_UNIT', 1)
246            #ctx.env.FRAMEWORK += ['CoreFoundation', 'AudioToolbox']
[a93dab3]247        if target_platform == 'ios':
248            DEVROOT = "/Applications/Xcode.app/Contents"
249            DEVROOT += "/Developer/Platforms/iPhoneOS.platform/Developer"
[e11ce489]250            SDKROOT = "%(DEVROOT)s/SDKs/iPhoneOS.sdk" % locals()
[94b16497]251            ctx.env.CFLAGS += [ '-fembed-bitcode' ]
[7aa4aaa]252            ctx.env.CFLAGS += [ '-arch', 'arm64' ]
[a93dab3]253            ctx.env.CFLAGS += [ '-arch', 'armv7' ]
254            ctx.env.CFLAGS += [ '-arch', 'armv7s' ]
[7aa4aaa]255            ctx.env.LINKFLAGS += [ '-arch', 'arm64' ]
[a93dab3]256            ctx.env.LINKFLAGS += ['-arch', 'armv7']
257            ctx.env.LINKFLAGS += ['-arch', 'armv7s']
258            ctx.env.CFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ]
259            ctx.env.LINKFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ]
260        else:
261            DEVROOT = "/Applications/Xcode.app/Contents"
262            DEVROOT += "/Developer/Platforms/iPhoneSimulator.platform/Developer"
[e11ce489]263            SDKROOT = "%(DEVROOT)s/SDKs/iPhoneSimulator.sdk" % locals()
[a93dab3]264            ctx.env.CFLAGS += [ '-arch', 'i386' ]
265            ctx.env.CFLAGS += [ '-arch', 'x86_64' ]
266            ctx.env.LINKFLAGS += ['-arch', 'i386']
267            ctx.env.LINKFLAGS += ['-arch', 'x86_64']
268            ctx.env.CFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ]
269            ctx.env.LINKFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ]
270        ctx.env.CFLAGS += [ '-isysroot' , SDKROOT]
271        ctx.env.LINKFLAGS += [ '-isysroot' , SDKROOT]
272
[fb5838a]273    if target_platform == 'emscripten':
274        import os.path
275        ctx.env.CFLAGS += [ '-I' + os.path.join(os.environ['EMSCRIPTEN'], 'system', 'include') ]
276        ctx.env.CFLAGS += ['-Oz']
277        ctx.env.cprogram_PATTERN = "%s.js"
278        if (ctx.options.enable_atlas != True):
279            ctx.options.enable_atlas = False
280
[a93dab3]281    # check support for C99 __VA_ARGS__ macros
282    check_c99_varargs = '''
[0318cc1]283#include <stdio.h>
284#define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
285'''
[a93dab3]286
287    if ctx.check_cc(fragment = check_c99_varargs,
288            type='cstlib',
[413d4bf]289            msg = 'Checking for C99 __VA_ARGS__ macro',
290            mandatory = False):
[a93dab3]291        ctx.define('HAVE_C99_VARARGS_MACROS', 1)
292
[06c6d7d]293    # show a message about enable_double status
[a93dab3]294    if (ctx.options.enable_double == True):
[06c6d7d]295        ctx.msg('Checking for size of smpl_t', 'double')
296        ctx.msg('Checking for size of lsmp_t', 'long double')
[a93dab3]297    else:
[06c6d7d]298        ctx.msg('Checking for size of smpl_t', 'float')
299        ctx.msg('Checking for size of lsmp_t', 'double')
[a93dab3]300
301    # optionally use complex.h
302    if (ctx.options.enable_complex == True):
303        ctx.check(header_name='complex.h')
[06c6d7d]304    else:
305        ctx.msg('Checking if complex.h is enabled', 'no')
[a93dab3]306
307    # check for fftw3
308    if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False):
309        # one of fftwf or fftw3f
310        if (ctx.options.enable_fftw3f != False):
311            ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
[795fcd9]312                    args = '--cflags --libs',
313                    mandatory = ctx.options.enable_fftw3f)
[a93dab3]314            if (ctx.options.enable_double == True):
[795fcd9]315                ctx.msg('Warning',
316                        'fftw3f enabled, but compiling in double precision!')
[a93dab3]317        else:
[795fcd9]318            # fftw3f disabled, take most sensible one according to
319            # enable_double
[a93dab3]320            if (ctx.options.enable_double == True):
321                ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
[795fcd9]322                        args = '--cflags --libs', mandatory =
323                        ctx.options.enable_fftw3)
[a93dab3]324            else:
325                ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
[795fcd9]326                        args = '--cflags --libs',
327                        mandatory = ctx.options.enable_fftw3)
[a93dab3]328        ctx.define('HAVE_FFTW3', 1)
329
330    # fftw not enabled, use vDSP or ooura
331    if 'HAVE_FFTW3F' in ctx.env.define_key:
332        ctx.msg('Checking for FFT implementation', 'fftw3f')
333    elif 'HAVE_FFTW3' in ctx.env.define_key:
334        ctx.msg('Checking for FFT implementation', 'fftw3')
335    elif 'HAVE_ACCELERATE' in ctx.env.define_key:
336        ctx.msg('Checking for FFT implementation', 'vDSP')
[36f954a]337    else:
[a93dab3]338        ctx.msg('Checking for FFT implementation', 'ooura')
339
340    # check for libsndfile
341    if (ctx.options.enable_sndfile != False):
342        ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
[795fcd9]343                args = '--cflags --libs',
344                mandatory = ctx.options.enable_sndfile)
[a93dab3]345
346    # check for libsamplerate
[8be88e7]347    if (ctx.options.enable_double):
348        if (ctx.options.enable_samplerate):
349            ctx.fatal("Could not compile aubio in double precision mode with libsamplerate")
350        else:
351            ctx.options.enable_samplerate = False
352            ctx.msg('Checking if using samplerate', 'no (disabled in double precision mode)',
353                    color = 'YELLOW')
[a93dab3]354    if (ctx.options.enable_samplerate != False):
355        ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
[795fcd9]356                args = '--cflags --libs',
357                mandatory = ctx.options.enable_samplerate)
[a93dab3]358
359    # check for jack
360    if (ctx.options.enable_jack != False):
[eb99982]361        ctx.check_cfg(package = 'jack',
[795fcd9]362                args = '--cflags --libs',
363                mandatory = ctx.options.enable_jack)
[a93dab3]364
365    # check for libav
366    if (ctx.options.enable_avcodec != False):
367        ctx.check_cfg(package = 'libavcodec', atleast_version = '54.35.0',
[795fcd9]368                args = '--cflags --libs', uselib_store = 'AVCODEC',
369                mandatory = ctx.options.enable_avcodec)
[a93dab3]370        ctx.check_cfg(package = 'libavformat', atleast_version = '52.3.0',
[795fcd9]371                args = '--cflags --libs', uselib_store = 'AVFORMAT',
372                mandatory = ctx.options.enable_avcodec)
[a93dab3]373        ctx.check_cfg(package = 'libavutil', atleast_version = '52.3.0',
[795fcd9]374                args = '--cflags --libs', uselib_store = 'AVUTIL',
375                mandatory = ctx.options.enable_avcodec)
[a93dab3]376        ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',
[795fcd9]377                args = '--cflags --libs', uselib_store = 'AVRESAMPLE',
378                mandatory = ctx.options.enable_avcodec)
[eb68991]379        if all ( 'HAVE_' + i in ctx.env
[549928e]380                for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ):
381            ctx.define('HAVE_LIBAV', 1)
382            ctx.msg('Checking for all libav libraries', 'yes')
383        else:
384            ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW')
[a93dab3]385
[f9a543e]386    if (ctx.options.enable_wavread != False):
387        ctx.define('HAVE_WAVREAD', 1)
388    ctx.msg('Checking if using source_wavread', ctx.options.enable_wavread and 'yes' or 'no')
389    if (ctx.options.enable_wavwrite!= False):
390        ctx.define('HAVE_WAVWRITE', 1)
391    ctx.msg('Checking if using sink_wavwrite', ctx.options.enable_wavwrite and 'yes' or 'no')
[5158c22]392
[f0ce36a1]393    # use ATLAS
394    if (ctx.options.enable_atlas != False):
395        ctx.check(header_name = 'atlas/cblas.h', mandatory = ctx.options.enable_atlas)
396        #ctx.check(lib = 'lapack', uselib_store = 'LAPACK', mandatory = ctx.options.enable_atlas)
397        ctx.check(lib = 'cblas', uselib_store = 'BLAS', mandatory = ctx.options.enable_atlas)
398
[a93dab3]399    # use memcpy hacks
400    if (ctx.options.enable_memcpy == True):
401        ctx.define('HAVE_MEMCPY_HACKS', 1)
402
403    # write configuration header
404    ctx.write_config_header('src/config.h')
405
[06c6d7d]406    # the following defines will be passed as arguments to the compiler
407    # instead of being written to src/config.h
[1910fed]408    ctx.define('HAVE_CONFIG_H', 1)
[06c6d7d]409
[a93dab3]410    # add some defines used in examples
411    ctx.define('AUBIO_PREFIX', ctx.env['PREFIX'])
412    ctx.define('PACKAGE', APPNAME)
413
[06c6d7d]414    # double precision mode
415    if (ctx.options.enable_double == True):
416        ctx.define('HAVE_AUBIO_DOUBLE', 1)
417
[a33d406]418    if (ctx.options.enable_docs != False):
419        # check if txt2man is installed, optional
420        try:
421          ctx.find_program('txt2man', var='TXT2MAN')
422        except ctx.errors.ConfigurationError:
423          ctx.to_log('txt2man was not found (ignoring)')
[000b090]424
[a33d406]425        # check if doxygen is installed, optional
426        try:
427          ctx.find_program('doxygen', var='DOXYGEN')
428        except ctx.errors.ConfigurationError:
429          ctx.to_log('doxygen was not found (ignoring)')
[52a25e5]430
[7800335]431        # check if sphinx-build is installed, optional
432        try:
433          ctx.find_program('sphinx-build', var='SPHINX')
434        except ctx.errors.ConfigurationError:
435          ctx.to_log('sphinx-build was not found (ignoring)')
436
[6ed0f4e]437def build(bld):
[985a5d1]438    bld.env['VERSION'] = VERSION
439    bld.env['LIB_VERSION'] = LIB_VERSION
440
[7b38f3f]441    # main source
[985a5d1]442    bld.recurse('src')
[7b38f3f]443
444    # add sub directories
[985a5d1]445    if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']:
446        bld.recurse('examples')
447        bld.recurse('tests')
448
[7b38f3f]449    # pkg-config template
[985a5d1]450    bld( source = 'aubio.pc.in' )
451
[7b38f3f]452    # documentation
453    txt2man(bld)
454    doxygen(bld)
455    sphinx(bld)
456
457def txt2man(bld):
[52a25e5]458    # build manpages from txt files using txt2man
[403e9dd]459    if bld.env['TXT2MAN']:
[985a5d1]460        from waflib import TaskGen
461        if 'MANDIR' not in bld.env:
[641e533]462            bld.env['MANDIR'] = bld.env['DATAROOTDIR'] + '/man'
[e3b77e8]463        bld.env.VERSION = VERSION
[403e9dd]464        rule_str = '${TXT2MAN} -t `basename ${TGT} | cut -f 1 -d . | tr a-z A-Z`'
465        rule_str += ' -r ${PACKAGE}\\ ${VERSION} -P ${PACKAGE}'
466        rule_str += ' -v ${PACKAGE}\\ User\\\'s\\ manual'
467        rule_str += ' -s 1 ${SRC} > ${TGT}'
[985a5d1]468        TaskGen.declare_chain(
[403e9dd]469                name      = 'txt2man',
470                rule      = rule_str,
471                ext_in    = '.txt',
[985a5d1]472                ext_out   = '.1',
473                reentrant = False,
474                install_path =  '${MANDIR}/man1',
475                )
[403e9dd]476        bld( source = bld.path.ant_glob('doc/*.txt') )
[985a5d1]477
[7b38f3f]478def doxygen(bld):
[52a25e5]479    # build documentation from source files using doxygen
480    if bld.env['DOXYGEN']:
481        bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null',
482                source = 'doc/web.cfg',
[41dd34e]483                target = '../doc/web/html/index.html',
[7f35041]484                cwd = 'doc')
[641e533]485        bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc',
[52a25e5]486                bld.path.ant_glob('doc/web/html/**'),
487                cwd = bld.path.find_dir ('doc/web'),
488                relative_trick = True)
[7800335]489
[7b38f3f]490def sphinx(bld):
[7800335]491    # build documentation from source files using sphinx-build
[5a19f33]492    # note: build in ../doc/_build/html, otherwise waf wont install unsigned files
[7800335]493    if bld.env['SPHINX']:
[e3b77e8]494        bld.env.VERSION = VERSION
[5a19f33]495        bld( name = 'sphinx',
[e3b77e8]496                rule = '${SPHINX} -b html -D release=${VERSION} -D version=${VERSION} -a -q `dirname ${SRC}` `dirname ${TGT}`',
[7b38f3f]497                source = 'doc/conf.py',
[5a19f33]498                target = '../doc/_build/html/index.html')
[641e533]499        bld.install_files( '${DATAROOTDIR}' + '/doc/libaubio-doc/sphinx',
[7800335]500                bld.path.ant_glob('doc/_build/html/**'),
[5a19f33]501                cwd = bld.path.find_dir('doc/_build/html'),
[7800335]502                relative_trick = True)
[50d56cc]503
[7b38f3f]504# register the previous rules as build rules
505from waflib.Build import BuildContext
506
507class build_txt2man(BuildContext):
508    cmd = 'txt2man'
509    fun = 'txt2man'
510
511class build_manpages(BuildContext):
512    cmd = 'manpages'
513    fun = 'txt2man'
514
515class build_sphinx(BuildContext):
516    cmd = 'sphinx'
517    fun = 'sphinx'
518
519class build_doxygen(BuildContext):
520    cmd = 'doxygen'
521    fun = 'doxygen'
522
[30250de]523def shutdown(bld):
[985a5d1]524    from waflib import Logs
525    if bld.options.target_platform in ['ios', 'iosimulator']:
526        msg ='building for %s, contact the author for a commercial license' % bld.options.target_platform
527        Logs.pprint('RED', msg)
528        msg ='   Paul Brossier <piem@aubio.org>'
529        Logs.pprint('RED', msg)
[b4d1ba1]530
531def dist(ctx):
[3388e1a]532    ctx.excl  = ' **/.waf* **/*~ **/*.pyc **/*.swp **/*.swo **/*.swn **/.lock-w* **/.git*'
[b4d1ba1]533    ctx.excl += ' **/build/*'
[99d8cbb]534    ctx.excl += ' doc/_build'
535    ctx.excl += ' python/demos_*'
[22dd9dc]536    ctx.excl += ' **/python/gen **/python/build **/python/dist'
[981e7082]537    ctx.excl += ' **/python/ext/config.h'
[99d8cbb]538    ctx.excl += ' **/python/lib/aubio/_aubio.so'
539    ctx.excl += ' **.egg-info'
[22dd9dc]540    ctx.excl += ' **/**.zip **/**.tar.bz2'
[7b38f3f]541    ctx.excl += ' **.tar.bz2'
[a93dab3]542    ctx.excl += ' **/doc/full/* **/doc/web/*'
[e57a7d4]543    ctx.excl += ' **/doc/full.cfg'
[b4d1ba1]544    ctx.excl += ' **/python/*.db'
545    ctx.excl += ' **/python.old/*'
[981e7082]546    ctx.excl += ' **/python/*/*.old'
[172b1fe]547    ctx.excl += ' **/python/tests/sounds'
[7b2d740]548    ctx.excl += ' **/**.asc'
[5e544f1]549    ctx.excl += ' **/dist*'
[73aac2a]550    ctx.excl += ' **/.DS_Store'
551    ctx.excl += ' **/.travis.yml'
[5e544f1]552    ctx.excl += ' **/.landscape.yml'
553    ctx.excl += ' **/.appveyor.yml'
Note: See TracBrowser for help on using the repository browser.