VERSION: bump to 0.4~alpha
[pd-aubio.git] / wscript
1 #! /usr/bin/python
2
3 # build puredata external
4
5 top = '.'
6 out = 'build'
7 APPNAME = 'pd-aubio'
8
9 # source VERSION
10 for l in open('VERSION').readlines(): exec (l.strip())
11 VERSION = '.'.join ([str(x) for x in [
12     PD_AUBIO_MAJOR_VERSION,
13     PD_AUBIO_MINOR_VERSION,
14     ]]) + PD_AUBIO_VERSION_STATUS
15
16 def options(ctx):
17     ctx.load('compiler_c')
18
19 def configure(ctx):
20     ctx.load('compiler_c')
21
22     if ctx.env['DEST_OS'] == 'linux':
23         ctx.env.cshlib_PATTERN = '%s.pd_linux'
24     elif ctx.env['DEST_OS'] == 'darwin':
25         ctx.env.cshlib_PATTERN = '%s.pd_darwin'
26         # add default include path for both pd and pd-extended
27         # set CFLAGS for custom location
28         ctx.env.CFLAGS += ['-I/Applications/Pd-0.45-3.app/Contents/Resources/src']
29         ctx.env.CFLAGS += ['-I/Applications/Pd-extended.app/Contents/Resources/include']
30         ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
31         ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64']
32         ctx.env.LINKFLAGS_cshlib = ['-bundle', '-undefined', 'suppress', '-flat_namespace']
33     elif ctx.env['DEST_OS'] in ['win32', 'win64']:
34         ctx.env.cshlib_PATTERN = '%s.dll'
35         # do not use -fPIC -DPIC on windows
36         ctx.env.CFLAGS_cshlib = []
37         ctx.env.LINKFLAGS_cshlib +=  ['-export_dynamic', '-lpd']
38     else:
39         ctx.fatal("Sorry, i don't know how to build for %s yet" % ctx.env['DEST_OS'])
40
41     # check for puredata header
42     ctx.check(header_name='m_pd.h')
43
44     # required dependencies
45     ctx.check_cfg(package = 'aubio', atleast_version = '0.4.0',
46             args = '--cflags --libs')
47
48 def build(bld):
49
50     bld(features = 'c cshlib',
51         source = bld.path.ant_glob('src/*.c'),
52         uselib = ['AUBIO'],
53         target = 'aubio',
54         defines = ['PD', 'PACKAGE_VERSION=\"'+repr(VERSION)+"\""],
55         install_path = '${PREFIX}/lib/pd/extra')
56
57     bld.install_files('${PREFIX}/lib/pd/doc/5.reference',
58             bld.path.ant_glob('help/**.pd'))
59
60     bld.install_files('${PREFIX}/lib/pd/doc/aubio',
61             bld.path.ant_glob('examples/**.pd'))