Mercurial > hg > beaglert
comparison scripts/build_pd_heavy.sh @ 492:e9821d65b9ba prerelease
Heavy: your patch on the enzienaudio website should be called bela. You need to update that from your enzienaudio.com account.
| author | Giulio Moro <giuliomoro@yahoo.it> |
|---|---|
| date | Tue, 21 Jun 2016 17:36:58 +0100 |
| parents | b6b532e88a5c |
| children | 85ba865d3845 |
comparison
equal
deleted
inserted
replaced
| 491:89212ad6a0bf | 492:e9821d65b9ba |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # shell script for automatic uploading/compiling of pd patch onto bbb | 3 # shell script for automatic uploading/compiling of pd patch onto bbb |
| 4 # Christian Heinrichs 2015 | 4 # Christian Heinrichs 2015 |
| 5 # | 5 # |
| 6 # example usage: sh upload-and-compile.sh -f bwg-tests -q -e | |
| 7 | 6 |
| 8 trap "{ echo "";exit 0; }" 2 | 7 trap "{ echo "";exit 0; }" 2 |
| 9 | 8 |
| 10 workingdir=".." | 9 workingdir=".." |
| 11 pdpath="" | 10 pdpath="" |
| 45 | 44 |
| 46 usage () | 45 usage () |
| 47 { | 46 { |
| 48 printf "\nUSAGE: build_pd.sh [[-i input folder containing _main.pd file ]\ | 47 printf "\nUSAGE: build_pd.sh [[-i input folder containing _main.pd file ]\ |
| 49 [-o output folder for temp heavy project .c files (default $projectpath)]\ | 48 [-o output folder for temp heavy project .c files (default $projectpath)]\ |
| 50 [-b bbb path to copy to (default ~/Bela)] | [-h] | [-w|--watch] | [-n|--noupload] | [-r|--release arg]\n" | 49 [-b remote path to copy to (default ~/Bela)] | [-h] | [-w|--watch] | [-n|--noupload] | [-r|--release arg]\n" |
| 51 printf "\nexample: build_pd.sh -i ../projects/heavy/pd/hello-world -o ../projects/heavy/hello-world\n" | 50 printf "\nexample: build_pd.sh -i ../projects/heavy/pd/hello-world -o ../projects/heavy/hello-world\n" |
| 52 echo "If --watch is selected, the script will check every 1s for any file that is modified in the source folder, which re-triggers\ | 51 echo "If --watch is selected, the script will check every 1s for any file that is modified in the source folder, which re-triggers\ |
| 53 the building process. | 52 the building process. |
| 54 If --screen is selected, the prompt returns to the user after launching Bela in a screen on the target device. | 53 If --screen is selected, the prompt returns to the user after launching Bela in a screen on the target device. |
| 55 If --screen and --watch are combined, while the process is running in the screen, modifications to the source files will \ | 54 If --screen and --watch are combined, while the process is running in the screen, modifications to the source files will \ |
| 85 exit 1 | 84 exit 1 |
| 86 esac | 85 esac |
| 87 shift | 86 shift |
| 88 done | 87 done |
| 89 | 88 |
| 90 [ -z "$ENZIENAUDIO_COM_PATCH_NAME" ] && ENZIENAUDIO_COM_PATCH_NAME=bbb | 89 [ -z "$ENZIENAUDIO_COM_PATCH_NAME" ] && ENZIENAUDIO_COM_PATCH_NAME=bela |
| 91 [ "$NO_UPLOAD" -eq 0 ] && [ -z "$pdpath" ] && { echo "Error: a path to the source folder should be provided"; exit 1; } | 90 [ "$NO_UPLOAD" -eq 0 ] && [ -z "$pdpath" ] && { echo "Error: a path to the source folder should be provided"; exit 1; } |
| 92 | 91 |
| 93 if [ -z "$release" ] | 92 if [ -z "$release" ] |
| 94 then | 93 then |
| 95 RELEASE_STRING= | 94 RELEASE_STRING= |
| 153 echo "Updating files on board..." | 152 echo "Updating files on board..." |
| 154 # HvContext* files tend to hang when transferring with rsync because they are very large and -c checksum takes a lot, I guess | 153 # HvContext* files tend to hang when transferring with rsync because they are very large and -c checksum takes a lot, I guess |
| 155 | 154 |
| 156 touch $reference_time_file | 155 touch $reference_time_file |
| 157 # Transfer the files | 156 # Transfer the files |
| 158 rsync -ac --out-format=" %n" --no-t --delete-after --exclude='HvContext*' --exclude=build --exclude=$BBB_PROJECT_NAME "$projectpath"/ "$BBB_NETWORK_TARGET_FOLDER" &&\ | 157 rsync -ac --out-format=" %n" --no-t --delete-during --exclude='HvContext_'$ENZIENAUDIO_COM_PATCH_NAME'.*' --exclude=build --exclude=$BBB_PROJECT_NAME "$projectpath"/ "$BBB_NETWORK_TARGET_FOLDER" &&\ |
| 159 { [ $NO_UPLOAD -eq 1 ] || scp "$projectpath"/HvContext* $BBB_NETWORK_TARGET_FOLDER; } ||\ | 158 { [ $NO_UPLOAD -eq 1 ] || scp "$projectpath"/HvContext* $BBB_NETWORK_TARGET_FOLDER; } ||\ |
| 160 { echo "ERROR: while synchronizing files with the BBB. Is the board connected?"; exit 1; } | 159 { echo "ERROR: while synchronizing files with the BBB. Is the board connected?"; exit 1; } |
| 161 | 160 |
| 162 # TODO: rsync should upload a list of modified files, so that the corresponding objects can be deleted | 161 # TODO: rsync should upload a list of modified files, so that the corresponding objects can be deleted |
| 163 # TODO: this should be run only when Heavy_bbb.h changes. Otherwise render is recompiled every time for no good reason | 162 # TODO: this should be run only when Heavy_bela.h changes. Otherwise render is recompiled every time for no good reason |
| 164 #ssh $BBB_ADDRESS "rm -rf ${BBB_PROJECT_FOLDER}/build/render.*" | 163 #ssh $BBB_ADDRESS "rm -rf ${BBB_PROJECT_FOLDER}/build/render.*" |
| 165 | 164 |
| 166 #produce a list of files which content has changed (not just the date) | 165 #produce a list of files which content has changed (not just the date) |
| 167 #TODO: could be made faster (perhaps) by backing up the folder locally instead of bbb | 166 # remove old executable to force re-linking |
| 168 # UPDATED_FILES=`rsync -naic --log-format="%f" "$projectpath" "$BBB_BELA_HOME"/source | grep -v "\.$"` | |
| 169 # echo "UPDATEDFILES : $UPDATED_FILES" | |
| 170 # exit 2 | |
| 171 # remove old executable | |
| 172 #if [ $NO_UPLOAD -eq 0 ]; then | 167 #if [ $NO_UPLOAD -eq 0 ]; then |
| 173 # ssh $BBB_ADDRESS "rm -rf "$BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME; | 168 # ssh $BBB_ADDRESS "rm -rf "$BBB_PROJECT_FOLDER/$BBB_PROJECT_NAME; |
| 174 #fi; | 169 #fi; |
| 175 # Make new Bela executable and run | 170 # Make new Bela executable and run |
| 176 # It does not look very nice that we type the same things over and over | 171 # It does not look very nice that we type the same things over and over |
| 237 folder_has_changed "$pdpath" "$reference_time_file" "\.pd" &&\ | 232 folder_has_changed "$pdpath" "$reference_time_file" "\.pd" &&\ |
| 238 NO_UPLOAD=$BACK_NO_UPLOAD || NO_UPLOAD=1 | 233 NO_UPLOAD=$BACK_NO_UPLOAD || NO_UPLOAD=1 |
| 239 uploadBuildRun | 234 uploadBuildRun |
| 240 done | 235 done |
| 241 fi; | 236 fi; |
| 242 #ssh -t root@192.168.7.2 "kill -s 2 \`pidof heavy_template\` 2>/dev/null; sleep 0.5; rm -f ~/$filename_bbb/Release/source/heavy/HvContext_bbb.? ~/$filename_bbb/Release/heavy_template && make all -C ~/$filename_bbb/Release" &>/dev/null |
