/usr/bin/faust2faustvst is in faust 0.9.95~repack1-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | #! /bin/bash
#set -x
# Check for some common locations of the VST SDK files. This falls back to
# /usr/local/src/vstsdk if none of these are found. In that case, or if make
# picks the wrong location, you can also set the SDK variable explicitly.
#SDK=/usr/local/src/vstsdk
# Note that the paths to be searched are listed in reverse order here, so that
# the preferred path comes *last*.
sdkpaths='/usr/src/VST* /usr/src/vst* /usr/include/VST* /usr/include/vst* /opt/local/src/VST* /opt/local/src/vst* /opt/local/include/VST* /opt/local/include/vst* /usr/local/src/VST* /usr/local/src/vst* /usr/local/include/VST* /usr/local/include/vst*'
# This should hopefully work on *BSD, Linux and Mac OSX.
[ -z "$SDK" ] && SDK=$(ls -f -d $sdkpaths 2>/dev/null | tail -n 1)
[ -z "$SDK" ] && SDK=/usr/local/src/vstsdk
# SDKSRC should point to the SDK source files (vstplugmain.cpp et al).
# Usually these are either directly under $SDK or in the
# public.sdk/source/vst2.x subdirectory.
[ -z "$SDKSRC" -a -f "$SDK/vstplugmain.cpp" ] && SDKSRC="$SDK"
[ -z "$SDKSRC" -a -f "$SDK/public.sdk/source/vst2.x/vstplugmain.cpp" ] && SDKSRC="$SDK/public.sdk/source/vst2.x"
[ -z "$SDKSRC" ] && SDKSRC="$SDK/public.sdk/source/vst2.x"
# Default qmake setup (for GUI compilation). This requires Qt4 or Qt5 (Qt5 is
# preferred). We try to locate the qmake executable in some common locations
# here. If this doesn't work out then you can also set the QMAKE environment
# variable explicitly, or use one of the -qt4 and -qt5 options below.
[ -z "$QMAKE" ] && QMAKE=$(which qmake-qt5 || which /opt/local/libexec/qt5/bin/qmake || which qmake-qt4 || which /opt/local/libexec/qt4/bin/qmake || echo qmake)
# Where the Faust includes live. We assume that this is under the prefix of
# whatever Faust binary 'which' locates. You can also specify this explicitly
# by setting the FAUSTINC environment variable accordingly.
[ -z "$FAUSTINC" ] && FAUSTINC=$(which faust 2>/dev/null | sed -e 's?/bin/faust?/include/faust?')
# Where our own Faust library files are. This may be under a different prefix
# or not installed anywhere. We try 'ls' on faustvstqt.h in some common
# locations here, and fall back to the current directory if the file isn't
# found, so that you can run the script from the faust-vst source
# directory. You can also specify this explicitly by setting the FAUSTLIB
# environment variable accordingly.
[ -z "$FAUSTLIB" ] && FAUSTLIB=$(dirname "$((ls -f /usr/share/faust/faustvstqt.h /usr/local/share/faust/faustvstqt.h /opt/local/share/faust/faustvstqt.h "$PWD/faustvstqt.h" 2>/dev/null)|tail -1)")
[ -z "$FAUSTLIB" ] && FAUSTLIB="$PWD"
# defaults (these can be changed with the options listed below)
FAUST_META=1
FAUST_MIDICC=1
FAUST_MTS=1
FAUST_UI=0
VOICE_CTRLS=1
NVOICES=-1
KEEP="no"
STYLE=""
PROCARCH="-fPIC"
dllext=".so"
CXXFLAGS="-O3 -march=native -mfpmath=sse -msse -msse2 -msse3 -ffast-math -ftree-vectorize"
# Darwin-specific
ARCH="-arch i386 -arch x86_64"
if [[ $(uname) == Darwin ]]; then
CXXFLAGS="-O3 $ARCH -mfpmath=sse -msse -msse2 -msse3 -ffast-math -ftree-vectorize -I/opt/local/include"
dllext=".vst"
fi
# dispatch command arguments
for ((i=1;i<$#+1;i++)); do
p=${!i}
if [ $p = "-help" ] || [ $p = "-h" ]; then
cat <<EOF
faust2faustvst [options ...] <file.dsp>
Options:
-gui: build the plugin GUI
-httpd: activate HTTP control (add -qrcode to activate QR code generation)
-keep: retain the build directory
-nometa: ignore metadata (author information etc.) from the Faust source
-nomidicc: plugin doesn't process MIDI control data
-notuning: disable the tuning control (instruments only)
-novoicectrls: no extra polyphony/tuning controls on GUI (instruments only)
-nvoices N: number of synth voices (instruments only; arg must be an integer)
-osc: activate OSC control
-qt4, -qt5: select the GUI toolkit (requires Qt4/5; implies -gui)
-style S: select the stylesheet (arg must be Default, Blue, Grey or Salmon)
Environment variables:
FAUSTINC: specify the location of the Faust include directory
Default: $FAUSTINC
FAUSTLIB: specify the location of the Faust VST library files
Default: $FAUSTLIB
QMAKE: specify the location of the qmake binary
Default: $QMAKE
SDK: specify the location of the VST SDK
Default: $SDK
SDKSRC: specify the location of the VST SDK sources
Default: $SDKSRC
EOF
exit 0
elif [ $p = "-omp" ]; then
: ignore
elif [ $p = "-icc" ]; then
CXX=icpc
CXXFLAGS="-O3 -xHost -ftz -fno-alias -fp-model fast=2"
elif [ $p = "-osc" ]; then
OSCDEFS="DEFINES += OSCCTRL"
OSCLIBS="-lOSCFaust"
elif [ $p = "-httpd" ]; then
HTTPDEFS="DEFINES += HTTPCTRL"
HTTPLIBS="-lHTTPDFaust -lmicrohttpd -lqrencode"
elif [ $p = "-qrcode" ]; then # requires -httpd
QRDEFS="DEFINES += QRCODECTRL"
elif [ $p = "-nometa" ]; then
FAUST_META=0
elif [ $p = "-nomidicc" ]; then
FAUST_MIDICC=0
elif [ $p = "-notuning" ]; then
FAUST_MTS=0
elif [ $p = "-novoicectrls" ]; then
VOICE_CTRLS=0
elif [ $p = "-gui" ]; then
FAUST_UI=1
plugin_gui=yes
elif [ $p = "-qt4" ]; then
FAUST_UI=1
plugin_gui=yes
QMAKE=$(which qmake-qt4 || which /opt/local/libexec/qt4/bin/qmake || echo qmake-qt4)
elif [ $p = "-qt5" ]; then
FAUST_UI=1
plugin_gui=yes
QMAKE=$(which qmake-qt5 || which /opt/local/libexec/qt5/bin/qmake || echo qmake-qt5)
elif [ $p = "-nvoices" ]; then
(( i++ ))
NVOICES=${!i}
elif [ $p = "-arch32" ]; then
PROCARCH="-m32 -L/usr/lib32"
elif [ $p = "-arch64" ]; then
PROCARCH="-m64 -fPIC"
elif [ $p = "-osx" ]; then
CXXFLAGS="-O3 $ARCH -mfpmath=sse -msse -msse2 -msse3 -ffast-math -ftree-vectorize -I/opt/local/include"
dllext=".vst"
elif [ $p = "-keep" ]; then
KEEP="yes"
elif [ $p = "-style" ]; then
(( i++ ))
STYLE=${!i}
elif [ ${p:0:1} = "-" ]; then
OPTIONS="$OPTIONS $p"
elif [[ -f "$p" ]]; then
FILES="$FILES $p"
else
OPTIONS="$OPTIONS $p"
fi
done
FILES=( $FILES )
if [ ${#FILES[@]} = 0 ]; then
echo "$0: no filename specified" >&2
exit 1
elif [ ${#FILES[@]} -gt 1 ]; then
echo "$0: multiple filenames specified" >&2
exit 1
fi
# Check to see whether the required include and library files are where we
# expect them, and bail out with an error message otherwise.
if [ ! -f "$FAUSTINC/gui/faustqt.h" ]; then echo "$0: faust include files not found" >&2; exit 1; fi
if [ ! -f "$FAUSTLIB/faustvstqt.h" ]; then echo "$0: faust-vst library files not found" >&2; exit 1; fi
# Determine the Qt version so that we can pick the needed compilation options.
QTVERSION=$($QMAKE -v 2>/dev/null | tail -1 | sed 's/.*Qt version \([0-9]\).*/\1/')
QTEXTRA=
if [ $QTVERSION = 5 ]; then
QTEXTRA=x11extras
fi
arch=faustvst.cpp
dspname=${FILES[0]}
SRCDIR=$(dirname "$dspname")
ABSDIR=$(cd $SRCDIR && pwd)
CURDIR=$(pwd)
clsname=`basename "$dspname" .dsp`
cppname="$clsname.cpp"
soname="$clsname$dllext"
tmpdir=`mktemp -d /tmp/faust2faustvst.XXXXXX`
RESOURCES=
STYLE_CXXFLAGS=
if [ -n "$STYLE" ]; then
RESOURCES="RESOURCES+=$FAUSTINC/gui/Styles/$STYLE.qrc"
STYLE_CXXFLAGS="QMAKE_CXXFLAGS+=-DSTYLE=\"$STYLE\""
fi
CXX=g++
CPPFLAGS="-DFAUST_META=$FAUST_META -DFAUST_MIDICC=$FAUST_MIDICC -DFAUST_MTS=$FAUST_MTS -DFAUST_UI=$FAUST_UI -DVOICE_CTRLS=$VOICE_CTRLS -I$SDK -I$SDKSRC -D__cdecl="
if [ $NVOICES -ge 0 ]; then
CPPFLAGS="$CPPFLAGS -DNVOICES=$NVOICES"
fi
# Extra SDK modules needed to build a working plugin.
main=vstplugmain.cpp
afx=audioeffect.cpp
afxx=audioeffectx.cpp
sdksrc="$SDKSRC/$main $SDKSRC/$afx $SDKSRC/$afxx"
# Uncomment this to have Faust substitute the proper class name into the C++
# code. NOTE: This requires that the basename of the dsp file is a valid C
# identifier, which isn't guaranteed, so we disable this by default.
#OPTIONS="$OPTIONS -cn \"$clsname\""
# Create the temp directory.
mkdir -p $tmpdir
#trap "echo $0: compile error, intermediate files left in $tmpdir >&2" EXIT
# Compile the Faust module.
faust -i -a "$FAUSTLIB/$arch" $OPTIONS "$dspname" -o "$tmpdir/$cppname" || exit 1
if [ -n "$plugin_gui" ]; then
# We have to use qmake here.
# XXXTODO: OSX support
(
cd "$tmpdir"
$QMAKE -project -t lib -o ${clsname}.pro "CONFIG += gui plugin no_plugin_name_prefix warn_off" "QT += widgets printsupport network $QTEXTRA" "INCLUDEPATH+=$ABSDIR" "INCLUDEPATH+=$CURDIR" "INCLUDEPATH+=$FAUSTLIB" "INCLUDEPATH+=$FAUSTINC" "QMAKE_CXXFLAGS=$CPPFLAGS" $STYLE_CXXFLAGS "LIBS+=$ARCHLIB $OSCLIBS $HTTPLIBS" "SOURCES+=$SDKSRC/$main $SDKSRC/$afx $SDKSRC/$afxx" "HEADERS+=$FAUSTLIB/faustvstqt.h $FAUSTINC/gui/faustqt.h" $RESOURCES "$OSCDEFS" "$HTTPDEFS" "$QRDEFS"
$QMAKE *.pro
make
) > /dev/null || exit 1
else
if [[ $(uname) == Darwin ]]; then
mkdir -p $tmpdir/$soname/Contents/MacOS
printf '%s' 'BNDL????' > $tmpdir/$soname/Contents/PkgInfo
sed -e "s?@name@?$clsname?g;s?@version@?1.0.0?g" > $tmpdir/$soname/Contents/Info.plist <<EOF
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>@name@</string>
<key>CFBundleIdentifier</key>
<string>@name@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>@name@</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>@version@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@version@</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>
EOF
$CXX -bundle $CXXFLAGS $FAUSTTOOLSFLAGS $PROCARCH $CPPFLAGS $sdksrc "$tmpdir/$cppname" -o "$tmpdir/$soname/Contents/MacOS/$clsname" || exit 1
else
$CXX -shared $CXXFLAGS $FAUSTTOOLSFLAGS $PROCARCH $CPPFLAGS $sdksrc "$tmpdir/$cppname" -o "$tmpdir/$soname" || exit 1
fi
fi
#trap - EXIT
# copy down the plugin (bundle on OS X)
rm -rf "$SRCDIR/$soname"
cp -r "$tmpdir/$soname" "$SRCDIR"
if [[ $KEEP == yes ]]; then
# keep the build directory
rm -rf "$SRCDIR/$clsname"
mv $tmpdir "$SRCDIR/$clsname"
else
# Clean up.
rm -rf $tmpdir
fi
# Print the name of the generated plugin.
echo "$SRCDIR/$soname;"
|