wscript 6.89 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")
 
sletz's avatar
sletz committed
42
43
44
45
46
    conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
   
    if conf.is_defined('HAVE_SAMPLERATE'):
        conf.env['LIB_SAMPLERATE'] = ['samplerate']

nedko's avatar
nedko committed
47
48
49
    if conf.is_defined('HAVE_SNDFILE'):
        conf.env['LIB_SNDFILE'] = ['sndfile']

sletz's avatar
sletz committed
50
51
    conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs')

52
    e = conf.check_cc(header_name='ncurses.h', define_name="HAVE_NCURSES")
nedko's avatar
nedko committed
53
54
55
56

    if conf.is_defined('HAVE_NCURSES'):
        conf.env['LIB_NCURSES'] = ['ncurses']

57
    e = conf.check_cc(lib='readline', define_name="HAVE_READLINE")
nedko's avatar
nedko committed
58

sletz's avatar
sletz committed
59
60
61
    # 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
62

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

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

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

nedko's avatar
nedko committed
69
def build(bld):
70
    if bld.env['IS_LINUX']:
71
        os_incdir = ['../linux', '../posix']
72
    if bld.env['IS_MACOSX']:
73
        os_incdir = ['../macosx', '../posix']
sletz's avatar
sletz committed
74
75
    if bld.env['IS_SUN']:
        os_incdir = ['../solaris', '../posix']
nedko's avatar
nedko committed
76
    for example_program, example_program_source in example_programs.items():
77
        prog = bld.new_task_gen('cxx', 'program')
78
        prog.features.append('cc')
79
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
80
        prog.source = example_program_source
81
        if bld.env['IS_MACOSX']:
82
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
83
84
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
            prog.env.append_value("LINKFLAGS", "")
85
        if bld.env['IS_LINUX']:
sletz's avatar
sletz committed
86
            prog.uselib = 'RT'
sletz's avatar
sletz committed
87
88
        if bld.env['IS_SUN']:
            prog.env.append_value("LINKFLAGS", "-lm")
89
90
        if example_program == 'jack_server_control':
            prog.uselib_local = 'serverlib'
91
92
93
94
        elif example_program == 'jack_net_slave':
            prog.uselib_local = 'netlib'
	elif example_program == 'jack_net_master':
            prog.uselib_local = 'netlib'
95
        else:
96
97
            prog.uselib_local = 'clientlib' 
                     
nedko's avatar
nedko committed
98
        prog.target = example_program
99
   
sletz's avatar
sletz committed
100
    if bld.env['BUILD_EXAMPLE_CLIENT_TRANSPORT']:
101
        prog = bld.new_task_gen('cc', 'program')
102
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
103
        prog.source = 'transport.c'
104
        if bld.env['IS_MACOSX']:
105
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
106
107
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
            prog.env.append_value("LINKFLAGS", "")
108
        if bld.env['IS_LINUX']:
sletz's avatar
sletz committed
109
            prog.uselib = 'RT READLINE NCURSES'
110
        if bld.env['IS_MACOSX']:
sletz's avatar
sletz committed
111
	    prog.uselib = 'READLINE NCURSES'
nedko's avatar
nedko committed
112
113
114
        prog.uselib_local = 'clientlib'
        prog.target = 'jack_transport'

sletz's avatar
sletz committed
115
    if bld.env['BUILD_EXAMPLE_CLIENT_REC']:
116
        prog = bld.new_task_gen('cc', 'program')
117
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
118
        prog.source = 'capture_client.c'
119
        if bld.env['IS_MACOSX']:
120
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
121
122
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
            prog.env.append_value("LINKFLAGS", "")
sletz's avatar
sletz committed
123
            prog.uselib = 'SNDFILE'
124
        if bld.env['IS_LINUX']:
sletz's avatar
sletz committed
125
            prog.uselib = 'RT SNDFILE'
sletz's avatar
sletz committed
126
127
        if bld.env['IS_SUN']:
            prog.uselib = 'RT SNDFILE'
nedko's avatar
nedko committed
128
129
130
        prog.uselib_local = 'clientlib'
        prog.target = 'jack_rec'

sletz's avatar
sletz committed
131
132
133
134
135
136
137
138
139
140
    if bld.env['IS_LINUX'] or bld.env['IS_MACOSX']:
        prog = bld.new_task_gen('cc', 'program')
        prog.includes = os_incdir + ['../common/jack', '../common']
        prog.source = ['netsource.c', '../common/netjack_packet.c']
        prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
        prog.uselib = 'CELT SAMPLERATE'
        prog.uselib_local = 'clientlib'
        prog.target = 'jack_netsource'

    if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']:
sletz's avatar
sletz committed
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
 	    prog = bld.new_task_gen('cc', 'program')
 	    prog.includes = os_incdir + ['../common/jack', '../common']
 	    prog.source = ['alsa_in.c', '../common/memops.c']
 	    prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
 	    prog.uselib = 'ALSA SAMPLERATE'
 	    prog.uselib_local = 'clientlib'
 	    prog.target = 'alsa_in'

 	    prog = bld.new_task_gen('cc', 'program')
 	    prog.includes = os_incdir + ['../common/jack', '../common']
 	    prog.source = ['alsa_out.c', '../common/memops.c']
 	    prog.env.append_value("CCFLAGS", "-DNO_JACK_ERROR")
 	    prog.uselib = 'ALSA SAMPLERATE'
 	    prog.uselib_local = 'clientlib'
 	    prog.target = 'alsa_out'
sletz's avatar
sletz committed
156

nedko's avatar
nedko committed
157
    for example_lib, example_lib_source in example_libs.items():
158
        lib = bld.new_task_gen('cc', 'shlib')
nedko's avatar
nedko committed
159
        lib.env['shlib_PATTERN'] = '%s.so'
160
        lib.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
161
162
        lib.target = example_lib
        lib.source = example_lib_source
163
        if bld.env['IS_MACOSX']:
164
            lib.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
165
166
            #lib.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
            lib.env.append_value("LINKFLAGS", "")
sletz's avatar
sletz committed
167
168
        if bld.env['IS_SUN']:
	        lib.env.append_value("LINKFLAGS", "-lm")
sletz's avatar
sletz committed
169
        lib.uselib_local = 'serverlib'
170
        lib.install_path = '${ADDON_DIR}/'
171

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

174
    bld.install_files('${PREFIX}/bin', 'jack_control', chmod=0755)