wscript: check for pd header, define VERSION
[pd-aubio.git] / wscript
1 #! /usr/bin/python
2 # build puredata external
3
4 srcdir = '.'
5 blddir = 'build'
6 VERSION = '0.2'
7
8 def set_options(opt):
9     opt.tool_options('compiler_cc')
10
11 def configure(conf):
12     conf.check_tool('compiler_cc')
13     # required dependancies
14     conf.check_cfg(package = 'aubio', atleast_version = '0.4.0',
15             args = '--cflags --libs')
16     # check for puredata header
17     conf.check(header_name='m_pd.h')
18
19 def build(bld):
20     aubio_pd = bld.new_task_gen(
21         features = 'cc cshlib',
22         uselib = ['AUBIO'],
23         defines = ['PD', 'PACKAGE_VERSION=\"'+repr(VERSION)+"\""],
24         install_path = '${PREFIX}/lib/pd/extra')
25
26     if bld.env['DEST_OS'] == 'win32':
27         aubio_pd.target = 'aubio.dll'
28         # do not use -fPIC -DPIC on windows
29         aubio_pd.env.shlib_CCFLAGS.remove('-fPIC')
30         aubio_pd.env.shlib_CCFLAGS.remove('-DPIC')
31         aubio_pd.env.append_unique('shlib_LINKFLAGS', ['-export_dynamic', '-lpd'])
32     elif bld.env['DEST_OS'] == 'darwin':
33         aubio_pd.target = 'aubio.pd_darwin'
34         aubio_pd.env.append_unique('shlib_LINKFLAGS', 
35             ['-bundle', '-undefined suppres', '-flat_namespace'])
36     else: #if bld.env['DEST_OS'] == 'linux':
37         aubio_pd.target = 'aubio.pd_linux'
38         aubio_pd.env.append_unique('shlib_LINKFLAGS', ['--export_dynamic'])
39
40     # do not rename the shlib at all
41     aubio_pd.env.shlib_PATTERN = '%s'
42     # get the source files
43     aubio_pd.find_sources_in_dirs('.')
44
45     bld.install_files('${PREFIX}/lib/pd/doc/5.reference', 'help/*.pd')
46
47     bld.install_files('${PREFIX}/lib/pd/doc/aubio', 'examples/*.pd')