giuliomoro@425: #!/bin/sh giuliomoro@238: # giuliomoro@377: # This script compiles a Bela project on the BeagleBone Black and giuliomoro@238: # optionally runs it. Pass a directory path in the first argument. giuliomoro@238: # The source files in this directory are copied to the board and compiled. giuliomoro@238: giuliomoro@238: BBB_ADDRESS="root@192.168.7.2" giuliomoro@377: BBB_LIBPD_EXECUTABLE_PATH="~/libpd/Bela" giuliomoro@238: BBB_LIBPD_PROJECT_PATH="~/libpd/source/" giuliomoro@238: RUN_PROJECT=1 giuliomoro@238: COMMAND_ARGS= giuliomoro@238: RUN_IN_FOREGROUND=0 giuliomoro@238: RUN_WITHOUT_SCREEN=0 giuliomoro@238: giuliomoro@430: usage() giuliomoro@238: { giuliomoro@439: THIS_SCRIPT=`basename "$0"` giuliomoro@439: echo "Usage: $THIS_SCRIPT [-c 'command-line-args'] [-nfb] " giuliomoro@439: echo " giuliomoro@439: This script copies a PureData project to the BeagleBone and runs it giuliomoro@439: using libpd. The Bela-libpd executable should have first been copied giuliomoro@439: to the $BBB_LIBPD_EXECUTABLE_PATH folder on the Beaglebone. giuliomoro@439: The source directory should contain a file called _main.pd, which is the giuliomoro@439: patch that will be loaded into Pd. All the content of the folder is giuliomoro@439: recursively copied and the folder structure is flattened. giuliomoro@238: giuliomoro@439: If the argument -n is passed, the output will not be run after copying the files. giuliomoro@439: giuliomoro@439: The -c option passes command-line arguments to the Bela program; giuliomoro@439: enclose the argument string in quotes. giuliomoro@439: giuliomoro@439: The -b argument runs the projet in the background, so that no output is displayed giuliomoro@439: in the terminal. giuliomoro@439: The -f argument runs the project in the foreground of the current terminal, giuliomoro@439: without screen, so the output can be piped to another destination." giuliomoro@238: } giuliomoro@238: giuliomoro@238: OPTIND=1 giuliomoro@238: giuliomoro@439: while getopts "bc:nfFh" opt; do giuliomoro@439: case $opt in giuliomoro@439: c) giuliomoro@439: COMMAND_ARGS=$OPTARG giuliomoro@439: ;; giuliomoro@439: b) giuliomoro@439: RUN_IN_FOREGROUND=0 giuliomoro@439: ;; giuliomoro@439: f) giuliomoro@439: RUN_WITHOUT_SCREEN=1 giuliomoro@439: ;; giuliomoro@439: n) giuliomoro@439: RUN_PROJECT=0 giuliomoro@439: ;; giuliomoro@439: h|\?) giuliomoro@439: usage giuliomoro@439: exit 1 giuliomoro@439: esac giuliomoro@238: done giuliomoro@238: giuliomoro@238: shift $((OPTIND-1)) giuliomoro@238: giuliomoro@238: # Check that we have a directory containing at least one source file giuliomoro@238: # as an argument giuliomoro@238: giuliomoro@439: ADDITIONAL_FOLDER=$1 giuliomoro@439: giuliomoro@439: if [ -z "$ADDITIONAL_FOLDER" ] giuliomoro@238: then giuliomoro@439: usage giuliomoro@238: exit giuliomoro@238: fi giuliomoro@238: giuliomoro@439: #reconstruct the command line options giuliomoro@439: OPT= giuliomoro@439: [ $RUN_IN_FOREGROUND -eq 0 ] && OPT="$OPT -b" giuliomoro@439: [ $RUN_WITHOUT_SCREEN -eq 1 ] && OPT="$OPT -f" giuliomoro@439: giuliomoro@439: ./build_project.sh -p libpd -r $ADDITIONAL_FOLDER $OPT -c "$COMMAND_ARGS" ../examples/basic_libpd/