Merge command and message extensions.
[lv2.git] / wscript
blob4e8ad306000a7af236257793efe89c23e592c053
1 #!/usr/bin/env python
2 import datetime
3 import os
4 import autowaf
6 # Version of this package (even if built as a child)
7 LV2EXT_VERSION = datetime.date.isoformat(datetime.datetime.now()).replace('-', '.')
9 # Variables for 'waf dist'
10 APPNAME = 'lv2plug.in'
11 VERSION = LV2EXT_VERSION
13 # Mandatory variables
14 srcdir = '.'
15 blddir = 'build'
17 def set_options(opt):
18 autowaf.set_options(opt)
19 opt.tool_options('compiler_cc')
20 opt.tool_options('compiler_cxx')
22 def configure(conf):
23 autowaf.configure(conf)
24 conf.check_tool('compiler_cc')
25 conf.check_tool('compiler_cxx')
26 conf.env.append_value('CCFLAGS', '-std=c99')
27 pat = conf.env['shlib_PATTERN']
28 ext = pat[pat.rfind('.'):]
29 conf.env.append_value('shlib_EXTENSION', ext)
31 def build_plugin(bld, lang, name):
32 ext = bld.env['shlib_EXTENSION'][0]
34 penv = bld.env.copy()
35 penv['shlib_PATTERN'] = '%s' + ext
37 # Library
38 ext = 'c'
39 if lang != 'cc':
40 ext = 'cpp'
42 obj = bld.new_task_gen(lang, 'shlib')
43 obj.env = penv
44 obj.source = [ 'plugins/%s.lv2/%s.%s' % (name, name, ext) ]
45 obj.includes = ['.', './ext']
46 obj.name = name
47 obj.target = name
48 obj.install_path = '${LV2DIR}/' + name + '.lv2'
50 if lang == 'cxx':
51 obj.source += [ 'ext/lv2plugin.cpp' ]
53 # Data
54 data_file = 'plugins/%s.lv2/%s.ttl' % (name, name)
55 manifest_file = 'plugins/%s.lv2/manifest.ttl' % (name)
56 bld.install_files('${LV2DIR}/' + name + '.lv2', data_file)
57 bld.install_files('${LV2DIR}/' + name + '.lv2', manifest_file)
59 def build_extension(bld, name, dir):
60 data_file = '%s/%s.lv2/%s.ttl' % (dir, name, name)
61 manifest_file = '%s/%s.lv2/manifest.ttl' % (dir, name)
62 header_files = '%s/%s.lv2/*.h' % (dir, name)
63 bld.install_files('${LV2DIR}/' + name + '.lv2', data_file)
64 bld.install_files('${LV2DIR}/' + name + '.lv2', manifest_file)
65 bld.install_files('${LV2DIR}/' + name + '.lv2', header_files)
67 def build(bld):
68 ext = '''
69 atom
70 atom-port
71 contexts
72 data-access
73 dyn-manifest
74 event
75 host-info
76 instance-access
77 midi
78 osc
79 parameter
80 port-groups
81 presets
82 string-port
83 uri-map
84 uri-unmap
85 '''
86 for e in ext.split():
87 build_extension(bld, e, 'ext')
89 extensions = '''
91 units
92 '''
93 for e in extensions.split():
94 build_extension(bld, e, 'extensions')