/usr/bin/faust2au 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 | #!/bin/sh
#####################################################################
#
#				Compiles Faust programs to Audio Unit
#				(c) Grame 2013
#
#####################################################################
PATH=$PATH:/usr/local/bin
#-------------------------------------------------------------------------------
# Search where Faust is installed. Store '.../share/faust/' in $FLIB
# and '.../include/(faust)' in $FINC
FLIB=""; FINC="";
FPATH="$FAUST_INSTALL /usr/local /usr /opt /opt/local"; # <- where to search
for f in $FPATH; do
	if [ -e $f/share/faust ]; then
		FLIB=$f/share/faust;
	fi
	if [ -e $f/include/faust ]; then
		FINC=$f/include/;
	fi
done
if [ -z $ARCHPATH ]; then
	ARCHPATH=$FLIB
fi
if [ -z "$FLIB" -o -z "$FINC" ]; then
	echo "ERROR : $0 cannot find Faust directories (normally /usr/local/include/faust and /usr/local/share/faust)";
	exit 1;
fi
#-------------------------------------------------------------------------------
#PHASE 1 : collects files and options from the command line
DEBUG=0
MANUFACTURER="Grame"
for p in $@; do
	if [ "$p" = -omp ]; then
		if [[ $CXX == "icpc" ]]; then
			OMP="-openmp"
		else
			OMP="-fopenmp"
		fi
	fi
	if [ "$p" = -debug ]; then
		DEBUG=1
	elif [ "$p" = -icc ]; then
		ignore=" "
	elif [ $p = "-osc" ]; then
		OSCDEFS="DEFINES += OSCCTRL"
		OSCLIBS="-lOSCFaust"
	elif [ "$p" = "-httpd" ]; then
		HTTPDEFS="DEFINES += HTTPCTRL"
		HTTPLIBS="-lHTTPDFaust -lmicrohttpd"
	elif [ $p = "-manufacturer" ]; then
		$MANUFACTURER=$p
	elif [ ${p:0:1} = "-" ]; then
		OPTIONS="$OPTIONS $p"
	elif [[ -f "$p" ]]; then
		FILES="$FILES $p"
	else
		OPTIONS="$OPTIONS $p"
	fi
done
if [ $DEBUG -eq 1 ]; then
	PRINTDEV=/dev/tty
else
	PRINTDEV=/dev/null
fi
#-------------------------------------------------------------------------------
#PHASE 2 : compile the *.dsp files
for f in $FILES; do
	# could use FILES for handling multiple dap files, while other AU args like manufacturer and subtype should be handled in a way
	# Get the number of inputs of the Faust code:
    LINPUTS=$(faust -uim "$f" | grep FAUST_INPUTS)
    NINPUTS=${LINPUTS//[^0-9]/}
	# echo "Number of Faust module inputs = $NINPUTS"
	if [ $NINPUTS -gt 0 ]; then
		echo "Generating an AU Effect plugin..."
		ARCHFILE="au-effect.cpp"
		AUTYPE=aufx
		FAUSTAU_CLASS=FaustAUEffect
		COMPTYPE=kAudioUnitType_Effect
	else
		echo "Generating an AU Instrument plugin..."
		ARCHFILE="au-instrument.cpp"
		AUTYPE=aumu
		FAUSTAU_CLASS=FaustAUInstrument
		COMPTYPE=kAudioUnitType_MusicDevice
	fi
	export ARCHFILE
	export AUTYPE
	export FAUSTAU_CLASS
	export COMPTYPE
	AU_DIR=$HOME/Library/Audio/Plug-Ins/Components
	TEMP_DIR=`dirname $f`/faustAUtmp.`basename $f`
	if [ -d $TEMP_DIR ]; then
		rm -r $TEMP_DIR
	fi
	mkdir $TEMP_DIR
	cp -r $ARCHPATH/AU/* $TEMP_DIR
	cp $f $TEMP_DIR
	cp *.dsp $TEMP_DIR >& $PRINTDEV
	cp *.lib $TEMP_DIR >& $PRINTDEV
	cd $TEMP_DIR
	mkdir Source >& $PRINTDEV
	FULL_FILE_NAME=$f
	FILE_NAME=$(BASENAME "$FULL_FILE_NAME")
	EXTENSION="${FILE_NAME##*.}"
	FILE_NAME="${FILE_NAME%.*}"
	cp $ARCHPATH/$ARCHFILE au-arch-temp.cpp
	perl -pi -e 's/FaustAU_CustomViewFactory/'FaustAU_"$FILE_NAME"CustomViewFactory'/g' au-arch-temp.cpp
	perl -pi -e 's/FaustAU_CustomViewFactory/'FaustAU_"$FILE_NAME"CustomViewFactory'/g' FaustAUCustomView.plist
    faust $OPTIONS -a au-arch-temp.cpp $f -o Source/au-output.cpp || exit 1
	rm au-arch-temp.cpp
	faust $OPTIONS -xml $f > $PRINTDEV
	mv $f.xml Source/au-output.xml
	if [ ! -f Source/au-output.cpp ]; then
		echo FAUST could not generate cpp file
		cd ..
		rm -r $TEMP_DIR
		exit 1
	fi
	NAME=$MANUFACTURER:' '"$FILE_NAME"
	SUB_TYPE=$(echo ${FILE_NAME:0:4} | tr [[:upper:]] [[:lower:]])
	MANF=${MANUFACTURER:0:4}
	perl -pi -e 's/_NAME_/'"$NAME"'/g' Info.plist
	perl -pi -e 's/_DESC_/'"$NAME"'/g' Info.plist
	perl -pi -e 's/_STYP_/'"$SUB_TYPE"'/g'	Info.plist
	perl -pi -e 's/_MANF_/'"$MANF"'/g' Info.plist
	perl -pi -e 's/_BUNDLE_ID_/'"$FILE_NAME"'/g' Info.plist
	perl -pi -e 's/_TYPE_/'"$AUTYPE"'/g' Info.plist
	perl -pi -e 's/_BUNDLE_NAME_/'"$FILE_NAME"'/g' English.lproj/InfoPlist.strings
	perl -pi -e 's/_BUNDLE_INFO_/'"$NAME"'/g' English.lproj/InfoPlist.strings
	perl -pi -e 's/_NAME_/'"$NAME"'/g' Source/AUSource/FaustAU.r
	perl -pi -e 's/_DESC_/'"$NAME"'/g' Source/AUSource/FaustAU.r
	perl -pi -e 's/_COMPTYPE_/'"$COMPTYPE"'/g' Source/AUSource/FaustAU.r
	perl -pi -e 's/_FaustAUClass_/'"$FAUSTAU_CLASS"'/g' Source/AUSource/FaustAU.h
	perl -pi -e 's/_STYP_/'"$SUB_TYPE"'/g' Source/AUSource/FaustAUVersion.h
	perl -pi -e 's/_MANF_/'"$MANF"'/g' Source/AUSource/FaustAUVersion.h
	perl -pi -e 's/_FILENAME_/'"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_CustomView.m
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_CustomView.h
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_CustomView.m
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_CustomViewFactory.h
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_CustomViewFactory.m
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Bargraph.h
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Bargraph.m
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Button.h
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Button.m
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Knob.h
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Knob.m
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Slider.h
	perl -pi -e 's/FaustAU_/'FaustAU_"$FILE_NAME"'/g' Source/CocoaUI/FaustAU_Slider.m
	perl -pi -e 's/FaustAU_CustomView.h/'FaustAU_"$FILE_NAME"CustomView.h'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_CustomView.m/'FaustAU_"$FILE_NAME"CustomView.m'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_CustomViewFactory.h/'FaustAU_"$FILE_NAME"CustomViewFactory.h'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_CustomViewFactory.m/'FaustAU_"$FILE_NAME"CustomViewFactory.m'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Knob.h/'FaustAU_"$FILE_NAME"Knob.h'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Knob.m/'FaustAU_"$FILE_NAME"Knob.m'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Button.h/'FaustAU_"$FILE_NAME"Button.h'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Button.m/'FaustAU_"$FILE_NAME"Button.m'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Slider.h/'FaustAU_"$FILE_NAME"Slider.h'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Slider.m/'FaustAU_"$FILE_NAME"Slider.m'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Bargraph.h/'FaustAU_"$FILE_NAME"Bargraph.h'/g' FaustAU.xcodeproj/project.pbxproj
	perl -pi -e 's/FaustAU_Bargraph.m/'FaustAU_"$FILE_NAME"Bargraph.m'/g' FaustAU.xcodeproj/project.pbxproj
	mv Source/CocoaUI/FaustAU_CustomView.h Source/CocoaUI/FaustAU_"$FILE_NAME"CustomView.h
	mv Source/CocoaUI/FaustAU_CustomView.m Source/CocoaUI/FaustAU_"$FILE_NAME"CustomView.m
	mv Source/CocoaUI/FaustAU_CustomViewFactory.h Source/CocoaUI/FaustAU_"$FILE_NAME"CustomViewFactory.h
	mv Source/CocoaUI/FaustAU_CustomViewFactory.m Source/CocoaUI/FaustAU_"$FILE_NAME"CustomViewFactory.m
	mv Source/CocoaUI/FaustAU_Bargraph.h Source/CocoaUI/FaustAU_"$FILE_NAME"Bargraph.h
	mv Source/CocoaUI/FaustAU_Bargraph.m Source/CocoaUI/FaustAU_"$FILE_NAME"Bargraph.m
	mv Source/CocoaUI/FaustAU_Button.h Source/CocoaUI/FaustAU_"$FILE_NAME"Button.h
	mv Source/CocoaUI/FaustAU_Button.m Source/CocoaUI/FaustAU_"$FILE_NAME"Button.m
	mv Source/CocoaUI/FaustAU_Knob.h Source/CocoaUI/FaustAU_"$FILE_NAME"Knob.h
	mv Source/CocoaUI/FaustAU_Knob.m Source/CocoaUI/FaustAU_"$FILE_NAME"Knob.m
	mv Source/CocoaUI/FaustAU_Slider.h Source/CocoaUI/FaustAU_"$FILE_NAME"Slider.h
	mv Source/CocoaUI/FaustAU_Slider.m Source/CocoaUI/FaustAU_"$FILE_NAME"Slider.m
    xcodebuild ARCHS="i386 x86_64" HEADER_SEARCH_PATHS=$FINC CONFIGURATION_BUILD_DIR=$HOME/Library/Audio/Plug-Ins/Components > $PRINTDEV > ./build_errors.log || exit 1
	if [ ! -d $AU_DIR/FaustAU.component/ ]
	then
	echo Unable to generate Audio Unit
		cd ..
		if [ $DEBUG -eq 0 ]; then
		  rm -r $TEMP_DIR
		fi
	    exit 1
	fi
	if [ -d $AU_DIR/"$FILE_NAME".component/ ]
	then
		if [ $DEBUG -eq 0 ]; then
		rm -r  $AU_DIR/"$FILE_NAME".component/
		fi
	fi
	mv $AU_DIR/FaustAU.component $AU_DIR/"$FILE_NAME".component
	if [ -d $AU_DIR/FaustAUCustomView.bundle/ ]
	then
		rm -r  $AU_DIR/FaustAUCustomView.bundle/
	fi
	cd ..
	if [ $DEBUG -eq 0 ]; then
	rm -r $TEMP_DIR
	fi
	echo "'$NAME'" Audio Unit generated and installed successfully
	if [ $DEBUG -eq 1 ]; then
		echo "See $TEMP_DIR for build products"
	fi
done
 |