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