aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-03 16:34:18 +0000
committerDavid Robillard <d@drobilla.net>2012-08-03 16:34:18 +0000
commitc7e9e0ff5bb44d31f63a1f5ff5174e78221ce96a (patch)
tree446cc0ff299ff28cfe220672a1f434a6ecf78a36 /wscript
parentecdfdc2235d916a7eb5b6edaafc143727c8a1d49 (diff)
downloadmda.lv2-c7e9e0ff5bb44d31f63a1f5ff5174e78221ce96a.tar.gz
mda.lv2-c7e9e0ff5bb44d31f63a1f5ff5174e78221ce96a.tar.bz2
mda.lv2-c7e9e0ff5bb44d31f63a1f5ff5174e78221ce96a.zip
Use more portable defines instead of -D in CFLAGS.
git-svn-id: http://svn.drobilla.net/lad/trunk/plugins/mda.lv2@4608 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'wscript')
-rw-r--r--wscript77
1 files changed, 31 insertions, 46 deletions
diff --git a/wscript b/wscript
index 81c72cf..9d491ad 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,8 @@
#!/usr/bin/env python
import os
+import re
import shutil
+
from waflib.extras import autowaf as autowaf
# Version of this package (even if built as a child)
@@ -26,49 +28,18 @@ def configure(conf):
autowaf.check_pkg(conf, 'lv2', atleast_version='1.0.0', uselib_store='LV2')
- conf.env.append_unique('CFLAGS', '-std=c99')
-
- # Set env['pluginlib_PATTERN']
- pat = conf.env['cxxshlib_PATTERN']
- if pat[0:3] == 'lib':
- pat = pat[3:]
- conf.env['pluginlib_PATTERN'] = pat
- conf.env['pluginlib_EXT'] = pat[pat.rfind('.'):]
-
autowaf.display_msg(conf, "LV2 bundle directory",
conf.env['LV2DIR'])
print('')
-def build_plugin(bld, lang, bundle, name, source, cflags=[], libs=[]):
- # Build plugin library
- penv = bld.env.derive()
- penv['cshlib_PATTERN'] = bld.env['pluginlib_PATTERN']
- penv['cxxshlib_PATTERN'] = bld.env['pluginlib_PATTERN']
- obj = bld(features = '%s %sshlib' % (lang,lang),
- env = penv,
- source = source + ['lvz/wrapper.cpp'],
- includes = [ '.', './lvz', './src' ],
- name = name,
- target = os.path.join(bundle, name),
- install_path = '${LV2DIR}/' + bundle,
- uselib = ['LV2'])
- if cflags != []:
- obj.cxxflags = cflags
- if libs != []:
- autowaf.use_lib(bld, obj, libs)
-
- # Install data file
- data_file = '%s.ttl' % name
- bld.install_files('${LV2DIR}/' + bundle, os.path.join(bundle, data_file))
-
def build(bld):
+ bundle = 'mda.lv2'
+
# Copy data files to build bundle (build/mda.lv2)
def do_copy(task):
src = task.inputs[0].abspath()
tgt = task.outputs[0].abspath()
return shutil.copy(src, tgt)
- #cmd = 'cp %s %s' % (src, tgt)
- #return task.exec_command(cmd)
for i in bld.path.ant_glob('mda.lv2/[A-Z]*.ttl'):
bld(rule = do_copy,
@@ -76,10 +47,15 @@ def build(bld):
target = bld.path.get_bld().make_node('mda.lv2/%s' % i),
install_path = '${LV2DIR}/mda.lv2')
- bld(features = 'subst',
- source = 'mda.lv2/manifest.ttl.in',
- target = bld.path.get_bld().make_node('mda.lv2/manifest.ttl'),
- LIB_EXT = bld.env['pluginlib_EXT'],
+ # Make a pattern for shared objects without the 'lib' prefix
+ module_pat = re.sub('^lib', '', bld.env['cxxshlib_PATTERN'])
+ module_ext = module_pat[module_pat.rfind('.'):]
+
+ # Build manifest by substitution
+ bld(features = 'subst',
+ source = 'mda.lv2/manifest.ttl.in',
+ target = bld.path.get_bld().make_node('mda.lv2/manifest.ttl'),
+ LIB_EXT = module_ext,
install_path = '${LV2DIR}/mda.lv2')
plugins = '''
@@ -120,12 +96,21 @@ def build(bld):
VocInput
Vocoder
'''.split()
-# Looplex
-
- # Build plugin libraries
- for i in plugins:
- build_plugin(bld, 'cxx', 'mda.lv2', i, ['src/mda%s.cpp' % i],
- ['-DPLUGIN_CLASS=mda%s' % i,
- '-DURI_PREFIX=\"http://drobilla.net/plugins/mda/\"',
- '-DPLUGIN_URI_SUFFIX="%s"' % i,
- '-DPLUGIN_HEADER="src/mda%s.h"' % i])
+
+ for p in plugins:
+ # Build plugin library
+ obj = bld(features = 'cxx cxxshlib',
+ source = ['src/mda%s.cpp' % p, 'lvz/wrapper.cpp'],
+ includes = ['.', './lvz', './src'],
+ name = p,
+ target = os.path.join(bundle, p),
+ install_path = '${LV2DIR}/' + bundle,
+ uselib = ['LV2'],
+ defines = ['PLUGIN_CLASS=mda%s' % p,
+ 'URI_PREFIX="http://drobilla.net/plugins/mda/"',
+ 'PLUGIN_URI_SUFFIX="%s"' % p,
+ 'PLUGIN_HEADER="src/mda%s.h"' % p])
+ obj.env['cxxshlib_PATTERN'] = module_pat
+
+ # Install data file
+ bld.install_files('${LV2DIR}/' + bundle, os.path.join(bundle, p + '.ttl'))