[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] | 13 | import sys |
---|
| 14 | |
---|
[000b090] | 15 | APPNAME = 'aubio' |
---|
[5820107] | 16 | |
---|
[6b14351] | 17 | # source VERSION |
---|
[5820107] | 18 | for l in open('VERSION').readlines(): exec (l.strip()) |
---|
| 19 | |
---|
[6b14351] | 20 | VERSION = '.'.join ([str(x) for x in [ |
---|
| 21 | AUBIO_MAJOR_VERSION, |
---|
| 22 | AUBIO_MINOR_VERSION, |
---|
| 23 | AUBIO_PATCH_VERSION |
---|
| 24 | ]]) + AUBIO_VERSION_STATUS |
---|
[e565c649] | 25 | |
---|
[6b14351] | 26 | LIB_VERSION = '.'.join ([str(x) for x in [ |
---|
| 27 | LIBAUBIO_LT_CUR, |
---|
| 28 | LIBAUBIO_LT_REV, |
---|
| 29 | LIBAUBIO_LT_AGE]]) |
---|
[e565c649] | 30 | |
---|
[46378b3] | 31 | top = '.' |
---|
| 32 | out = 'build' |
---|
[000b090] | 33 | |
---|
[6b14351] | 34 | def add_option_enable_disable(ctx, name, default = None, |
---|
| 35 | help_str = None, help_disable_str = None): |
---|
[a93dab3] | 36 | if help_str == None: |
---|
| 37 | help_str = 'enable ' + name + ' support' |
---|
| 38 | if help_disable_str == None: |
---|
| 39 | help_disable_str = 'do not ' + help_str |
---|
| 40 | ctx.add_option('--enable-' + name, action = 'store_true', |
---|
| 41 | default = default, |
---|
| 42 | dest = 'enable_' + name.replace('-','_'), |
---|
| 43 | help = help_str) |
---|
| 44 | ctx.add_option('--disable-' + name, action = 'store_false', |
---|
| 45 | #default = default, |
---|
| 46 | dest = 'enable_' + name.replace('-','_'), |
---|
| 47 | help = help_disable_str ) |
---|
[3819aca] | 48 | |
---|
[d41bc4d] | 49 | def options(ctx): |
---|
[a93dab3] | 50 | add_option_enable_disable(ctx, 'fftw3f', default = False, |
---|
| 51 | help_str = 'compile with fftw3f instead of ooura (recommended)', |
---|
| 52 | help_disable_str = 'do not compile with fftw3f') |
---|
| 53 | add_option_enable_disable(ctx, 'fftw3', default = False, |
---|
| 54 | help_str = 'compile with fftw3 instead of ooura', |
---|
| 55 | help_disable_str = 'do not compile with fftw3') |
---|
| 56 | add_option_enable_disable(ctx, 'complex', default = False, |
---|
| 57 | help_str ='compile with C99 complex', |
---|
| 58 | help_disable_str = 'do not use C99 complex (default)' ) |
---|
| 59 | add_option_enable_disable(ctx, 'jack', default = None, |
---|
| 60 | help_str = 'compile with jack (auto)', |
---|
| 61 | help_disable_str = 'disable jack support') |
---|
| 62 | add_option_enable_disable(ctx, 'sndfile', default = None, |
---|
| 63 | help_str = 'compile with sndfile (auto)', |
---|
| 64 | help_disable_str = 'disable sndfile') |
---|
| 65 | add_option_enable_disable(ctx, 'avcodec', default = None, |
---|
| 66 | help_str = 'compile with libavcodec (auto)', |
---|
| 67 | help_disable_str = 'disable libavcodec') |
---|
| 68 | add_option_enable_disable(ctx, 'samplerate', default = None, |
---|
| 69 | help_str = 'compile with samplerate (auto)', |
---|
| 70 | help_disable_str = 'disable samplerate') |
---|
[d9d1010] | 71 | add_option_enable_disable(ctx, 'rubberband', default = None, |
---|
| 72 | help_str = 'compile with rubberband (auto)', |
---|
| 73 | help_disable_str = 'disable rubberband') |
---|
[a93dab3] | 74 | add_option_enable_disable(ctx, 'memcpy', default = True, |
---|
| 75 | help_str = 'use memcpy hacks (default)', |
---|
| 76 | help_disable_str = 'do not use memcpy hacks') |
---|
| 77 | add_option_enable_disable(ctx, 'double', default = False, |
---|
| 78 | help_str = 'compile in double precision mode', |
---|
| 79 | help_disable_str = 'compile in single precision mode (default)') |
---|
[a3de4be] | 80 | add_option_enable_disable(ctx, 'fat', default = False, |
---|
| 81 | help_str = 'build fat binaries (darwin only)', |
---|
| 82 | help_disable_str = 'do not build fat binaries (default)') |
---|
[0309a22] | 83 | add_option_enable_disable(ctx, 'accelerate', default = None, |
---|
| 84 | help_str = 'use Accelerate framework (darwin only) (auto)', |
---|
| 85 | help_disable_str = 'do not use Accelerate framework') |
---|
[cc81763] | 86 | add_option_enable_disable(ctx, 'apple-audio', default = None, |
---|
| 87 | help_str = 'use CoreFoundation (darwin only) (auto)', |
---|
| 88 | help_disable_str = 'do not use CoreFoundation framework') |
---|
[f0ce36a1] | 89 | add_option_enable_disable(ctx, 'atlas', default = None, |
---|
| 90 | help_str = 'use Atlas library (auto)', |
---|
| 91 | help_disable_str = 'do not use Atlas library') |
---|
[923670d] | 92 | add_option_enable_disable(ctx, 'wavread', default = True, |
---|
| 93 | help_str = 'compile with source_wavread (default)', |
---|
| 94 | help_disable_str = 'do not compile source_wavread') |
---|
| 95 | add_option_enable_disable(ctx, 'wavwrite', default = True, |
---|
| 96 | help_str = 'compile with source_wavwrite (default)', |
---|
| 97 | help_disable_str = 'do not compile source_wavwrite') |
---|
[a93dab3] | 98 | |
---|
[a33d406] | 99 | add_option_enable_disable(ctx, 'docs', default = None, |
---|
| 100 | help_str = 'build documentation (auto)', |
---|
| 101 | help_disable_str = 'do not build documentation') |
---|
| 102 | |
---|
[a93dab3] | 103 | ctx.add_option('--with-target-platform', type='string', |
---|
| 104 | help='set target platform for cross-compilation', dest='target_platform') |
---|
| 105 | |
---|
| 106 | ctx.load('compiler_c') |
---|
| 107 | ctx.load('waf_unit_test') |
---|
| 108 | ctx.load('gnu_dirs') |
---|
[000b090] | 109 | |
---|
[d41bc4d] | 110 | def configure(ctx): |
---|
[a93dab3] | 111 | from waflib import Options |
---|
| 112 | ctx.load('compiler_c') |
---|
| 113 | ctx.load('waf_unit_test') |
---|
| 114 | ctx.load('gnu_dirs') |
---|
[06dba46] | 115 | |
---|
[bef979a] | 116 | # check for common headers |
---|
| 117 | ctx.check(header_name='stdlib.h') |
---|
| 118 | ctx.check(header_name='stdio.h') |
---|
| 119 | ctx.check(header_name='math.h') |
---|
| 120 | ctx.check(header_name='string.h') |
---|
| 121 | ctx.check(header_name='limits.h') |
---|
[f334300] | 122 | ctx.check(header_name='stdarg.h') |
---|
[d746ef8] | 123 | ctx.check(header_name='getopt.h', mandatory = False) |
---|
[06cf47d] | 124 | ctx.check(header_name='unistd.h', mandatory = False) |
---|
[bef979a] | 125 | |
---|
[004b431] | 126 | target_platform = sys.platform |
---|
[a93dab3] | 127 | if ctx.options.target_platform: |
---|
| 128 | target_platform = ctx.options.target_platform |
---|
| 129 | ctx.env['DEST_OS'] = target_platform |
---|
| 130 | |
---|
[ae36035] | 131 | if ctx.env.CC_NAME != 'msvc': |
---|
[a341685] | 132 | ctx.env.CFLAGS += ['-g', '-Wall', '-Wextra'] |
---|
| 133 | else: |
---|
[5bba662] | 134 | ctx.env.CFLAGS += ['/W4', '/MD'] |
---|
| 135 | ctx.env.CFLAGS += ['/D_CRT_SECURE_NO_WARNINGS'] |
---|
[a341685] | 136 | |
---|
[70a304e] | 137 | ctx.check_cc(lib='m', uselib_store='M', mandatory=False) |
---|
| 138 | |
---|
[06dba46] | 139 | if target_platform not in ['win32', 'win64']: |
---|
| 140 | ctx.env.CFLAGS += ['-fPIC'] |
---|
| 141 | else: |
---|
| 142 | ctx.define('HAVE_WIN_HACKS', 1) |
---|
| 143 | ctx.env['cshlib_PATTERN'] = 'lib%s.dll' |
---|
[a93dab3] | 144 | |
---|
[a3de4be] | 145 | if target_platform == 'darwin' and ctx.options.enable_fat: |
---|
[a93dab3] | 146 | ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] |
---|
| 147 | ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] |
---|
[da1709f] | 148 | MINSDKVER="10.4" |
---|
| 149 | ctx.env.CFLAGS += [ '-mmacosx-version-min=' + MINSDKVER ] |
---|
| 150 | ctx.env.LINKFLAGS += [ '-mmacosx-version-min=' + MINSDKVER ] |
---|
[9209c79] | 151 | |
---|
| 152 | if target_platform in [ 'darwin', 'ios', 'iosimulator']: |
---|
[cc81763] | 153 | if (ctx.options.enable_apple_audio != False): |
---|
| 154 | ctx.env.FRAMEWORK += ['CoreFoundation', 'AudioToolbox'] |
---|
| 155 | ctx.define('HAVE_SOURCE_APPLE_AUDIO', 1) |
---|
| 156 | ctx.define('HAVE_SINK_APPLE_AUDIO', 1) |
---|
[0309a22] | 157 | if (ctx.options.enable_accelerate != False): |
---|
| 158 | ctx.define('HAVE_ACCELERATE', 1) |
---|
| 159 | ctx.env.FRAMEWORK += ['Accelerate'] |
---|
[a93dab3] | 160 | |
---|
| 161 | if target_platform in [ 'ios', 'iosimulator' ]: |
---|
| 162 | MINSDKVER="6.1" |
---|
| 163 | ctx.env.CFLAGS += ['-std=c99'] |
---|
[536bf70] | 164 | if (ctx.options.enable_apple_audio != False): |
---|
[cc81763] | 165 | ctx.define('HAVE_AUDIO_UNIT', 1) |
---|
| 166 | #ctx.env.FRAMEWORK += ['CoreFoundation', 'AudioToolbox'] |
---|
[a93dab3] | 167 | if target_platform == 'ios': |
---|
| 168 | DEVROOT = "/Applications/Xcode.app/Contents" |
---|
| 169 | DEVROOT += "/Developer/Platforms/iPhoneOS.platform/Developer" |
---|
[e11ce489] | 170 | SDKROOT = "%(DEVROOT)s/SDKs/iPhoneOS.sdk" % locals() |
---|
[94b16497] | 171 | ctx.env.CFLAGS += [ '-fembed-bitcode' ] |
---|
[7aa4aaa] | 172 | ctx.env.CFLAGS += [ '-arch', 'arm64' ] |
---|
[a93dab3] | 173 | ctx.env.CFLAGS += [ '-arch', 'armv7' ] |
---|
| 174 | ctx.env.CFLAGS += [ '-arch', 'armv7s' ] |
---|
[7aa4aaa] | 175 | ctx.env.LINKFLAGS += [ '-arch', 'arm64' ] |
---|
[a93dab3] | 176 | ctx.env.LINKFLAGS += ['-arch', 'armv7'] |
---|
| 177 | ctx.env.LINKFLAGS += ['-arch', 'armv7s'] |
---|
| 178 | ctx.env.CFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ] |
---|
| 179 | ctx.env.LINKFLAGS += [ '-miphoneos-version-min=' + MINSDKVER ] |
---|
| 180 | else: |
---|
| 181 | DEVROOT = "/Applications/Xcode.app/Contents" |
---|
| 182 | DEVROOT += "/Developer/Platforms/iPhoneSimulator.platform/Developer" |
---|
[e11ce489] | 183 | SDKROOT = "%(DEVROOT)s/SDKs/iPhoneSimulator.sdk" % locals() |
---|
[a93dab3] | 184 | ctx.env.CFLAGS += [ '-arch', 'i386' ] |
---|
| 185 | ctx.env.CFLAGS += [ '-arch', 'x86_64' ] |
---|
| 186 | ctx.env.LINKFLAGS += ['-arch', 'i386'] |
---|
| 187 | ctx.env.LINKFLAGS += ['-arch', 'x86_64'] |
---|
| 188 | ctx.env.CFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ] |
---|
| 189 | ctx.env.LINKFLAGS += [ '-mios-simulator-version-min=' + MINSDKVER ] |
---|
| 190 | ctx.env.CFLAGS += [ '-isysroot' , SDKROOT] |
---|
| 191 | ctx.env.LINKFLAGS += [ '-isysroot' , SDKROOT] |
---|
| 192 | |
---|
[fb5838a] | 193 | if target_platform == 'emscripten': |
---|
| 194 | import os.path |
---|
| 195 | ctx.env.CFLAGS += [ '-I' + os.path.join(os.environ['EMSCRIPTEN'], 'system', 'include') ] |
---|
| 196 | ctx.env.CFLAGS += ['-Oz'] |
---|
| 197 | ctx.env.cprogram_PATTERN = "%s.js" |
---|
| 198 | if (ctx.options.enable_atlas != True): |
---|
| 199 | ctx.options.enable_atlas = False |
---|
| 200 | |
---|
[a93dab3] | 201 | # check support for C99 __VA_ARGS__ macros |
---|
| 202 | check_c99_varargs = ''' |
---|
[0318cc1] | 203 | #include <stdio.h> |
---|
| 204 | #define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__) |
---|
| 205 | ''' |
---|
[a93dab3] | 206 | |
---|
| 207 | if ctx.check_cc(fragment = check_c99_varargs, |
---|
| 208 | type='cstlib', |
---|
[413d4bf] | 209 | msg = 'Checking for C99 __VA_ARGS__ macro', |
---|
| 210 | mandatory = False): |
---|
[a93dab3] | 211 | ctx.define('HAVE_C99_VARARGS_MACROS', 1) |
---|
| 212 | |
---|
[06c6d7d] | 213 | # show a message about enable_double status |
---|
[a93dab3] | 214 | if (ctx.options.enable_double == True): |
---|
[06c6d7d] | 215 | ctx.msg('Checking for size of smpl_t', 'double') |
---|
| 216 | ctx.msg('Checking for size of lsmp_t', 'long double') |
---|
[a93dab3] | 217 | else: |
---|
[06c6d7d] | 218 | ctx.msg('Checking for size of smpl_t', 'float') |
---|
| 219 | ctx.msg('Checking for size of lsmp_t', 'double') |
---|
[a93dab3] | 220 | |
---|
| 221 | # optionally use complex.h |
---|
| 222 | if (ctx.options.enable_complex == True): |
---|
| 223 | ctx.check(header_name='complex.h') |
---|
[06c6d7d] | 224 | else: |
---|
| 225 | ctx.msg('Checking if complex.h is enabled', 'no') |
---|
[a93dab3] | 226 | |
---|
| 227 | # check for fftw3 |
---|
| 228 | if (ctx.options.enable_fftw3 != False or ctx.options.enable_fftw3f != False): |
---|
| 229 | # one of fftwf or fftw3f |
---|
| 230 | if (ctx.options.enable_fftw3f != False): |
---|
| 231 | ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', |
---|
[795fcd9] | 232 | args = '--cflags --libs', |
---|
| 233 | mandatory = ctx.options.enable_fftw3f) |
---|
[a93dab3] | 234 | if (ctx.options.enable_double == True): |
---|
[795fcd9] | 235 | ctx.msg('Warning', |
---|
| 236 | 'fftw3f enabled, but compiling in double precision!') |
---|
[a93dab3] | 237 | else: |
---|
[795fcd9] | 238 | # fftw3f disabled, take most sensible one according to |
---|
| 239 | # enable_double |
---|
[a93dab3] | 240 | if (ctx.options.enable_double == True): |
---|
| 241 | ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0', |
---|
[795fcd9] | 242 | args = '--cflags --libs', mandatory = |
---|
| 243 | ctx.options.enable_fftw3) |
---|
[a93dab3] | 244 | else: |
---|
| 245 | ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0', |
---|
[795fcd9] | 246 | args = '--cflags --libs', |
---|
| 247 | mandatory = ctx.options.enable_fftw3) |
---|
[a93dab3] | 248 | ctx.define('HAVE_FFTW3', 1) |
---|
| 249 | |
---|
| 250 | # fftw not enabled, use vDSP or ooura |
---|
| 251 | if 'HAVE_FFTW3F' in ctx.env.define_key: |
---|
| 252 | ctx.msg('Checking for FFT implementation', 'fftw3f') |
---|
| 253 | elif 'HAVE_FFTW3' in ctx.env.define_key: |
---|
| 254 | ctx.msg('Checking for FFT implementation', 'fftw3') |
---|
| 255 | elif 'HAVE_ACCELERATE' in ctx.env.define_key: |
---|
| 256 | ctx.msg('Checking for FFT implementation', 'vDSP') |
---|
[36f954a] | 257 | else: |
---|
[a93dab3] | 258 | ctx.msg('Checking for FFT implementation', 'ooura') |
---|
| 259 | |
---|
| 260 | # check for libsndfile |
---|
| 261 | if (ctx.options.enable_sndfile != False): |
---|
| 262 | ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4', |
---|
[795fcd9] | 263 | args = '--cflags --libs', |
---|
| 264 | mandatory = ctx.options.enable_sndfile) |
---|
[a93dab3] | 265 | |
---|
| 266 | # check for libsamplerate |
---|
| 267 | if (ctx.options.enable_samplerate != False): |
---|
| 268 | ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15', |
---|
[795fcd9] | 269 | args = '--cflags --libs', |
---|
| 270 | mandatory = ctx.options.enable_samplerate) |
---|
[a93dab3] | 271 | |
---|
[d9d1010] | 272 | # check for librubberband |
---|
| 273 | if (ctx.options.enable_rubberband != False): |
---|
[8e1328f] | 274 | ctx.check_cfg(package = 'rubberband', atleast_version = '1.3', |
---|
[d9d1010] | 275 | args = '--cflags --libs', |
---|
| 276 | mandatory = ctx.options.enable_rubberband) |
---|
| 277 | |
---|
[a93dab3] | 278 | # check for jack |
---|
| 279 | if (ctx.options.enable_jack != False): |
---|
[eb99982] | 280 | ctx.check_cfg(package = 'jack', |
---|
[795fcd9] | 281 | args = '--cflags --libs', |
---|
| 282 | mandatory = ctx.options.enable_jack) |
---|
[a93dab3] | 283 | |
---|
| 284 | # check for libav |
---|
| 285 | if (ctx.options.enable_avcodec != False): |
---|
| 286 | ctx.check_cfg(package = 'libavcodec', atleast_version = '54.35.0', |
---|
[795fcd9] | 287 | args = '--cflags --libs', uselib_store = 'AVCODEC', |
---|
| 288 | mandatory = ctx.options.enable_avcodec) |
---|
[a93dab3] | 289 | ctx.check_cfg(package = 'libavformat', atleast_version = '52.3.0', |
---|
[795fcd9] | 290 | args = '--cflags --libs', uselib_store = 'AVFORMAT', |
---|
| 291 | mandatory = ctx.options.enable_avcodec) |
---|
[a93dab3] | 292 | ctx.check_cfg(package = 'libavutil', atleast_version = '52.3.0', |
---|
[795fcd9] | 293 | args = '--cflags --libs', uselib_store = 'AVUTIL', |
---|
| 294 | mandatory = ctx.options.enable_avcodec) |
---|
[a93dab3] | 295 | ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1', |
---|
[795fcd9] | 296 | args = '--cflags --libs', uselib_store = 'AVRESAMPLE', |
---|
| 297 | mandatory = ctx.options.enable_avcodec) |
---|
[eb68991] | 298 | if all ( 'HAVE_' + i in ctx.env |
---|
[549928e] | 299 | for i in ['AVCODEC', 'AVFORMAT', 'AVUTIL', 'AVRESAMPLE'] ): |
---|
| 300 | ctx.define('HAVE_LIBAV', 1) |
---|
| 301 | ctx.msg('Checking for all libav libraries', 'yes') |
---|
| 302 | else: |
---|
| 303 | ctx.msg('Checking for all libav libraries', 'not found', color = 'YELLOW') |
---|
[a93dab3] | 304 | |
---|
[923670d] | 305 | if (ctx.options.enable_wavread != False): |
---|
| 306 | ctx.define('HAVE_WAVREAD', 1) |
---|
| 307 | ctx.msg('Checking if using source_wavread', ctx.options.enable_wavread and 'yes' or 'no') |
---|
| 308 | if (ctx.options.enable_wavwrite!= False): |
---|
| 309 | ctx.define('HAVE_WAVWRITE', 1) |
---|
| 310 | ctx.msg('Checking if using sink_wavwrite', ctx.options.enable_wavwrite and 'yes' or 'no') |
---|
[5158c22] | 311 | |
---|
[f0ce36a1] | 312 | # use ATLAS |
---|
| 313 | if (ctx.options.enable_atlas != False): |
---|
| 314 | ctx.check(header_name = 'atlas/cblas.h', mandatory = ctx.options.enable_atlas) |
---|
| 315 | #ctx.check(lib = 'lapack', uselib_store = 'LAPACK', mandatory = ctx.options.enable_atlas) |
---|
| 316 | ctx.check(lib = 'cblas', uselib_store = 'BLAS', mandatory = ctx.options.enable_atlas) |
---|
| 317 | |
---|
[a93dab3] | 318 | # use memcpy hacks |
---|
| 319 | if (ctx.options.enable_memcpy == True): |
---|
| 320 | ctx.define('HAVE_MEMCPY_HACKS', 1) |
---|
| 321 | |
---|
| 322 | # write configuration header |
---|
| 323 | ctx.write_config_header('src/config.h') |
---|
| 324 | |
---|
[06c6d7d] | 325 | # the following defines will be passed as arguments to the compiler |
---|
| 326 | # instead of being written to src/config.h |
---|
| 327 | |
---|
[a93dab3] | 328 | # add some defines used in examples |
---|
| 329 | ctx.define('AUBIO_PREFIX', ctx.env['PREFIX']) |
---|
| 330 | ctx.define('PACKAGE', APPNAME) |
---|
| 331 | |
---|
[06c6d7d] | 332 | # double precision mode |
---|
| 333 | if (ctx.options.enable_double == True): |
---|
| 334 | ctx.define('HAVE_AUBIO_DOUBLE', 1) |
---|
| 335 | |
---|
[a33d406] | 336 | if (ctx.options.enable_docs != False): |
---|
| 337 | # check if txt2man is installed, optional |
---|
| 338 | try: |
---|
| 339 | ctx.find_program('txt2man', var='TXT2MAN') |
---|
| 340 | except ctx.errors.ConfigurationError: |
---|
| 341 | ctx.to_log('txt2man was not found (ignoring)') |
---|
[000b090] | 342 | |
---|
[a33d406] | 343 | # check if doxygen is installed, optional |
---|
| 344 | try: |
---|
| 345 | ctx.find_program('doxygen', var='DOXYGEN') |
---|
| 346 | except ctx.errors.ConfigurationError: |
---|
| 347 | ctx.to_log('doxygen was not found (ignoring)') |
---|
[52a25e5] | 348 | |
---|
[7800335] | 349 | # check if sphinx-build is installed, optional |
---|
| 350 | try: |
---|
| 351 | ctx.find_program('sphinx-build', var='SPHINX') |
---|
| 352 | except ctx.errors.ConfigurationError: |
---|
| 353 | ctx.to_log('sphinx-build was not found (ignoring)') |
---|
| 354 | |
---|
[6ed0f4e] | 355 | def build(bld): |
---|
[985a5d1] | 356 | bld.env['VERSION'] = VERSION |
---|
| 357 | bld.env['LIB_VERSION'] = LIB_VERSION |
---|
| 358 | |
---|
| 359 | # add sub directories |
---|
| 360 | bld.recurse('src') |
---|
| 361 | if bld.env['DEST_OS'] not in ['ios', 'iosimulator', 'android']: |
---|
| 362 | bld.recurse('examples') |
---|
| 363 | bld.recurse('tests') |
---|
| 364 | |
---|
| 365 | bld( source = 'aubio.pc.in' ) |
---|
| 366 | |
---|
[52a25e5] | 367 | # build manpages from txt files using txt2man |
---|
[403e9dd] | 368 | if bld.env['TXT2MAN']: |
---|
[985a5d1] | 369 | from waflib import TaskGen |
---|
| 370 | if 'MANDIR' not in bld.env: |
---|
| 371 | bld.env['MANDIR'] = bld.env['PREFIX'] + '/share/man' |
---|
[403e9dd] | 372 | rule_str = '${TXT2MAN} -t `basename ${TGT} | cut -f 1 -d . | tr a-z A-Z`' |
---|
| 373 | rule_str += ' -r ${PACKAGE}\\ ${VERSION} -P ${PACKAGE}' |
---|
| 374 | rule_str += ' -v ${PACKAGE}\\ User\\\'s\\ manual' |
---|
| 375 | rule_str += ' -s 1 ${SRC} > ${TGT}' |
---|
[985a5d1] | 376 | TaskGen.declare_chain( |
---|
[403e9dd] | 377 | name = 'txt2man', |
---|
| 378 | rule = rule_str, |
---|
| 379 | ext_in = '.txt', |
---|
[985a5d1] | 380 | ext_out = '.1', |
---|
| 381 | reentrant = False, |
---|
| 382 | install_path = '${MANDIR}/man1', |
---|
| 383 | ) |
---|
[403e9dd] | 384 | bld( source = bld.path.ant_glob('doc/*.txt') ) |
---|
[985a5d1] | 385 | |
---|
[52a25e5] | 386 | # build documentation from source files using doxygen |
---|
| 387 | if bld.env['DOXYGEN']: |
---|
| 388 | bld( name = 'doxygen', rule = 'doxygen ${SRC} > /dev/null', |
---|
| 389 | source = 'doc/web.cfg', |
---|
[7f35041] | 390 | cwd = 'doc') |
---|
[52a25e5] | 391 | bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc', |
---|
| 392 | bld.path.ant_glob('doc/web/html/**'), |
---|
| 393 | cwd = bld.path.find_dir ('doc/web'), |
---|
| 394 | relative_trick = True) |
---|
[7800335] | 395 | |
---|
| 396 | # build documentation from source files using sphinx-build |
---|
| 397 | if bld.env['SPHINX']: |
---|
| 398 | bld( name = 'sphinx', rule = 'make html', |
---|
| 399 | source = ['doc/conf.py'] + bld.path.ant_glob('doc/**.rst'), |
---|
| 400 | cwd = 'doc') |
---|
| 401 | bld.install_files( '${PREFIX}' + '/share/doc/libaubio-doc/sphinx', |
---|
| 402 | bld.path.ant_glob('doc/_build/html/**'), |
---|
| 403 | cwd = bld.path.find_dir ('doc/_build/html'), |
---|
| 404 | relative_trick = True) |
---|
[50d56cc] | 405 | |
---|
[30250de] | 406 | def shutdown(bld): |
---|
[985a5d1] | 407 | from waflib import Logs |
---|
| 408 | if bld.options.target_platform in ['ios', 'iosimulator']: |
---|
| 409 | msg ='building for %s, contact the author for a commercial license' % bld.options.target_platform |
---|
| 410 | Logs.pprint('RED', msg) |
---|
| 411 | msg =' Paul Brossier <piem@aubio.org>' |
---|
| 412 | Logs.pprint('RED', msg) |
---|
[b4d1ba1] | 413 | |
---|
| 414 | def dist(ctx): |
---|
[99d8cbb] | 415 | ctx.excl = ' **/.waf-1* **/*~ **/*.pyc **/*.swp **/*.swo **/*.swn **/.lock-w* **/.git*' |
---|
[b4d1ba1] | 416 | ctx.excl += ' **/build/*' |
---|
[99d8cbb] | 417 | ctx.excl += ' doc/_build' |
---|
| 418 | ctx.excl += ' python/demos_*' |
---|
[22dd9dc] | 419 | ctx.excl += ' **/python/gen **/python/build **/python/dist' |
---|
[981e7082] | 420 | ctx.excl += ' **/python/ext/config.h' |
---|
[99d8cbb] | 421 | ctx.excl += ' **/python/lib/aubio/_aubio.so' |
---|
| 422 | ctx.excl += ' **.egg-info' |
---|
[22dd9dc] | 423 | ctx.excl += ' **/**.zip **/**.tar.bz2' |
---|
[a93dab3] | 424 | ctx.excl += ' **/doc/full/* **/doc/web/*' |
---|
[b4d1ba1] | 425 | ctx.excl += ' **/python/*.db' |
---|
| 426 | ctx.excl += ' **/python.old/*' |
---|
[981e7082] | 427 | ctx.excl += ' **/python/*/*.old' |
---|
[172b1fe] | 428 | ctx.excl += ' **/python/tests/sounds' |
---|
[7b2d740] | 429 | ctx.excl += ' **/**.asc' |
---|
[5e544f1] | 430 | ctx.excl += ' **/dist*' |
---|
[73aac2a] | 431 | ctx.excl += ' **/.DS_Store' |
---|
| 432 | ctx.excl += ' **/.travis.yml' |
---|
[5e544f1] | 433 | ctx.excl += ' **/.landscape.yml' |
---|
| 434 | ctx.excl += ' **/.appveyor.yml' |
---|