summaryrefslogtreecommitdiff
path: root/audio/csound5/patches/patch-ac
blob: a35211bba5b06cb0db607da17014a8469cbea7c3 (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
$NetBSD: patch-ac,v 1.1.1.1 2006/05/21 22:46:22 ben Exp $

--- SConstruct.orig	2006-03-15 07:22:43.000000000 -0800
+++ SConstruct
@@ -50,6 +50,8 @@ def today():
 def getPlatform():
     if sys.platform[:5] == 'linux':
         return 'linux'
+    elif sys.platform[:6] == 'netbsd':
+        return 'netbsd'
     elif sys.platform[:3] == 'win':
         return 'mingw'
     elif sys.platform[:6] == 'darwin':
@@ -335,6 +337,15 @@ elif getPlatform() == 'mingw':
     pythonLinkFlags = []
     pythonLibraryPath = []
     pythonLibs = ['python%s' % commonEnvironment['pythonVersion'].replace('.', '')]
+elif getPlatform() == 'netbsd':
+    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 +496,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') and commonEnvironment['useDouble'] != '0':
     csoundLibraryName += '64'
 # flags for linking with the Csound library
 libCsoundLinkFlags = []
@@ -526,6 +537,12 @@ if commonEnvironment['buildRelease'] != 
             tmp += '64'
         s = '-DCS_DEFAULT_PLUGINDIR=\\"%s\\"' % tmp
         csoundLibraryEnvironment.Append(CPPFLAGS = [s])
+    if getPlatform() == 'netbsd':
+        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 +567,8 @@ 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'])
 csoundInterfacesEnvironment = csoundDynamicLibraryEnvironment.Copy()
 
 if buildOSXFramework:
@@ -989,7 +1008,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':
     makePlugin(pluginEnvironment, 'control', ['Opcodes/control.c'])
 makePlugin(pluginEnvironment, 'ftest', ['Opcodes/ftest.c'])
 makePlugin(pluginEnvironment, 'mixer', ['Opcodes/mixer.cpp'])
@@ -1042,6 +1061,9 @@ 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'])
     makePlugin(widgetsEnvironment, 'widgets',
                ['InOut/FL_graph.cpp', 'InOut/winFLTK.c', 'InOut/widgets.cpp'])
 
@@ -1082,6 +1104,8 @@ else:
     elif getPlatform() == 'mingw':
         portaudioEnvironment.Append(LIBS = ['winmm', 'dsound'])
         portaudioEnvironment.Append(LIBS = csoundWindowsLibraries)
+    elif getPlatform() == 'netbsd':
+        portaudioEnvironment.ParseConfig('pkg-config --cflags --libs portaudio-2.0')
     makePlugin(portaudioEnvironment, 'rtpa', ['InOut/rtpa.c'])
 
 if not (commonEnvironment['useJack'] == '1' and jackFound):
@@ -1118,7 +1142,7 @@ 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'])
     makePlugin(fluidEnvironment, 'fluidOpcodes',
                ['Opcodes/fluidOpcodes/fluidOpcodes.c'])
@@ -1237,6 +1261,13 @@ else:
         guiProgramEnvironment.Prepend(LINKFLAGS = ['-mwindows'])
         vstEnvironment.Append(LIBS = ['fltk_images', 'fltk'])
         guiProgramEnvironment.Append(LINKFLAGS = '-mwindows')
+    elif getPlatform() == 'netbsd':
+        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,7 +1451,7 @@ 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'])
     # This is the one that actually defines the opcodes.
     # They are straight wrappers, as simple as possible.
@@ -1443,6 +1474,8 @@ else:
     elif getPlatform() == 'mingw':
         pyEnvironment['ENV']['PATH'] = os.environ['PATH']
         pyEnvironment.Append(SHLINKFLAGS = '--no-export-all-symbols')
+    elif getPlatform() == 'netbsd':
+        pyEnvironment.Append(LIBS = ['m'])
     pythonOpcodes = makePlugin(pyEnvironment, 'py',
                                ['Opcodes/py/pythonopcodes.c'])
     if getPlatform() == 'mingw' and pythonLibs[0] < 'python24':
@@ -1461,7 +1494,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':
         pdClass = pdClassEnvironment.SharedLibrary(
             'csoundapi~.pd_linux',
             'frontends/csoundapi_tilde/csoundapi_tilde.c',
@@ -1493,6 +1526,8 @@ 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() == 'mingw':
         csTclEnvironment.Append(LIBS = ['tcl84', 'tk84'])
         csTclEnvironment.Append(LIBS = csoundWindowsLibraries)
@@ -1591,18 +1626,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',