30370905d728dc0c91ea00f9b65a8f41b0571aea
[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     # check for puredata header
22     ctx.check(header_name='m_pd.h')
23     # required dependancies
24     ctx.check_cfg(package = 'aubio', atleast_version = '0.4.0',
25             args = '--cflags --libs')
26
27 def build(bld):
28
29     uselib = ['AUBIO']
30     bld(features = 'c cshlib',
31         source = bld.path.ant_glob('*.c'),
32         uselib = ['AUBIO'],
33         target = 'aubio',
34         defines = ['PD', 'PACKAGE_VERSION=\"'+repr(VERSION)+"\""],
35         install_path = '${PREFIX}/lib/pd/extra')
36
37     if bld.env['DEST_OS'] == 'win32':
38         bld.env.cshlib_PATTERN = '%s.dll'
39         # do not use -fPIC -DPIC on windows
40         bld.env.cshlib_CCFLAGS.remove('-fPIC')
41         bld.env.cshlib_CCFLAGS.remove('-DPIC')
42         bld.env.append_unique('shlib_LINKFLAGS', ['-export_dynamic', '-lpd'])
43     elif bld.env['DEST_OS'] == 'darwin':
44         bld.env.cshlib_PATTERN = '%s.pd_darwin'
45         bld.env.append_unique('shlib_LINKFLAGS',
46             ['-bundle', '-undefined suppres', '-flat_namespace'])
47     else: #if bld.env['DEST_OS'] == 'linux':
48         bld.env.cshlib_PATTERN = '%s.pd_linux'
49         bld.env.append_unique('shlib_LINKFLAGS', ['--export_dynamic'])
50
51     bld.install_files('${PREFIX}/lib/pd/doc/5.reference',
52             bld.path.ant_glob('help/**.pd'))
53
54     bld.install_files('${PREFIX}/lib/pd/doc/aubio',
55             bld.path.ant_glob('examples/**.pd'))