Debian Codegraph @

tools/faust2appls/faust2dplug

raw symbols SCIP
1 #! /bin/bash -e
2
3 #####################################################################
4 # #
5 # Compiles Faust programs to Dplug plugin #
6 # (c) Grame, 2020 #
7 # #
8 #####################################################################
9
10 . faustpath
11 . faustoptflags
12 . usage.sh
13
14 DEBUG=false
15
16 # MIDI not yet supported in this file. Needs to be connected in dplug.d architecture file
17 IS_MIDI="0"
18 VENDOR="Faust"
19 VENDORID="FaUs"
20 PLUGINID="PlUg"
21 HOMEPAGE="https://faust.grame.fr/"
22 EFFECTTYPE="effectOther"
23
24 echoHelp()
25 {
26 usage faust2dplug "[options] [Faust options] <file.dsp>"
27 require Dplug
28 echo "Compiles Faust programs to Dplug plugins"
29 option
30 options "-vendor <My Company Name>"
31 options "-vendorid <FaUs>"
32 options "-pluginid <PlUg>"
33 options "-homepage <https://faust.grame.fr/>"
34 options "-effectType <effectDynamics>"
35 option "Faust options"
36 exit
37 }
38
39 if [ "$#" -eq 0 ]; then
40 echo 'Please, provide a Faust file to process !'
41 echo ''
42 echoHelp
43 fi
44
45 while [ $1 ]
46 do
47 p=$1
48
49 if [ $p = "--help" ] || [ $p = "-help" ] || [ $p = "-h" ]; then
50 echoHelp
51 elif [ "$p" = -debug ]; then
52 DEBUG=true
53 elif [ $p = "-midi" ]; then
54 IS_MIDI="1"
55 elif [ $p = "-vendor" ]; then
56 shift
57 VENDOR=$1
58 elif [ $p = "-vendorid" ]; then
59 shift
60 VENDORID=$1
61 elif [ $p = "-pluginid" ]; then
62 shift
63 PLUGINID=$1
64 elif [ $p = "-homepage" ]; then
65 shift
66 HOMEPAGE=$1
67 elif [ $p = "-effectType" ]; then
68 shift
69 EFFECTTYPE=$1
70 elif [[ -f "$p" ]]; then
71 FILES="$FILES $p"
72 else
73 OPTIONS="$OPTIONS $p"
74 fi
75
76 shift
77
78 done
79
80 if [ $IS_MIDI -eq 1 ]; then
81 echo "MIDI not currently supported in Dplug architecture file."
82 exit
83 fi
84
85 DUBFILE="dub.json"
86 PLUGFILE="plugin.json"
87
88 for p in $FILES; do
89 CUR=$(pwd)
90 f=$(basename "$p")
91 SRCDIR=$(dirname "$p")
92
93 # creates the dir
94 dspName="${f%.dsp}"
95 SUB_TYPE=$(shasum $p)
96 SUB_TYPE=${SUB_TYPE:0:4}
97 rm -rf "$SRCDIR/$dspName"
98 mkdir $SRCDIR/$dspName
99 mkdir $SRCDIR/$dspName/source
100
101 sed -e"s?@vendor@?$VENDOR?g" -e"s?@vendorid@?$VENDORID?g" -e"s?@name@?$dspName?g" -e"s?@plugid@?$PLUGINID?g" -e"s?@homepage@?$HOMEPAGE?g" -e"s?@effecttype@?$EFFECTTYPE?g" > $SRCDIR/$dspName/$PLUGFILE <<EOF
102 {
103 "\$schema": "https://raw.githubusercontent.com/AuburnSounds/dplug/master/plugin-schema.json",
104
105 "vendorName": "@vendor@",
106 "vendorUniqueID": "@vendorid@",
107 "vendorSupportEmail": "[email protected]",
108 "pluginName": "@name@",
109 "pluginHomepage": "@homepage@",
110 "pluginUniqueID": "@plugid@",
111 "publicVersion": "1.0.0",
112 "CFBundleIdentifierPrefix": "com.@vendorid@",
113 "hasGUI": false,
114 "isSynth": false,
115 "receivesMIDI": false,
116 "category": "@effecttype@"
117 }
118 EOF
119
120 sed -e"s?@name@?$dspName?g" > $SRCDIR/$dspName/$DUBFILE <<EOF
121 {
122 "\$schema": "https://raw.githubusercontent.com/Pure-D/code-d/master/json-validation/dub.schema.json",
123
124 "name": "@name@",
125
126 "license": "public domain",
127 "importPaths": [ "." ],
128 "sourcePaths": [ "." ],
129 "stringImportPaths": ["gfx", "fonts", "."],
130
131 "copyright": "none",
132
133 "dflags-linux-dmd": ["-defaultlib=libphobos2.a"],
134 "dflags-osx-ldc": ["-static"],
135 "dflags-linux-ldc": ["-link-defaultlib-shared=false"],
136 "dflags-linux-x86_64-ldc": ["-fvisibility=hidden"],
137 "dflags-windows-ldc": ["-mscrtlib=libcmt"],
138
139 "comment-WARNING-READ-THIS-IS-IMPORTANT": [
140 " When making your own plug-in you have to CHANGE THESE DEPENDENCY ",
141 " SPECIFICATIONS below from path-based to ~>MAJOR.MINOR ",
142 " Example: ~>7.0 ",
143 " See also the DUB documentation: ",
144 " https://code.dlang.org/package-format?lang=json#version-specs "],
145 "dependencies":
146 {
147 "dplug:dsp": "~>10",
148 "dplug:vst3": "~>10",
149 "dplug:vst": "~>10",
150 "dplug:au": "~>10",
151 "dplug:lv2": "~>10",
152 "dplug:gui": "~>10",
153 "dplug:pbr-widgets": "~>10"
154 },
155
156 "versions": ["futureMouseOver", "futurePBRNormals"],
157
158 "configurations": [
159 {
160 "name": "VST3",
161 "versions": ["VST3"],
162 "targetType": "dynamicLibrary",
163 "lflags-osx-ldc": [ "-exported_symbols_list", "module-vst3.lst", "-dead_strip" ]
164 },
165 {
166 "name": "VST",
167 "versions": ["VST"],
168 "targetType": "dynamicLibrary",
169 "lflags-osx-ldc": [ "-exported_symbols_list", "module-vst.lst", "-dead_strip" ]
170 },
171 {
172 "name": "AU",
173 "versions": ["AU"],
174 "targetType": "dynamicLibrary",
175 "lflags-osx-ldc": [ "-exported_symbols_list", "module-au.lst", "-dead_strip" ]
176 },
177 {
178 "name": "LV2",
179 "versions": ["LV2"],
180 "targetType": "dynamicLibrary",
181 "lflags-osx-ldc": [ "-exported_symbols_list", "module-lv2.lst", "-dead_strip" ]
182 }
183 ]
184 }
185 EOF
186
187 cat > $SRCDIR/$dspName/module-au.lst << EndOfFile
188 _dplugAUEntryPoint
189 _dplugAUComponentFactoryFunction
190
191 EndOfFile
192
193 cat > $SRCDIR/$dspName/module-lv2.lst << EndOfFile
194 _GenerateManifestFromClient
195 _lv2_descriptor
196 _lv2ui_descriptor
197
198 EndOfFile
199
200 cat > $SRCDIR/$dspName/module-vst3.lst << EndOfFile
201 _InitDll
202 _ExitDll
203 _GetPluginFactory
204 _bundleEntry
205 _bundleExit
206
207 EndOfFile
208
209 faust -i -lang dlang -a $FAUSTARCH/dplug.d $OPTIONS "$SRCDIR/$f" -o "$SRCDIR/$dspName/source/main.d"
210
211 done