wscript 6.76 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
18
#! /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_showtime' : 'showtime.c',
    'jack_alias' : 'alias.c',
    'jack_bufsize' : 'bufsize.c',
sletz's avatar
sletz committed
19
20
    'jack_wait' : 'wait.c',
    'jack_samplerate' : 'samplerate.c',
nedko's avatar
nedko committed
21
22
    'jack_evmon' : 'evmon.c',
    'jack_monitor_client' : 'monitor_client.c',
23
    'jack_thru' : 'thru_client.c',
sletz's avatar
sletz committed
24
    'jack_cpu_load' : 'cpu_load.c',
sletz's avatar
sletz committed
25
26
    'jack_simple_session_client' : 'simple_session_client.c',
    'jack_session_notify' : 'session_notify.c',
27
    'jack_server_control' : 'server_control.cpp',
28
29
    'jack_net_slave' : 'netslave.c',
    'jack_net_master' : 'netmaster.c',
sletz's avatar
sletz committed
30
31
    'jack_latent_client' : 'latent_client.c',
    'jack_midi_dump' : 'midi_dump.c',
sletz's avatar
sletz committed
32
    'jack_midi_latency_test' : 'midi_latency_test.c'
nedko's avatar
nedko committed
33
34
35
36
37
38
39
    }

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

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

Adrian Knoth's avatar
Adrian Knoth committed
45
    conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs', mandatory=False)
sletz's avatar
sletz committed
46

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

sletz's avatar
sletz committed
49
50
51
    # 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
52

sletz's avatar
sletz committed
53
    conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = bool(conf.env['LIB_READLINE']) and bool(conf.env['LIB_NCURSES'])
nedko's avatar
nedko committed
54

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

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

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

80
        prog = bld(features='c cprogram')
81
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
82
        prog.source = example_program_source
83
        prog.use = use
84
        if bld.env['IS_MACOSX']:
85
86
            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
87
            prog.env.append_value("LINKFLAGS", "")
88
        if bld.env['IS_LINUX']:
89
            prog.use += ['RT']
90
            prog.env.append_value("LINKFLAGS", "-lm")
sletz's avatar
sletz committed
91
92
        if bld.env['IS_SUN']:
            prog.env.append_value("LINKFLAGS", "-lm")
93

nedko's avatar
nedko committed
94
        prog.target = example_program
95
   
sletz's avatar
sletz committed
96
    if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT']:
97
        prog = bld(features = 'c cprogram')
98
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
99
        prog.source = 'transport.c'
100
        prog.use = ['clientlib']
101
        if bld.env['IS_MACOSX']:
102
103
            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
104
            prog.env.append_value("LINKFLAGS", "")
105
        if bld.env['IS_LINUX']:
106
            prog.use += ['RT', 'READLINE', 'NCURSES']
107
        if bld.env['IS_MACOSX']:
108
            prog.use += ['READLINE', 'NCURSES']
nedko's avatar
nedko committed
109
110
        prog.target = 'jack_transport'

sletz's avatar
sletz committed
111
    if bld.env['BUILD_EXAMPLE_CLIENT_REC']:
112
        prog = bld(features = 'c cprogram')
113
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
114
        prog.source = 'capture_client.c'
115
        prog.use = ['clientlib']
116
        if bld.env['IS_MACOSX']:
117
118
            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
119
            prog.env.append_value("LINKFLAGS", "")
120
            prog.use += ['SNDFILE']
121
        if bld.env['IS_LINUX']:
122
            prog.use += ['RT', 'SNDFILE']
sletz's avatar
sletz committed
123
        if bld.env['IS_SUN']:
124
            prog.use += ['RT', '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')
sletz's avatar
sletz committed
129
130
        prog.includes = os_incdir + ['../common/jack', '../common']
        prog.source = ['netsource.c', '../common/netjack_packet.c']
131
        prog.env.append_value("CFLAGS", "-DNO_JACK_ERROR")
132
        prog.use = ['CELT', 'SAMPLERATE']
133
        prog.use = ['clientlib']
sletz's avatar
sletz committed
134
135
136
        prog.target = 'jack_netsource'

    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
140
        prog.includes = os_incdir + ['../common/jack', '../common']
        prog.source = ['alsa_in.c', '../common/memops.c']
        prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
141
        prog.use = ['clientlib', 'ALSA', 'SAMPLERATE']
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
147
        prog.includes = os_incdir + ['../common/jack', '../common']
        prog.source = ['alsa_out.c', '../common/memops.c']
        prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
148
        prog.use = ['clientlib', 'ALSA', 'SAMPLERATE']
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')
Adrian Knoth's avatar
Adrian Knoth committed
153
        lib.env['cshlib_PATTERN'] = '%s.so'
154
        lib.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
155
156
        lib.target = example_lib
        lib.source = example_lib_source
157
        if bld.env['IS_MACOSX']:
158
159
            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
160
            lib.env.append_value("LINKFLAGS", "")
sletz's avatar
sletz committed
161
        if bld.env['IS_SUN']:
Adrian Knoth's avatar
Adrian Knoth committed
162
            lib.env.append_value("LINKFLAGS", "-lm")
163
        lib.use = 'serverlib'
164
        lib.install_path = '${ADDON_DIR}/'
165

166
    bld.symlink_as('${PREFIX}/bin/jack_disconnect', 'jack_connect')
nedko's avatar
nedko committed
167

Adrian Knoth's avatar
Adrian Knoth committed
168
    bld.install_files('${PREFIX}/bin', 'jack_control', chmod=0o755)