summaryrefslogtreecommitdiff
path: root/audio/csound5/patches/patch-ac
blob: acabeabb2e213ed2f5d9690beff9d10cc0e1b25b (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
$NetBSD: patch-ac,v 1.2 2006/05/29 19:44:24 joerg Exp $

--- SConstruct.orig	2006-03-15 15:22:43.000000000 +0000
+++ SConstruct
@@ -50,6 +50,10 @@ def today():
 def getPlatform():
     if sys.platform[:5] == 'linux':
         return 'linux'
+    elif sys.platform[:6] == 'netbsd':
+        return 'netbsd'
+    elif sys.platform[:9] == 'dragonfly':
+        return 'dragonfly'
     elif sys.platform[:3] == 'win':
         return 'mingw'
     elif sys.platform[:6] == 'darwin':
@@ -335,6 +339,15 @@ elif getPlatform() == 'mingw':
     pythonLinkFlags = []
     pythonLibraryPath = []
     pythonLibs = ['python%s' % commonEnvironment['pythonVersion'].replace('.', '')]
+elif getPlatform() == 'netbsd' or getPlatform() == 'dragonfly':
+    commonEnvironment.Append(CCFLAGS = Split(os.environ['CFLAGS']))
+    commonEnvironment.Append(CXXFLAGS = Split(os.environ['CXXFLAGS']))
+    commonEnvironment.Append(LINKFLAGS = Split(os.environ['LDFLAGS']))
+    pythonIncludePath = []
+    pythonLinkFlags = []
+    pythonLibraryPath = []
+    pythonLibs = []
+    SConsignFile("/dev/null")
 
 # Check for prerequisites.
 # We check only for headers; checking for libs may fail
@@ -485,7 +498,7 @@ def buildzip(env, target, source):
 # library version is CS_VERSION.CS_APIVERSION
 csoundLibraryVersion = '5.1'
 csoundLibraryName = 'csound'
-if getPlatform() == 'linux' and commonEnvironment['useDouble'] != '0':
+if (getPlatform() == 'linux' or getPlatform() == 'netbsd' or getPlatform() == 'dragonfly') and commonEnvironment['useDouble'] != '0':
     csoundLibraryName += '64'
 # flags for linking with the Csound library
 libCsoundLinkFlags = []
@@ -526,6 +539,12 @@ if commonEnvironment['buildRelease'] != 
             tmp += '64'
         s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp
         csoundLibraryEnvironment.Append(CPPFLAGS = [s])
+    if getPlatform() == 'netbsd' or getPlatform() == 'dragonfly':
+        tmp = '%s/lib/csound5/plugins' % commonEnvironment['prefix']
+        if commonEnvironment['useDouble'] != '0':
+            tmp += '64'
+        s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp
+        csoundLibraryEnvironment.Append(CPPFLAGS = [s])
 csoundDynamicLibraryEnvironment = csoundLibraryEnvironment.Copy()
 csoundDynamicLibraryEnvironment.Append(LIBS = ['sndfile'])
 if getPlatform() == 'mingw':
@@ -550,6 +569,11 @@ if getPlatform() == 'mingw':
     csoundDynamicLibraryEnvironment['ENV']['PATH'] = os.environ['PATH']
 elif getPlatform() == 'linux':
     csoundDynamicLibraryEnvironment.Append(LIBS = ['dl', 'm', 'pthread'])
+elif getPlatform() == 'netbsd':
+    csoundDynamicLibraryEnvironment.Append(LIBS = ['m', 'pthread'])
+elif getPlatform() == 'dragonfly':
+    csoundDynamicLibraryEnvironment.Append(LINKFLAGS = ['-pthread'])
+    csoundDynamicLibraryEnvironment.Append(LIBS = ['m'])
 csoundInterfacesEnvironment = csoundDynamicLibraryEnvironment.Copy()
 
 if buildOSXFramework:
@@ -776,9 +800,17 @@ else:
         csoundProgramEnvironment.Append(LIBS = ['dl'])
         vstEnvironment.Append(LIBS = ['dl'])
         guiProgramEnvironment.Append(LIBS = ['dl'])
-    csoundProgramEnvironment.Append(LIBS = ['pthread', 'm'])
-    vstEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
-    guiProgramEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
+    if getPlatform() == 'dragonfly':
+	csoundProgramEnvironment.Append(LIBS = ['m'])
+	csoundProgramEnvironment.Append(LINKFLAGS = ['-pthread'])
+        vstEnvironment.Append(LIBS = ['stdc++', 'm'])
+        vstEnvironment.Append(LINKFLAGS = ['-pthread'])
+        guiProgramEnvironment.Append(LIBS = ['stdc++', 'm'])
+        guiProgramEnvironment.Append(LINKFLAGS = ['-pthread'])
+    else:
+	csoundProgramEnvironment.Append(LIBS = ['pthread', 'm'])
+        vstEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
+        guiProgramEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
     if getPlatform() == 'darwin':
         csoundProgramEnvironment.Append(LINKFLAGS = Split('''
             -framework Carbon -framework CoreAudio -framework CoreMidi
@@ -989,7 +1021,7 @@ makePlugin(pluginEnvironment, 'stdopcod'
 pluginLibraries.append('opcodes.dir')
 MacOSX_InstallPlugin('opcodes.dir')
 
-if getPlatform() == 'linux' or getPlatform() == 'darwin':
+if getPlatform() == 'linux' or getPlatform() == 'darwin' or getPlatform == 'netbsd' or getPlatform == 'dragonfly':
     makePlugin(pluginEnvironment, 'control', ['Opcodes/control.c'])
 makePlugin(pluginEnvironment, 'ftest', ['Opcodes/ftest.c'])
 makePlugin(pluginEnvironment, 'mixer', ['Opcodes/mixer.cpp'])
@@ -1042,6 +1074,13 @@ else:
             -framework Carbon -framework CoreAudio -framework CoreMidi
             -framework ApplicationServices
         '''))
+    elif getPlatform() == 'netbsd':
+        widgetsEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
+        widgetsEnvironment.Append(LIBS = ['stdc++', 'pthread', 'm'])
+    elif getPlatform() == 'dragonfly':
+        widgetsEnvironment.ParseConfig('fltk-config --use-images --cflags --cxxflags --ldflags')
+        widgetsEnvironment.Append(LIBS = ['stdc++', 'm'])
+        widgetsEnvironment.Append(LINKFLAGS = ['-pthread'])
     makePlugin(widgetsEnvironment, 'widgets',
                ['InOut/FL_graph.cpp', 'InOut/winFLTK.c', 'InOut/widgets.cpp'])
 
@@ -1060,7 +1099,11 @@ if not (commonEnvironment['useALSA'] == 
 else:
     print "CONFIGURATION DECISION: Building ALSA plugin."
     alsaEnvironment = pluginEnvironment.Copy()
-    alsaEnvironment.Append(LIBS = ['asound', 'pthread'])
+    if getPlatform() == 'dragonfly':
+        alsaEnvironment.Append(LIBS = ['asound'])
+        alsaEnvironment.Append(LINKFLAGS = ['-pthread'])
+    else:
+        alsaEnvironment.Append(LIBS = ['asound', 'pthread'])
     makePlugin(alsaEnvironment, 'rtalsa', ['InOut/rtalsa.c'])
 
 if getPlatform() == 'mingw':
@@ -1082,6 +1125,8 @@ else:
     elif getPlatform() == 'mingw':
         portaudioEnvironment.Append(LIBS = ['winmm', 'dsound'])
         portaudioEnvironment.Append(LIBS = csoundWindowsLibraries)
+    elif getPlatform() == 'netbsd' or getPlatform() == 'dragonfly':
+        portaudioEnvironment.ParseConfig('pkg-config --cflags --libs portaudio-2.0')
     makePlugin(portaudioEnvironment, 'rtpa', ['InOut/rtpa.c'])
 
 if not (commonEnvironment['useJack'] == '1' and jackFound):
@@ -1091,6 +1136,9 @@ else:
     jackEnvironment = pluginEnvironment.Copy()
     if getPlatform() == 'linux':
         jackEnvironment.Append(LIBS = ['jack', 'asound', 'pthread'])
+    elif getPlatform() == 'dragonfly':
+        jackEnvironment.Append(LIBS = ['jack'])
+        jackEnvironment.Append(LINKFLAGS = ['-pthread'])
     else:
         jackEnvironment.Append(LIBS = ['jack', 'pthread'])
     makePlugin(jackEnvironment, 'rtjack', ['InOut/rtjack.c'])
@@ -1100,7 +1148,11 @@ if not (commonEnvironment['useOSC'] == '
 else:
     print "CONFIGURATION DECISION: Building OSC plugin."
     oscEnvironment = pluginEnvironment.Copy()
-    oscEnvironment.Append(LIBS = ['lo', 'pthread'])
+    if getPlatform() == 'dragonfly':
+        oscEnvironment.Append(LIBS = ['lo'])
+        oscEnvironment.Append(LINKFLAGS = ['-pthread'])
+    else:
+        oscEnvironment.Append(LIBS = ['lo', 'pthread'])
     if getPlatform() == 'mingw':
         oscEnvironment.Append(LIBS = csoundWindowsLibraries)
         oscEnvironment.Append(SHLINKFLAGS = ['-Wl,--enable-stdcall-fixup'])
@@ -1118,8 +1170,10 @@ else:
         fluidEnvironment.Append(CPPFLAGS = ['-DFLUIDSYNTH_NOT_A_DLL'])
         fluidEnvironment.Append(LIBS = ['winmm', 'dsound'])
         fluidEnvironment.Append(LIBS = csoundWindowsLibraries)
-    elif getPlatform() == 'linux' or getPlatform() == 'darwin':
+    elif getPlatform() == 'linux' or getPlatform() == 'darwin' or getPlatform() == 'netbsd':
         fluidEnvironment.Append(LIBS = ['pthread'])
+    elif getPlatform() == 'dragonfly':
+        fluidEnvironment.Append(LINKFLAGS = ['-pthread'])
     makePlugin(fluidEnvironment, 'fluidOpcodes',
                ['Opcodes/fluidOpcodes/fluidOpcodes.c'])
 
@@ -1237,6 +1291,13 @@ else:
         guiProgramEnvironment.Prepend(LINKFLAGS = ['-mwindows'])
         vstEnvironment.Append(LIBS = ['fltk_images', 'fltk'])
         guiProgramEnvironment.Append(LINKFLAGS = '-mwindows')
+    elif getPlatform() == 'netbsd' or getPlatform() == 'dragonfly':
+        vstEnvironment.Append(LIBS = ['m'])
+        vstEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
+        vstEnvironment.Append(LINKFLAGS = ['-Wl,-rpath-link,.'])
+        guiProgramEnvironment.Prepend(LINKFLAGS = ['-Wl,-rpath-link,.'])
+        os.spawnvp(os.P_WAIT, 'rm', ['rm', '-f', '_CsoundVST.so'])
+        os.symlink('lib_CsoundVST.so', '_CsoundVST.so')
     guiProgramEnvironment.Prepend(LIBS = ['_CsoundVST'])
     for option in vstEnvironment['CCFLAGS']:
         if string.find(option, '-D') == 0:
@@ -1420,8 +1481,10 @@ else:
         stkEnvironment.Append(LIBS = ['stdc++'])
     if getPlatform() == 'mingw':
         stkEnvironment.Append(LIBS = csoundWindowsLibraries)
-    elif getPlatform() == 'linux' or getPlatform() == 'darwin':
+    elif getPlatform() == 'linux' or getPlatform() == 'darwin' or getPlatform() == 'netbsd':
         stkEnvironment.Append(LIBS = ['pthread'])
+    elif getPlatform() == 'dragonfly':
+        stkEnvironment.Append(LINKFLAGS = ['-pthread'])
     # This is the one that actually defines the opcodes.
     # They are straight wrappers, as simple as possible.
     stk = makePlugin(stkEnvironment, 'stk', ['Opcodes/stk/stkOpcodes.cpp'])
@@ -1443,6 +1506,8 @@ else:
     elif getPlatform() == 'mingw':
         pyEnvironment['ENV']['PATH'] = os.environ['PATH']
         pyEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
+    elif getPlatform() == 'netbsd' or getPlatform() == 'dragonfly':
+        pyEnvironment.Append(LIBS = ['m'])
     pythonOpcodes = makePlugin(pyEnvironment, 'py',
                                ['Opcodes/py/pythonopcodes.c'])
     if getPlatform() == 'mingw' and pythonLibs[0] < 'python24':
@@ -1461,7 +1526,7 @@ if commonEnvironment['buildPDClass']=='1
         pdClass = pdClassEnvironment.Program(
             'csoundapi~.pd_darwin',
             'frontends/csoundapi_tilde/csoundapi_tilde.c')
-    elif getPlatform() == 'linux':
+    elif getPlatform() == 'linux' or getPlatform() == 'netbsd' or getPlatform() == 'dragonfly':
         pdClass = pdClassEnvironment.SharedLibrary(
             'csoundapi~.pd_linux',
             'frontends/csoundapi_tilde/csoundapi_tilde.c',
@@ -1493,6 +1558,11 @@ if commonEnvironment['buildTclcsound'] =
         '''))
     elif getPlatform() == 'linux':
         csTclEnvironment.Append(LIBS = ['tcl8.4', 'tk8.4', 'dl', 'pthread'])
+    elif getPlatform() == 'netbsd':
+        csTclEnvironment.Append(LIBS = ['tcl8.4', 'tk8.4', 'pthread'])
+    elif getPlatform() == 'dragonfly':
+        csTclEnvironment.Append(LIBS = ['tcl8.4', 'tk8.4'])
+        csTclEnvironment.Append(LINKFLAGS = ['-pthread'])
     elif getPlatform() == 'mingw':
         csTclEnvironment.Append(LIBS = ['tcl84', 'tk84'])
         csTclEnvironment.Append(LIBS = csoundWindowsLibraries)
@@ -1591,18 +1661,18 @@ else:
 
 PREFIX = commonEnvironment['prefix']
 
-BIN_DIR = PREFIX + "/bin"
-INCLUDE_DIR = PREFIX + "/include/csound"
+BIN_DIR = PREFIX + "/lib/csound5"
+INCLUDE_DIR = PREFIX + "/include/csound5"
 
 if (commonEnvironment['Word64'] == '1'):
-    LIB_DIR = PREFIX + "/lib64"
+    LIB_DIR = PREFIX + "/lib64/csound5"
 else:
-    LIB_DIR = PREFIX + "/lib"
+    LIB_DIR = PREFIX + "/lib/csound5"
 
 if commonEnvironment['useDouble'] == '0':
-    PLUGIN_DIR = LIB_DIR + "/csound/plugins"
+    PLUGIN_DIR = LIB_DIR + "/plugins"
 else:
-    PLUGIN_DIR = LIB_DIR + "/csound/plugins64"
+    PLUGIN_DIR = LIB_DIR + "/plugins"
 
 if commonEnvironment['install'] == '1':
     installExecutables = Alias('install-executables',