11#! /usr/bin/env bash
22
3- # set -x
3+ set -eou pipefail
44
55# Default qmake setup (for GUI compilation). This requires Qt5. If qmake-qt5 or
66# qmake can not be located in PATH, you can also set the QMAKE environment
77# variable explicitly, or use the -qt5 option below.
8- [ -z " $QMAKE " ] && QMAKE=$( command -v qmake-qt5 || command -v qmake)
8+ [ -z " ${ QMAKE:- } " ] && QMAKE=$( command -v qmake-qt5 || command -v qmake)
99
1010# Where the Faust includes live. We assume that this is under the prefix of
1111# whatever Faust binary 'which' locates. You can also specify this explicitly
1212# by setting the FAUSTINC environment variable accordingly.
13- [ -z " $FAUSTINC " ] && FAUSTINC=$( command -v faust 2> /dev/null | sed -e ' s?/bin/faust?/include/faust?' )
13+ [ -z " ${ FAUSTINC:- } " ] && FAUSTINC=$( command -v faust 2> /dev/null | sed -e ' s?/bin/faust?/include/faust?' )
1414
1515# Where our own Faust library files are. This may be under a different prefix
1616# or not installed anywhere. We try 'ls' on lv2ui.cpp in some common locations
1717# here, and fall back to the current directory if the file isn't found, so
1818# that you can run the script from the faust-lv2 source directory. You can
1919# also specify this explicitly by setting the FAUSTLIB environment variable
2020# accordingly.
21- [ -z " $FAUSTLIB " ] && FAUSTLIB=" $( dirname " $(( ls - f / usr/ share/ faust/ lv2 ui.cpp / usr/ local/ share/ faust/ lv2 ui.cpp / opt/ local/ share/ faust/ lv2 ui.cpp "$PWD / lv2 ui.cpp" 2 >/ dev/ null) | tail - 1 )")"
22- [ -z "$FAUSTLIB " ] && FAUSTLIB="$PWD "
21+ [ -z " ${ FAUSTLIB:- } " ] && FAUSTLIB=" $( dirname " $(( ls - f / usr/ share/ faust/ lv2 ui.cpp / usr/ local/ share/ faust/ lv2 ui.cpp / opt/ local/ share/ faust/ lv2 ui.cpp "$PWD / lv2 ui.cpp" 2 >/ dev/ null) | tail - 1 )")"
22+ [ -z "${ FAUSTLIB:- } " ] && FAUSTLIB= "$PWD "
2323
2424# defaults (these can be changed with the options listed below)
2525URI_PREFIX=https://faustlv2 .bitbucket.io
@@ -149,7 +149,6 @@ if [ ! -f "$FAUSTLIB/lv2ui.cpp" ]; then echo "$0: faust-lv2 library files not fo
149149arch=lv2.cpp
150150archui=lv2ui.cpp
151151dspname=" ${FILES[0]} "
152- echo " dspname: $dspname "
153152SRCDIR=$( dirname " $dspname " )
154153ABSDIR=$( cd " $SRCDIR " && pwd)
155154CURDIR=$( pwd)
@@ -186,13 +185,13 @@ else
186185 faust -i -a " $FAUSTLIB /$arch " -cn " $clsname " " $dspname " -o " $tmpdir /$cppname " || exit 1
187186fi
188187
189- if [ -n " $FAUSTTOOLSFLAGS " ]; then
190- " $CXX " -shared " ${CXXFLAGS[@]} " -DDLLEXT=" \" $dllext \" " " $FAUSTTOOLSFLAGS " " $PROCARCH " -I" $ABSDIR " " ${CPPFLAGS[@]} " " $tmpdir /$cppname " -o " $tmpdir /$lv2name /$soname " || exit 1
188+ if [ -n " ${ FAUSTTOOLSFLAGS:- } " ]; then
189+ " $CXX " -shared " ${CXXFLAGS[@]} " -DDLLEXT=" \" $dllext \" " " ${ FAUSTTOOLSFLAGS:- } " " $PROCARCH " -I" $ABSDIR " " ${CPPFLAGS[@]} " " $tmpdir /$cppname " -o " $tmpdir /$lv2name /$soname " || exit 1
191190else
192191 " $CXX " -shared " ${CXXFLAGS[@]} " -DDLLEXT=" \" $dllext \" " " $PROCARCH " -I" $ABSDIR " " ${CPPFLAGS[@]} " " $tmpdir /$cppname " -o " $tmpdir /$lv2name /$soname " || exit 1
193192fi
194193
195- if [ -n " $plugin_gui " ]; then
194+ if [ -n " ${ plugin_gui:- } " ]; then
196195# Compile the UI module.
197196mkdir -p " $uitmpdir "
198197 if [ " ${# OPTIONS[@]} " -gt 0 ]; then
@@ -210,9 +209,9 @@ mkdir -p "$uitmpdir"
210209fi
211210# Generate the manifest. There are four different variations of the manifest,
212211# depending on whether dynamic manifests and the plugin gui is enabled or not.
213- if [ -n " $dyn_manifest " ]; then
212+ if [ -n " ${ dyn_manifest:- } " ]; then
214213# Use a dynamic manifest.
215- if [ -n " $plugin_gui " ]; then
214+ if [ -n " ${ plugin_gui:- } " ]; then
216215sed -e" s? @name@? $clsname ? g" -e" s? @uri@? $URI_PREFIX /$clsname ? g" -e" s? @dllext@? $dllext ? g" > " $tmpdir /$lv2name /manifest.ttl" <<EOF
217216
218217########## @uri@ ##########
288287fi
289288else
290289# Use a static manifest.
291- if [ -n " $plugin_gui " ]; then
290+ if [ -n " ${ plugin_gui:- } " ]; then
292291sed -e" s? @name@? $clsname ? g" -e" s? @uri@? $URI_PREFIX /$clsname ? g" -e" s? @dllext@? $dllext ? g" > " $tmpdir /$lv2name /manifest.ttl" <<EOF
293292
294293########## @uri@ ##########
366365fi
367366# This compiles the plugin to an executable which is run to generate the
368367# plugin-specific part of the manifest.
369- if [ -n " $FAUSTTOOLSFLAGS " ]; then
370- " $CXX " " ${CXXFLAGS[@]} " -DDLLEXT=" \" $dllext \" " " $FAUSTTOOLSFLAGS " -I" $ABSDIR " " ${CPPFLAGS[@]} " " $tmpdir /$cppname " -o " $tmpdir /$clsname " || exit 1
368+ if [ -n " ${ FAUSTTOOLSFLAGS:- } " ]; then
369+ " $CXX " " ${CXXFLAGS[@]} " -DDLLEXT=" \" $dllext \" " " ${ FAUSTTOOLSFLAGS:- } " -I" $ABSDIR " " ${CPPFLAGS[@]} " " $tmpdir /$cppname " -o " $tmpdir /$clsname " || exit 1
371370else
372371 " $CXX " " ${CXXFLAGS[@]} " -DDLLEXT=" \" $dllext \" " -I" $ABSDIR " " ${CPPFLAGS[@]} " " $tmpdir /$cppname " -o " $tmpdir /$clsname " || exit 1
373372fi
0 commit comments