wscript 6.51 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',
Torben Hohn's avatar
Torben Hohn committed
19
    'jack_wait' : 'wait.c',
20
    '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',
25
    'jack_server_control' : 'server_control.cpp',
nedko's avatar
nedko committed
26
27
28
29
30
31
32
    }

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

def configure(conf):
33
34
    e = conf.check_cc(header_name='sndfile.h', define_name="HAVE_SNDFILE")
 
35
36
37
38
39
    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
40
41
42
    if conf.is_defined('HAVE_SNDFILE'):
        conf.env['LIB_SNDFILE'] = ['sndfile']

43
44
    conf.check_cfg(package='celt', atleast_version='0.5.0', args='--cflags --libs')

45
    e = conf.check_cc(header_name='ncurses.h', define_name="HAVE_NCURSES")
nedko's avatar
nedko committed
46
47
48
49

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

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

52
53
    if conf.is_defined('HAVE_READLINE'):
        conf.env['LIB_READLINE'] = ['readline']
nedko's avatar
nedko committed
54
55
56

    conf.env['BUILD_EXAMPLE_CLIENT_TRANSPORT'] = conf.is_defined('HAVE_READLINE') and conf.is_defined('HAVE_NCURSES')

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

59
60
    conf.env['BUILD_EXAMPLE_ALSA_IO'] = conf.is_defined('HAVE_SAMPLERATE')

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

102
    if bld.env['BUILD_EXAMPLE_CLIENT_REC']:
103
        prog = bld.new_task_gen('cc', 'program')
104
        prog.includes = os_incdir + ['../common/jack', '../common']
nedko's avatar
nedko committed
105
        prog.source = 'capture_client.c'
106
        if bld.env['IS_MACOSX']:
107
            prog.env.append_value("CPPFLAGS", "-mmacosx-version-min=10.4 -arch i386 -arch ppc")
sletz's avatar
sletz committed
108
109
            #prog.env.append_value("LINKFLAGS", "-arch i386 -arch ppc")
            prog.env.append_value("LINKFLAGS", "")
sletz's avatar
sletz committed
110
            prog.uselib = 'SNDFILE'
111
        if bld.env['IS_LINUX']:
sletz's avatar
sletz committed
112
            prog.uselib = 'RT SNDFILE'
sletz's avatar
sletz committed
113
114
        if bld.env['IS_SUN']:
            prog.uselib = 'RT SNDFILE'
nedko's avatar
nedko committed
115
116
117
        prog.uselib_local = 'clientlib'
        prog.target = 'jack_rec'

118
119
120
121
122
    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")
nedko's avatar
nedko committed
123
124
125
126
127
128
        # Seems uneeded here...
        #if bld.env['HAVE_CELT']:
	    #if bld.env['HAVE_CELT_API_0_5']:
	    #    prog.defines = ['HAVE_CELT', 'HAVE_CELT_API_0_5']
	    #elif bld.env['HAVE_CELT_API_0_7']:
	    #    prog.defines = ['HAVE_CELT', 'HAVE_CELT_API_0_7']
129
130
131
        prog.uselib = 'CELT SAMPLERATE'
        prog.uselib_local = 'clientlib'
        prog.target = 'jack_netsource'
Torben Hohn's avatar
Torben Hohn committed
132

133
    if bld.env['IS_LINUX'] and bld.env['BUILD_EXAMPLE_ALSA_IO']:
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	    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'
Torben Hohn's avatar
Torben Hohn committed
149

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

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

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