/usr/bin/faust2android 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 | #!/bin/bash
#####################################################################
# #
# Compile a Faust program to an android app #
# (c) Romain Michon CCRMA and Grame, 2014 #
# (c) Yann Orlarey Grame, 2015 #
# #
#####################################################################
. /usr/share/faust/utils/faustpath
. /usr/share/faust/utils/faustoptflags
# change if you want to get the log of what's happening
LOG="/dev/null"
# exit if a command fails
set -e
# Global variables for file and options
FILE=
INSTALL=0
SOURCE=0
SWIG=0
FAUST=0
KEYBOARD=0
REUSE=0
# PHASE 2 : dispatch command arguments
for p in $@; do
if [ $p = "-swig" ]; then
SWIG=1
fi
if [[ -f "$p" ]]; then
FILE="$p"
elif [ $p = "-install" ]; then
INSTALL=1
elif [ $p = "-source" ]; then
SOURCE=1
elif [ $p = "-faust" ]; then
FAUST=1
elif [ $p = "-reuse" ]; then
REUSE=1
elif [ $p = "-keyboard" ]; then
KEYBOARD=1
elif [ $p = "-debug" ]; then
LOG="/dev/stdout"
elif [ "$p" = "-noagc" ]; then
NOAGC="1"
elif [ $p = "-h" ]; then
echo "Usage: faust2android faustFile.dsp"
echo "OPTIONS:"
echo "-install: once compilation is over, installs the generated app on the Android device connected to the computer."
echo "-source: creates an eclipse project of the app in the current directory."
echo "Any other options are considered as Faust options. To get a list of the Faust options type: faust -h."
echo "-swig: regenerate the C++ and the JAVA interface for the native portion of the app."
echo "-faust: only carries out the Faust compilation and install the generated C++ file in the JNI folder."
echo "-reuse: keep build directory and reuse it to speedup compilation."
echo "-debug: verbose output."
exit 1
elif [ ${p:0:1} = "-" ]; then
OPTIONS="$OPTIONS $p"
else
OPTIONS="$OPTIONS $p"
fi
done
# only carry out the faust compilation
if [ $FAUST -eq 1 ]; then
faust -i -a api/android/DspFaust.cpp $OPTIONS "$FILE" -o "app/src/main/cpp/DspFaust.cpp"
exit 1
fi
# Create the temporary directory where compilation will take place
APPNAME=$(basename "$FILE")
APPNAME="${APPNAME%.dsp}"
BUILDDIR="faustandro.$APPNAME"
APPFOLDER="$BUILDDIR/app/src/main"
JNIFOLDER="$APPFOLDER/cpp"
if [ $REUSE -eq 0 ]; then
if [ -d "$BUILDDIR" ]; then
echo "Delete existing Android project $BUILDDIR" > $LOG
rm -rf "$BUILDDIR"
fi
fi
if [ ! -d "$BUILDDIR" ]; then
echo "Creating new Android project $BUILDDIR" > $LOG
mkdir -p "$BUILDDIR"
cp -r $FAUSTLIB/android/* "$BUILDDIR"
install -d $JNIFOLDER
# Copy include files *.h if any (ignore any error here)
(cp *.h $JNIFOLDER 2> $LOG) || true
# change 'faust' with real *APPNAME
PLATFORM=$(uname)
if [ $PLATFORM = "Darwin" ]; then
sed -i '' 's,com.faust,com.'$APPNAME',g' $BUILDDIR/app/build.gradle
if [ "$NOAGC" = "1" ]; then
sed -i '' 's,-DDISABLE_AGC,'-DDISABLE_AGC',g' $BUILDDIR/app/build.gradle
else
sed -i '' 's,-DDISABLE_AGC,'',g' $BUILDDIR/app/build.gradle
fi
sed -i '' 's,com.faust,com.'$APPNAME',g' $APPFOLDER/java/com/faust/*
sed -i '' 's,com.faust,com.'$APPNAME',g' $APPFOLDER/java/com/triggertrap/seekarc/*
sed -i '' 's,com.faust,com.'$APPNAME',g' $APPFOLDER/AndroidManifest.xml
sed -i '' 's,com.faust,com.'$APPNAME',g' $APPFOLDER/res/layout/*
sed -i '' 's,1,'$APPNAME',g' $APPFOLDER/res/values/strings.xml
else
sed -i 's,com.faust,com.'$APPNAME',g' $BUILDDIR/app/build.gradle
if [ "$NOAGC" = "1" ]; then
sed -i 's,-DDISABLE_AGC,'-DDISABLE_AGC',g' $BUILDDIR/app/build.gradle
else
sed -i 's,-DDISABLE_AGC,'',g' $BUILDDIR/app/build.gradle
fi
sed -i 's,com.faust,com.'$APPNAME',g' $APPFOLDER/java/com/faust/*
sed -i 's,com.faust,com.'$APPNAME',g' $APPFOLDER/java/com/triggertrap/seekarc/*
sed -i 's,com.faust,com.'$APPNAME',g' $APPFOLDER/AndroidManifest.xml
sed -i 's,com.faust,com.'$APPNAME',g' $APPFOLDER/res/layout/*
sed -i 's,1,'$APPNAME',g' $APPFOLDER/res/values/strings.xml
fi
mv $APPFOLDER/java/com/faust $APPFOLDER/java/com/$APPNAME
# TODO wrong: should be checked
if [ $SWIG -eq 1 ]; then
rm -rf $APPFOLDER/java/com/dsp_faust || true
mkdir -p $APPFOLDER/java/com/dsp_faust
swig -java -package com.dsp_faust -includeall -verbose -outdir $APPFOLDER/java/com/dsp_faust -c++ -I$FAUSTINC -I/System/Library/Frameworks/JavaVM.framework/Headers -I$JNIFOLDER -o $JNIFOLDER/java_interface_wrap.cpp $BUILDDIR/dsp_faust_interface.i
fi
else
echo "Reusing existing Android project $BUILDDIR" > $LOG
fi
# Copying the Faust API files in the project
cp $FAUSTLIB/api/android/DspFaust.h $JNIFOLDER
cp $FAUSTLIB/api/android/jni/java_interface_wrap.cpp $JNIFOLDER
mkdir $APPFOLDER/java/com/DspFaust
cp $FAUSTLIB/api/android/jni/*.java $APPFOLDER/java/com/DspFaust
# Compile the Faust code for the NDK
faust -i -a api/android/DspFaust.cpp $OPTIONS "$FILE" -o "$JNIFOLDER/DspFaust.cpp" || exit
# Run Gradle
cd $BUILDDIR
./gradlew assembleRelease > $LOG
cd ..
cp -r $BUILDDIR/app/build/outputs/apk/app-release.apk $APPNAME.apk
# ****************
# TREAT OPTIONS
# ****************
if [ $INSTALL -eq 1 ]; then
adb install -r $APPNAME.apk
fi
if [ $SOURCE -eq 1 ]; then
rm -rf faustApp
mv $BUILDDIR faustApp
echo "An Android studio project named faustApp was created." > $LOG
else
if [ $REUSE -eq 0 ]; then
echo "Delete Android project $BUILDDIR" > $LOG
rm -rf $BUILDDIR
fi
fi
echo "$APPNAME.apk;"
|