-
Notifications
You must be signed in to change notification settings - Fork 0
/
wscript
147 lines (141 loc) · 3.52 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
APPNAME = 'gpioctl'
VERSION = '0.0.9-rc3'
top = '.'
def options(opt):
opt.load('compiler_c')
opt.add_option(
'--disable-jack',
default = False,
action = 'store_true',
dest = 'nojack',
help = 'Do not use JACK even if library is present.')
opt.add_option(
'--disable-alsa',
default = False,
action = 'store_true',
dest = 'noalsa',
help = 'Do not use ALSA even if library is present.')
opt.add_option(
'--disable-osc',
default = False,
action = 'store_true',
dest = 'noosc',
help = 'Do not use OSC even if liblo is present.')
def configure(cnf):
cnf.env.libs = ['GPIOD', 'PTHREAD']
cnf.env.objs = ['parse_cmdline', 'gpiod_process', 'stdout_process', 'stdout_cmdline']
cnf.load('compiler_c',
cache = True)
cnf.check(
features = 'c cshlib',
lib = 'gpiod',
uselib_store = 'GPIOD',
mandatory = True)
cnf.check(
header_name = 'gpiod.h',
mandatory = True)
cnf.check(
features = 'c cshlib',
lib = 'pthread',
uselib_store = 'PTHREAD',
mandatory = True)
cnf.check(
header_name = 'pthread.h',
mandatory = True)
if not cnf.options.nojack:
lib = cnf.check(
features = 'c cshlib',
lib = 'jack',
uselib_store = 'JACK',
mandatory = False,
define_name = 'HAVE_JACK')
header = cnf.check(
header_name = 'jack/jack.h',
mandatory = False)
if lib and header:
cnf.env.libs += ['JACK']
cnf.env.objs += ['jack_process', 'ringbuffer', 'jack_cmdline']
if not cnf.options.noalsa:
lib = cnf.check(
features = 'c cshlib',
lib = 'asound',
uselib_store = 'ASOUND',
mandatory = False,
define_name = 'HAVE_ALSA')
header = cnf.check(
header_name = 'alsa/asoundlib.h',
mandatory = False)
if lib and header:
cnf.env.libs += ['ASOUND']
cnf.env.objs += ['alsa_process', 'alsa_cmdline']
if not cnf.options.noosc:
lib = cnf.check(
features = 'c cshlib',
lib = 'lo',
uselib_store = 'LO',
mandatory = False,
define_name = 'HAVE_OSC')
header = cnf.check(
header_name = 'lo/lo.h',
mandatory = False)
if lib and header:
cnf.env.libs += ['LO']
cnf.env.objs += ['osc_process', 'osc_cmdline', 'master_cmdline', 'slave_cmdline', 'slave_process']
cnf.cc_add_flags()
cnf.link_add_flags()
cnf.cxx_add_flags()
cnf.add_os_flags('DESTDIR');
cnf.add_os_flags('PREFIX');
cnf.write_config_header('config.h');
def build(bld):
if 'JACK' in bld.env.libs:
bld.objects(
source = 'jack_process.c',
target = 'jack_process')
bld.objects(
source = 'ringbuffer.c',
target = 'ringbuffer')
bld.objects(
source = 'jack_cmdline.c',
target = 'jack_cmdline')
if 'ASOUND' in bld.env.libs:
bld.objects(
source = 'alsa_process.c',
target = 'alsa_process')
bld.objects(
source = 'alsa_cmdline.c',
target = 'alsa_cmdline')
if 'LO' in bld.env.libs:
bld.objects(
source = 'osc_process.c',
target = 'osc_process')
bld.objects(
source = 'slave_process.c',
target = 'slave_process')
bld.objects(
source = 'osc_cmdline.c',
target = 'osc_cmdline')
bld.objects(
source = 'master_cmdline.c',
target = 'master_cmdline')
bld.objects(
source = 'slave_cmdline.c',
target = 'slave_cmdline')
bld.objects(
source = ['parse_cmdline.c'],
target = 'parse_cmdline')
bld.objects(
source = 'gpiod_process.c',
target = 'gpiod_process')
bld.objects(
source = 'stdout_process.c',
target = 'stdout_process')
bld.objects(
source = 'stdout_cmdline.c',
target = 'stdout_cmdline')
bld.program(
source = 'main.c',
target = 'gpioctl',
use = bld.env.objs,
uselib = bld.env.libs,
install_path = '${DESTDIR}/${PREFIX}/bin')