X-Git-Url: https://git.aubio.org/?p=pd-aubio.git;a=blobdiff_plain;f=wscript;h=e1afe5f99a8966c6442b3d27f96b3a0540f782d7;hp=dad8016621f37dc6ad3e1e4cc8f9c81fa6ed2c7a;hb=591c04c8c238a386c8147a9133c28d4ba2f50fdc;hpb=71a47937911dcab83245305a8595fff128396c8b diff --git a/wscript b/wscript index dad8016..e1afe5f 100644 --- a/wscript +++ b/wscript @@ -4,45 +4,62 @@ top = '.' out = 'build' -VERSION = '0.2' +APPNAME = 'pd-aubio' + +# source VERSION +for l in open('VERSION').readlines(): exec (l.strip()) +VERSION = '.'.join ([str(x) for x in [ + PD_AUBIO_MAJOR_VERSION, + PD_AUBIO_MINOR_VERSION, + ]]) + PD_AUBIO_VERSION_STATUS def options(ctx): ctx.load('compiler_c') -def configure(conf): - conf.load('compiler_c') - # required dependancies - conf.check_cfg(package = 'aubio', atleast_version = '0.4.0', - args = '--cflags --libs') +def configure(ctx): + ctx.load('compiler_c') + + if ctx.env['DEST_OS'] == 'linux': + ctx.env.cshlib_PATTERN = '%s.pd_linux' + elif ctx.env['DEST_OS'] == 'darwin': + ctx.env.cshlib_PATTERN = '%s.pd_darwin' + # add default include path for both pd and pd-extended + # set CFLAGS for custom location + ctx.env.CFLAGS += ['-I/Applications/Pd-0.47-1.app/Contents/Resources/src'] + ctx.env.CFLAGS += ['-I/Applications/Pd-extended.app/Contents/Resources/include'] + ctx.env.CFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] + ctx.env.LINKFLAGS += ['-arch', 'i386', '-arch', 'x86_64'] + ctx.env.LINKFLAGS_cshlib = ['-bundle', '-undefined', 'suppress', '-flat_namespace'] + elif ctx.env['DEST_OS'] in ['win32', 'win64']: + ctx.env.cshlib_PATTERN = '%s.dll' + # do not use -fPIC -DPIC on windows + ctx.env.CFLAGS_cshlib = [] + ctx.env.LINKFLAGS_cshlib += ['-export_dynamic', '-lpd'] + else: + ctx.start_msg("Checking for platform") + ctx.end_msg("no idea how to build for %s yet, assuming linux" + % ctx.env['DEST_OS'], 'YELLOW') + ctx.env.cshlib_PATTERN = '%s.pd_linux' + ctx.env.LINKFLAGS_cshlib += ['--export_dynamic'] + # check for puredata header - conf.check(header_name='m_pd.h') + ctx.check(header_name='m_pd.h') + + # required dependencies + ctx.check_cfg(package = 'aubio', atleast_version = '0.4.0', + args = '--cflags --libs') def build(bld): - aubio_pd = bld.new_task_gen( - features = 'cc cshlib', + + bld(features = 'c cshlib', + source = bld.path.ant_glob('src/*.c'), uselib = ['AUBIO'], + target = 'aubio', defines = ['PD', 'PACKAGE_VERSION=\"'+repr(VERSION)+"\""], - install_path = '${PREFIX}/lib/pd/extra') + install_path = '${PREFIX}/lib/pd/extra/aubio') - if bld.env['DEST_OS'] == 'win32': - aubio_pd.target = 'aubio.dll' - # do not use -fPIC -DPIC on windows - aubio_pd.env.shlib_CCFLAGS.remove('-fPIC') - aubio_pd.env.shlib_CCFLAGS.remove('-DPIC') - aubio_pd.env.append_unique('shlib_LINKFLAGS', ['-export_dynamic', '-lpd']) - elif bld.env['DEST_OS'] == 'darwin': - aubio_pd.target = 'aubio.pd_darwin' - aubio_pd.env.append_unique('shlib_LINKFLAGS', - ['-bundle', '-undefined suppres', '-flat_namespace']) - else: #if bld.env['DEST_OS'] == 'linux': - aubio_pd.target = 'aubio.pd_linux' - aubio_pd.env.append_unique('shlib_LINKFLAGS', ['--export_dynamic']) - - # do not rename the shlib at all - aubio_pd.env.shlib_PATTERN = '%s' - # get the source files - aubio_pd.find_sources_in_dirs('.') - - bld.install_files('${PREFIX}/lib/pd/doc/5.reference', 'help/*.pd') - - bld.install_files('${PREFIX}/lib/pd/doc/aubio', 'examples/*.pd') + bld.install_files('${PREFIX}/lib/pd/extra/aubio', + bld.path.ant_glob('help/**.pd')) + + bld.install_files('${PREFIX}/lib/pd/extra/aubio/examples', + bld.path.ant_glob('examples/**.pd'))