| 1 | #!/bin/bash |
| 2 | |
| 3 | . usage.sh |
| 4 | |
| 5 | #USAGE : faustremote <servurl> ==> <targets> |
| 6 | #USAGE : faustremote [<servurl>] <platform> <arch> <srcfile> ==> <binary.zip> |
| 7 | |
| 8 | #URL="https://faustservicecloud.grame.fr" |
| 9 | URL="https://faustservice.inria.fr" |
| 10 | |
| 11 | function targetrequest { |
| 12 | echo "Server URL:" $1 |
| 13 | curl "$1/targets" |
| 14 | } |
| 15 | |
| 16 | function compilation { |
| 17 | curl -F"file=@\"$4\";filename=\"$4\"" "$1/compile/$2/$3/binary.zip" --output binary.zip |
| 18 | } |
| 19 | |
| 20 | if [ "$1" == "-h" ]; then |
| 21 | echo "Access the remote compilation service to compile DSP programs" |
| 22 | echo "Usage: faustremote [<servurl>] [<platform> <arch> <srcfile>]" |
| 23 | echo "faustremote <servurl> ==> <targets>" |
| 24 | echo "faustremote <servurl> <platform> <arch> <srcfile> ==> <binary.zip>" |
| 25 | echo "When no <servurl> is defined, the default GRAME Faust URL service is used" |
| 26 | elif [ "$#" == "0" ]; then |
| 27 | targetrequest "$URL" |
| 28 | elif [ "$#" == "1" ]; then |
| 29 | targetrequest "$1" |
| 30 | elif [ "$#" == "3" ]; then |
| 31 | if [ -f "$3" ]; then |
| 32 | rm -rf binary.zip |
| 33 | compilation $URL $1 $2 $3 |
| 34 | else |
| 35 | echo "ERROR: file $3 doesn't exist" |
| 36 | exit 1 |
| 37 | fi |
| 38 | elif [ "$#" == "4" ]; then |
| 39 | if [ -f "$4" ]; then |
| 40 | rm -rf binary.zip |
| 41 | compilation $1 $2 $3 $4 |
| 42 | else |
| 43 | echo "ERROR: file $4 doesn't exist" |
| 44 | exit 1 |
| 45 | fi |
| 46 | fi |
| 47 |