forked from hard-mode/lad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
128 lines (107 loc) · 3.32 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env python
import os
import subprocess
import waflib.Logs as Logs, waflib.Options as Options
from waflib.extras import autowaf as autowaf
# Variables for 'waf dist'
VERSION = '0.0.1'
APPNAME = 'drobillad'
# Mandatory variables
top = '.'
out = 'build'
projects = '''
serd
sord
sratom
suil
lilv
raul
ganv
patchage
ingen
jalv
machina
naub
plugins/float.lv2
plugins/mda.lv2
plugins/matriseq
plugins/blop.lv2
plugins/fomp.lv2
plugins/omins.lv2
plugins/glamp.lv2
plugins/mesp.lv2
'''.split()
# plugins/dirg.lv2
# plugins/lolep.lv2
def options(opt):
opt.load('compiler_c')
opt.load('compiler_cxx')
opt.load('lv2')
autowaf.set_options(opt)
opt.add_option('--cmd', type='string', dest='cmd',
help='Command to run from build directory (for run command)')
for i in projects:
opt.recurse(i)
def sub_config_and_use(conf, name, has_objects = True, pkgname = ''):
conf.recurse(name)
if pkgname == '':
pkgname = name
autowaf.set_local_lib(conf, pkgname, has_objects)
def configure(conf):
conf.load('compiler_c')
conf.load('compiler_cxx')
conf.load('lv2')
autowaf.configure(conf)
autowaf.set_recursive()
autowaf.check_pkg(conf, 'lv2', atleast_version='1.8.0', uselib_store='LV2')
# I have no idea why this is necessary
conf.env.CXXFLAGS += ['-I%s/raul' % os.path.abspath(top)]
print('')
conf.env.DROBILLAD_BUILD = []
global to_build
for i in projects:
try:
sub_config_and_use(conf, i)
conf.env.DROBILLAD_BUILD += [i]
except:
Logs.warn('Configuration failed, %s will not be built\n' % i)
Logs.info('Building:\n\t%s\n' % '\n\t'.join(conf.env.DROBILLAD_BUILD))
not_building = []
for i in projects:
if i not in conf.env.DROBILLAD_BUILD:
not_building += [i]
if not_building != []:
Logs.warn('Not building:\n\t%s\n' % '\n\t'.join(not_building))
def source_tree_env():
"Set up the environment to run things from the source tree."
env = os.environ
library_path = []
if 'LD_LIBRARY_PATH' in env:
library_path = env.LD_LIBRARY_PATH.split(os.pathsep)
for i in 'serd sord sratom lilv suil raul ganv'.split():
library_path += [ os.path.join(os.getcwd(), 'build', i) ]
ingen_module_path = []
for i in 'client server shared gui serialisation'.split():
path = os.path.join(os.getcwd(), 'build', 'ingen', 'src', i)
library_path += [ path ]
ingen_module_path += [ path ]
env.LD_LIBRARY_PATH = os.pathsep.join(library_path)
env.INGEN_MODULE_PATH = os.pathsep.join(ingen_module_path)
env.LV2_PATH = os.pathsep.join(['~/.lv2', os.path.join(os.getcwd(), 'lv2')])
return env
def run(ctx):
if not Options.options.cmd:
Logs.error("missing --cmd option for run command")
return
cmd = Options.options.cmd
Logs.pprint('GREEN', 'Running %s' % cmd)
subprocess.call(cmd, shell=True, env=source_tree_env())
def build(bld):
autowaf.set_recursive()
for i in bld.env.DROBILLAD_BUILD:
bld.recurse(i)
def test(ctx):
autowaf.set_recursive();
os.environ = source_tree_env()
for i in ['raul', 'serd', 'sord', 'sratom', 'lilv']:
ctx.recurse(i)