wscript 6.77 KB
Newer Older
nedko's avatar
nedko committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#! /usr/bin/env python
# encoding: utf-8

example_programs = {
    'jack_freewheel' : 'freewheel.c',
    'jack_connect' : 'connect.c',
    'jack_lsp' : 'lsp.c',
    'jack_metro' : 'metro.c',
    'jack_midiseq' : 'midiseq.c',
    'jack_midisine' : 'midisine.c',
    'jack_showtime' : 'showtime.c',
    'jack_simple_client' : 'simple_client.c',
    'jack_zombie' : 'zombie.c',
    'jack_load' : 'ipload.c',
    'jack_unload' : 'ipunload.c',
    'jack_alias' : 'alias.c',
    'jack_bufsize' : 'bufsize.c',
sletz's avatar
sletz committed
18
19
    'jack_wait' : 'wait.c',
    'jack_samplerate' : 'samplerate.c',
nedko's avatar
nedko committed
20
21
    'jack_evmon' : 'evmon.c',
    'jack_monitor_client' : 'monitor_client.c',
22
    'jack_thru' : 'thru_client.c',
sletz's avatar
sletz committed
23
    'jack_cpu_load' : 'cpu_load.c',
sletz's avatar
sletz committed
24
25
    'jack_simple_session_client' : 'simple_session_client.c',
    'jack_session_notify' : 'session_notify.c',
26
    'jack_server_control' : 'server_control.cpp',
27
28
    'jack_net_slave' : 'netslave.c',
    'jack_net_master' : 'netmaster.c',
sletz's avatar
sletz committed
29
30
    'jack_latent_client' : 'latent_client.c',
    'jack_midi_dump' : 'midi_dump.c',
sletz's avatar
sletz committed
31
    'jack_midi_latency_test' : 'midi_latency_test.c'
nedko's avatar
nedko committed
32
33
34
35
36
37
38
    }

example_libs = {
    'inprocess' : 'inprocess.c',
    }

def configure(conf):
39
40
    e = conf.check_cc(header_name='sndfile.h', define_name="HAVE_SNDFILE")
 
nedko's avatar
nedko committed
41
42
43
    if conf.is_defined('HAVE_SNDFILE'):
        conf.env['LIB_SNDFILE'] = ['sndfile']

44
    e = conf.check_cc(lib='readline', define_name="HAVE_READLINE", mandatory=False)
nedko's avatar
nedko committed
45

sletz's avatar
sletz committed
46
47
48
    # define_name="HAVE_READLINE" has no effect, LIB_READLINE is defined if readline is available
    #if conf.is_defined('HAVE_READLINE'):
    #    conf.env['LIB_READLINE'] = ['readline']
nedko's avatar
nedko committed
49

Adrian Knoth's avatar
Adrian Knoth committed
50
    conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = bool(conf.env['LIB_READLINE'])
nedko's avatar
nedko committed
51

52
    conf.env['BUILD_EXAMPLE_CLIENT_REC'] = conf.is_defined('HAVE_SNDFILE')
nedko's avatar
nedko committed
53

sletz's avatar
sletz committed
54
    conf.env['BUILD_EXAMPLE_ALSA_IO'] = conf.is_defined('HAVE_SAMPLERATE') and conf.env['BUILD_DRIVER_ALSA']
sletz's avatar
sletz committed
55

nedko's avatar
nedko committed
56
def build(bld):
57
    if bld.env['IS_LINUX']:
58
        os_incdir = ['../linux', '../posix']
59
    if bld.env['IS_MACOSX']:
60
        os_incdir = ['../macosx', '../posix']
sletz's avatar
sletz committed
61
62
    if bld.env['IS_SUN']:
        os_incdir = ['../solaris', '../posix']
63
64
    if bld.env['IS_WINDOWS']:
        os_incdir = ['../windows']
Adrian Knoth's avatar
Adrian Knoth committed
65
    for example_program, example_program_source in list(example_programs.items()):
66
        if example_program == 'jack_server_control':
67
            use = ['serverlib', 'STDC++']
68
69
70
        elif example_program == 'jack_net_slave':
            if not bld.env['BUILD_NETLIB']:
                continue
71
            use = ['netlib']
72
73
74
        elif example_program == 'jack_net_master':
            if not bld.env['BUILD_NETLIB']:
                continue
75
            use = ['netlib']
76
        else:
77
            use = ['clientlib']
78

79
        prog = bld(features='c cprogram')
80
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
81
        prog.source = example_program_source
82
        prog.use = use
83
        if bld.env['IS_MACOSX']:
84
85
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
sletz's avatar
sletz committed
86
            prog.env.append_value("LINKFLAGS", "")
87
        if bld.env['IS_LINUX']:
88
            prog.use += ['RT', 'M']
sletz's avatar
sletz committed
89
        if bld.env['IS_SUN']:
90
            prog.use += ['M']
91

nedko's avatar
nedko committed
92
        prog.target = example_program
93
   
sletz's avatar
sletz committed
94
    if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT']:
95
        prog = bld(features = 'c cprogram')
96
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
97
        prog.source = 'transport.c'
98
        prog.use = ['clientlib']
99
        if bld.env['IS_MACOSX']:
100
101
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
sletz's avatar
sletz committed
102
            prog.env.append_value("LINKFLAGS", "")
103
        if bld.env['IS_LINUX']:
Adrian Knoth's avatar
Adrian Knoth committed
104
            prog.use += ['RT', 'READLINE']
105
        if bld.env['IS_MACOSX']:
Adrian Knoth's avatar
Adrian Knoth committed
106
            prog.use += ['READLINE']
nedko's avatar
nedko committed
107
108
        prog.target = 'jack_transport'

sletz's avatar
sletz committed
109
    if bld.env['BUILD_EXAMPLE_CLIENT_REC']:
110
        prog = bld(features = 'c cprogram')
111
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
112
        prog.source = 'capture_client.c'
113
        prog.use = ['clientlib']
114
        if bld.env['IS_MACOSX']:
115
116
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
sletz's avatar
sletz committed
117
            prog.env.append_value("LINKFLAGS", "")
118
            prog.use += ['SNDFILE']
119
        if bld.env['IS_LINUX']:
120
            prog.use += ['RT', 'SNDFILE']
sletz's avatar
sletz committed
121
        if bld.env['IS_SUN']:
122
            prog.use += ['RT', 'SNDFILE']
farwayer's avatar
farwayer committed
123
        if bld.env['IS_WINDOWS']:
124
            prog.uselib = ['SNDFILE']
nedko's avatar
nedko committed
125
126
        prog.target = 'jack_rec'

sletz's avatar
sletz committed
127
    if bld.env['IS_LINUX'] or bld.env['IS_MACOSX']:
128
        prog = bld(features = 'c cprogram')
Robin Gareus's avatar
Robin Gareus committed
129
        prog.includes = os_incdir + ['.', '..', '../common/jack', '../common']
sletz's avatar
sletz committed
130
        prog.source = ['netsource.c', '../common/netjack_packet.c']
131
        prog.env.append_value("CFLAGS", "-DNO_JACK_ERROR")
Nedko Arnaudov's avatar
Nedko Arnaudov committed
132
        prog.use = ['CELT', 'SAMPLERATE', 'OPUS', 'M', 'clientlib']
sletz's avatar
sletz committed
133
        prog.target = 'jack_netsource'
134
        prog.defines = ['HAVE_CONFIG_H']
sletz's avatar
sletz committed
135
136

    if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']:
137
        prog = bld(features = 'c cprogram')
Adrian Knoth's avatar
Adrian Knoth committed
138
139
        prog.includes = os_incdir + ['../common/jack', '../common']
        prog.source = ['alsa_in.c', '../common/memops.c']
140
        prog.env.append_value("CFLAGS", "-DNO_JACK_ERROR")
141
        prog.use = ['clientlib', 'ALSA', 'SAMPLERATE', 'M']
Adrian Knoth's avatar
Adrian Knoth committed
142
143
        prog.target = 'alsa_in'

144
        prog = bld(features = 'c cprogram')
Adrian Knoth's avatar
Adrian Knoth committed
145
146
        prog.includes = os_incdir + ['../common/jack', '../common']
        prog.source = ['alsa_out.c', '../common/memops.c']
147
        prog.env.append_value("CFLAGS", "-DNO_JACK_ERROR")
148
        prog.use = ['clientlib', 'ALSA', 'SAMPLERATE', 'M']
Adrian Knoth's avatar
Adrian Knoth committed
149
        prog.target = 'alsa_out'
sletz's avatar
sletz committed
150

Adrian Knoth's avatar
Adrian Knoth committed
151
    for example_lib, example_lib_source in list(example_libs.items()):
152
        lib = bld(features = 'c cshlib')
153
154
        if not bld.env['IS_WINDOWS']:
            lib.env['cshlib_PATTERN'] = '%s.so'
155
        lib.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
156
157
        lib.target = example_lib
        lib.source = example_lib_source
158
        if bld.env['IS_MACOSX']:
159
160
            lib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc -arch x86_64")
            #lib.env.append_value("LINKFLAGS", "-arch i386 -arch ppc -arch x86_64")
sletz's avatar
sletz committed
161
            lib.env.append_value("LINKFLAGS", "")
sletz's avatar
sletz committed
162
        if bld.env['IS_SUN']:
Adrian Knoth's avatar
Adrian Knoth committed
163
            lib.env.append_value("LINKFLAGS", "-lm")
164
        lib.use = 'serverlib'
165
        lib.install_path = '${ADDON_DIR}/'
166

167
168
169
    if not bld.env['IS_WINDOWS']:
        bld.symlink_as('${PREFIX}/bin/jack_disconnect', 'jack_connect')
        bld.install_files('${PREFIX}/bin', 'jack_control', chmod=0o755)