Changeset d41bc4d


Ignore:
Timestamp:
Jul 10, 2012, 1:06:11 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
dbf47c6
Parents:
f4493f4
Message:

wscript, /wscript_build: use ctx to match latest waf docs

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • examples/wscript_build

    rf4493f4 rd41bc4d  
    22
    33# build examples
    4 sndfileio = bld.new_task_gen(features = 'c',
     4sndfileio = ctx.new_task_gen(features = 'c',
    55    includes = '../src',
    66    source = ['sndfileio.c'],
    77    target = 'sndfileio')
    88
    9 utilsio = bld.new_task_gen(name = 'utilsio', features = 'c',
     9utilsio = ctx.new_task_gen(name = 'utilsio', features = 'c',
    1010      includes = '../src',
    1111      add_objects = 'sndfileio',
     
    1515
    1616# loop over all *.c filenames in examples to build them all
    17 for target_name in bld.path.ant_glob('*.c', excl = ['utils.c', 'jackio.c', 'sndfileio.c']):
    18   bld.new_task_gen(features = 'c cprogram',
     17for target_name in ctx.path.ant_glob('*.c', excl = ['utils.c', 'jackio.c', 'sndfileio.c']):
     18  ctx.new_task_gen(features = 'c cprogram',
    1919      add_objects = 'utilsio',
    2020      includes = '../src',
  • python/aubio/wscript_build

    rf4493f4 rd41bc4d  
    11# vim:set syntax=python:
    22
    3 pyaubio = bld.new_task_gen(name = 'python-aubio',
     3pyaubio = ctx.new_task_gen(name = 'python-aubio',
    44  features = 'c cshlib pyext',
    55  source = '../../swig/aubio.i',
     
    1313
    1414# install python files
    15 bld.install_files('${PYTHONDIR}/${PACKAGE}/', bld.path.ant_glob('**/*.py'))
     15ctx.install_files('${PYTHONDIR}/${PACKAGE}/', ctx.path.ant_glob('**/*.py'))
    1616# install swig generated python file
    17 bld.install_files('${PYTHONDIR}/${PACKAGE}/', '../../swig/aubiowrapper.py')
     17ctx.install_files('${PYTHONDIR}/${PACKAGE}/', '../../swig/aubiowrapper.py')
  • python/wscript_build

    rf4493f4 rd41bc4d  
    11# vim:set syntax=python:
    22
    3 bld.add_subdirs('aubio')
     3ctx.add_subdirs('aubio')
    44# install headers
    55for file in ['aubiocut', 'aubiopitch']:
    6   bld.install_as('${PREFIX}/bin/' + file, file, chmod = 0755)
     6  ctx.install_as('${PREFIX}/bin/' + file, file, chmod = 0755)
  • src/wscript_build

    rf4493f4 rd41bc4d  
    33uselib = ['SAMPLERATE']
    44if 'HAVE_FFTW3' in conf.get_env():
    5   source = bld.path.ant_glob('*.c **/*.c', excl = ['**/ooura_fft8g.c'])
     5  source = ctx.path.ant_glob('*.c **/*.c', excl = ['**/ooura_fft8g.c'])
    66  uselib += ['FFTW3', 'FFTW3F']
    77else:
    8   source = bld.path.ant_glob('*.c **/*.c')
     8  source = ctx.path.ant_glob('*.c **/*.c')
    99
    1010# build libaubio
    11 bld.shlib(
     11ctx.shlib(
    1212    includes = ['.'],
    1313    source = source,
     
    1515    lib = 'm',
    1616    uselib = uselib,
    17     vnum = bld.env['LIB_VERSION'])
     17    vnum = ctx.env['LIB_VERSION'])
    1818
    1919# install headers, except _priv.h ones
    20 bld.install_files('${PREFIX}/include/aubio/',
    21         bld.path.ant_glob('**/*.h',
     20ctx.install_files('${PREFIX}/include/aubio/',
     21        ctx.path.ant_glob('**/*.h',
    2222        exclude = ['_priv.h', 'config.h']),
    2323        relative_trick=True)
  • wscript

    rf4493f4 rd41bc4d  
    3131out = 'build'
    3232
    33 def init(opt):
    34   pass
    35 
    36 def options(opt):
    37   opt.add_option('--enable-double', action='store_true', default=False,
     33def options(ctx):
     34  ctx.add_option('--enable-double', action='store_true', default=False,
    3835      help='compile aubio in double precision mode')
    39   opt.add_option('--enable-fftw', action='store_true', default=False,
     36  ctx.add_option('--enable-fftw', action='store_true', default=False,
    4037      help='compile with ooura instead of fftw')
    41   opt.add_option('--enable-fftw3f', action='store_true', default=False,
     38  ctx.add_option('--enable-fftw3f', action='store_true', default=False,
    4239      help='compile with fftw3 instead of fftw3f')
    43   opt.add_option('--enable-complex', action='store_true', default=False,
     40  ctx.add_option('--enable-complex', action='store_true', default=False,
    4441      help='compile with C99 complex')
    45   opt.add_option('--enable-jack', action='store_true', default=False,
     42  ctx.add_option('--enable-jack', action='store_true', default=False,
    4643      help='compile with jack support')
    47   opt.add_option('--enable-lash', action='store_true', default=False,
     44  ctx.add_option('--enable-lash', action='store_true', default=False,
    4845      help='compile with lash support')
    49   opt.add_option('--enable-sndfile', action='store_true', default=False,
     46  ctx.add_option('--enable-sndfile', action='store_true', default=False,
    5047      help='compile with libsndfile support')
    51   opt.add_option('--enable-samplerate', action='store_true', default=False,
     48  ctx.add_option('--enable-samplerate', action='store_true', default=False,
    5249      help='compile with libsamplerate support')
    53   opt.add_option('--enable-swig', action='store_true', default=False,
     50  ctx.add_option('--enable-swig', action='store_true', default=False,
    5451      help='compile with swig support (obsolete)')
    55   opt.add_option('--with-target-platform', type='string',
     52  ctx.add_option('--with-target-platform', type='string',
    5653      help='set target platform for cross-compilation', dest='target_platform')
    57   opt.load('compiler_c')
    58   opt.load('compiler_cxx')
    59   opt.load('gnu_dirs')
    60   opt.load('waf_unit_test')
    61 
    62 def configure(conf):
     54  ctx.load('compiler_c')
     55  ctx.load('compiler_cxx')
     56  ctx.load('gnu_dirs')
     57  ctx.load('waf_unit_test')
     58
     59def configure(ctx):
    6360  import Options
    64   conf.check_tool('compiler_c')
    65   conf.check_tool('compiler_cxx')
    66   conf.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation
    67   #conf.check_tool('misc') # needed for subst
    68   conf.load('waf_unit_test')
     61  ctx.check_tool('compiler_c')
     62  ctx.check_tool('compiler_cxx')
     63  ctx.check_tool('gnu_dirs') # helpful for autotools transition and .pc generation
     64  #ctx.check_tool('misc') # needed for subst
     65  ctx.load('waf_unit_test')
    6966
    7067  if Options.options.target_platform:
     
    7269
    7370  if Options.platform == 'win32':
    74     conf.env['shlib_PATTERN'] = 'lib%s.dll'
     71    ctx.env['shlib_PATTERN'] = 'lib%s.dll'
    7572
    7673  # check for required headers
    77   conf.check(header_name='stdlib.h')
    78   conf.check(header_name='stdio.h')
    79   conf.check(header_name='math.h')
    80   conf.check(header_name='string.h')
    81   conf.check(header_name='limits.h')
     74  ctx.check(header_name='stdlib.h')
     75  ctx.check(header_name='stdio.h')
     76  ctx.check(header_name='math.h')
     77  ctx.check(header_name='string.h')
     78  ctx.check(header_name='limits.h')
    8279
    8380  # optionally use complex.h
    8481  if (Options.options.enable_complex == True):
    85     conf.check(header_name='complex.h')
     82    ctx.check(header_name='complex.h')
    8683
    8784  # check dependencies
    8885  if (Options.options.enable_sndfile == True):
    89     conf.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
     86    ctx.check_cfg(package = 'sndfile', atleast_version = '1.0.4',
    9087      args = '--cflags --libs')
    9188  if (Options.options.enable_samplerate == True):
    92       conf.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
     89      ctx.check_cfg(package = 'samplerate', atleast_version = '0.0.15',
    9390        args = '--cflags --libs')
    9491
    9592  # double precision mode
    9693  if (Options.options.enable_double == True):
    97     conf.define('HAVE_AUBIO_DOUBLE', 1)
     94    ctx.define('HAVE_AUBIO_DOUBLE', 1)
    9895  else:
    99     conf.define('HAVE_AUBIO_DOUBLE', 0)
     96    ctx.define('HAVE_AUBIO_DOUBLE', 0)
    10097
    10198  # check if pkg-config is installed, optional
    10299  try:
    103     conf.find_program('pkg-config', var='PKGCONFIG')
    104   except conf.errors.ConfigurationError:
    105     conf.msg('Could not find pkg-config', 'disabling fftw, jack, and lash')
    106     conf.msg('Could not find fftw', 'using ooura')
     100    ctx.find_program('pkg-config', var='PKGCONFIG')
     101  except ctx.errors.ConfigurationError:
     102    ctx.msg('Could not find pkg-config', 'disabling fftw, jack, and lash')
     103    ctx.msg('Could not find fftw', 'using ooura')
    107104
    108105  # optional dependancies using pkg-config
    109   if conf.env['PKGCONFIG']:
     106  if ctx.env['PKGCONFIG']:
    110107
    111108    if (Options.options.enable_fftw == True or Options.options.enable_fftw3f == True):
    112109      # one of fftwf or fftw3f
    113110      if (Options.options.enable_fftw3f == True):
    114         conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
     111        ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
    115112            args = '--cflags --libs')
    116113        if (Options.options.enable_double == True):
    117           conf.msg('Warning', 'fftw3f enabled, but aubio compiled in double precision!')
     114          ctx.msg('Warning', 'fftw3f enabled, but aubio compiled in double precision!')
    118115      else:
    119116        # fftw3f not enabled, take most sensible one according to enable_double
    120117        if (Options.options.enable_double == True):
    121           conf.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
     118          ctx.check_cfg(package = 'fftw3', atleast_version = '3.0.0',
    122119              args = '--cflags --libs')
    123120        else:
    124           conf.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
     121          ctx.check_cfg(package = 'fftw3f', atleast_version = '3.0.0',
    125122              args = '--cflags --libs')
    126       conf.define('HAVE_FFTW3', 1)
     123      ctx.define('HAVE_FFTW3', 1)
    127124    else:
    128125      # fftw disabled, use ooura
    129       conf.msg('Fftw disabled', 'using ooura')
     126      ctx.msg('Fftw disabled', 'using ooura')
    130127      pass
    131128
    132129    if (Options.options.enable_jack == True):
    133       conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
     130      ctx.check_cfg(package = 'jack', atleast_version = '0.15.0',
    134131      args = '--cflags --libs')
    135132
    136133    if (Options.options.enable_lash == True):
    137       conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
     134      ctx.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
    138135      args = '--cflags --libs', uselib_store = 'LASH')
    139136
     
    141138  if (Options.options.enable_swig == True):
    142139    try:
    143       conf.find_program('swig', var='SWIG')
    144     except conf.errors.ConfigurationError:
    145       conf.to_log('swig was not found, not looking for (ignoring)')
    146 
    147     if conf.env['SWIG']:
    148       conf.check_tool('swig')
    149       conf.check_swig_version()
     140      ctx.find_program('swig', var='SWIG')
     141    except ctx.errors.ConfigurationError:
     142      ctx.to_log('swig was not found, not looking for (ignoring)')
     143
     144    if ctx.env['SWIG']:
     145      ctx.check_tool('swig')
     146      ctx.check_swig_version()
    150147
    151148      # python
    152       if conf.find_program('python'):
    153         conf.check_tool('python')
    154         conf.check_python_version((2,4,2))
    155         conf.check_python_headers()
     149      if ctx.find_program('python'):
     150        ctx.check_tool('python')
     151        ctx.check_python_version((2,4,2))
     152        ctx.check_python_headers()
    156153
    157154  # check support for C99 __VA_ARGS__ macros
     
    160157#define AUBIO_ERR(...) fprintf(stderr, __VA_ARGS__)
    161158'''
    162   if conf.check_cc(fragment = check_c99_varargs,
     159  if ctx.check_cc(fragment = check_c99_varargs,
    163160      type='cstlib',
    164161      msg = 'Checking for C99 __VA_ARGS__ macro'):
    165     conf.define('HAVE_C99_VARARGS_MACROS', 1)
     162    ctx.define('HAVE_C99_VARARGS_MACROS', 1)
    166163
    167164  # write configuration header
    168   conf.write_config_header('src/config.h')
     165  ctx.write_config_header('src/config.h')
    169166
    170167  # add some defines used in examples
    171   conf.define('AUBIO_PREFIX', conf.env['PREFIX'])
    172   conf.define('PACKAGE', APPNAME)
     168  ctx.define('AUBIO_PREFIX', ctx.env['PREFIX'])
     169  ctx.define('PACKAGE', APPNAME)
    173170
    174171  # check if docbook-to-man is installed, optional
    175172  try:
    176     conf.find_program('docbook-to-man', var='DOCBOOKTOMAN')
    177   except conf.errors.ConfigurationError:
    178     conf.to_log('docbook-to-man was not found (ignoring)')
    179 
    180 def build(bld):
    181   bld.env['VERSION'] = VERSION
    182   bld.env['LIB_VERSION'] = LIB_VERSION
     173    ctx.find_program('docbook-to-man', var='DOCBOOKTOMAN')
     174  except ctx.errors.ConfigurationError:
     175    ctx.to_log('docbook-to-man was not found (ignoring)')
     176
     177def build(ctx):
     178  ctx.env['VERSION'] = VERSION
     179  ctx.env['LIB_VERSION'] = LIB_VERSION
    183180
    184181  # add sub directories
    185   bld.add_subdirs('src examples')
    186   if bld.env['SWIG']:
    187     if bld.env['PYTHON']:
    188       bld.add_subdirs('python')
     182  ctx.add_subdirs('src examples')
     183  if ctx.env['SWIG']:
     184    if ctx.env['PYTHON']:
     185      ctx.add_subdirs('python')
    189186
    190187  # create the aubio.pc file for pkg-config
    191   if bld.env['TARGET_PLATFORM'] == 'linux':
    192     aubiopc = bld.new_task_gen('subst')
     188  if ctx.env['TARGET_PLATFORM'] == 'linux':
     189    aubiopc = ctx.new_task_gen('subst')
    193190    aubiopc.source = 'aubio.pc.in'
    194191    aubiopc.target = 'aubio.pc'
     
    196193
    197194  # build manpages from sgml files
    198   if bld.env['DOCBOOKTOMAN']:
     195  if ctx.env['DOCBOOKTOMAN']:
    199196    import TaskGen
    200197    TaskGen.declare_chain(
     
    205202        reentrant = 0,
    206203    )
    207     manpages = bld.new_task_gen(name = 'docbooktoman',
    208         source=bld.path.ant_glob('doc/*.sgml'))
    209     bld.install_files('${MANDIR}/man1', bld.path.ant_glob('doc/*.1'))
     204    manpages = ctx.new_task_gen(name = 'docbooktoman',
     205        source=ctx.path.ant_glob('doc/*.sgml'))
     206    ctx.install_files('${MANDIR}/man1', ctx.path.ant_glob('doc/*.1'))
    210207
    211208  # install woodblock sound
    212   bld.install_files('${PREFIX}/share/sounds/aubio/',
     209  ctx.install_files('${PREFIX}/share/sounds/aubio/',
    213210      'sounds/woodblock.aiff')
    214211
    215212  # build and run the unit tests
    216   build_tests(bld)
    217 
    218 def shutdown(bld):
     213  build_tests(ctx)
     214
     215def shutdown(ctx):
    219216  pass
    220217
    221218# loop over all *.c filenames in tests/src to build them all
    222219# target name is filename.c without the .c
    223 def build_tests(bld):
    224   for target_name in bld.path.ant_glob('tests/src/**/*.c'):
     220def build_tests(ctx):
     221  for target_name in ctx.path.ant_glob('tests/src/**/*.c'):
    225222    includes = ['src']
    226223    uselib = []
     
    231228    else:
    232229      # phasevoc-jack needs jack
    233       if bld.env['JACK']:
     230      if ctx.env['JACK']:
    234231        includes = ['examples']
    235232        uselib = ['JACK']
     
    238235        continue
    239236
    240     this_target = bld.new_task_gen(
     237    this_target = ctx.new_task_gen(
    241238        features = 'c cprogram test',
    242239        uselib = uselib,
Note: See TracChangeset for help on using the changeset viewer.