changeset 120:4729c8589274 emscripten-piper

Add piper builds
author Chris Cannam
date Fri, 11 Nov 2016 15:49:32 +0000
parents 4d3bba3c0fe7
children
files METADATA/repos.txt SCRIPTS/process-piper.sh SCRIPTS/process.sh SCRIPTS/summarise.sh
diffstat 4 files changed, 174 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/METADATA/repos.txt	Fri Nov 11 14:34:56 2016 +0000
+++ b/METADATA/repos.txt	Fri Nov 11 15:49:32 2016 +0000
@@ -23,6 +23,5 @@
 tempest = https://code.soundsoftware.ac.uk/hg/tempest
 miredu = https://github.com/MTG/miredu
 ua-vamp-plugins = https://github.com/pertusa/UAVampPlugins
-vamp-test-plugin = https://code.soundsoftware.ac.uk/hg/vamp-test-plugin
 tipic = https://code.soundsoftware.ac.uk/hg/tipic
 btrack = https://github.com/adamstark/BTrack
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SCRIPTS/process-piper.sh	Fri Nov 11 15:49:32 2016 +0000
@@ -0,0 +1,158 @@
+#!/bin/bash
+
+set -e
+
+mydir=$(dirname "$0")
+case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
+
+. "$mydir"/include.sh
+
+do_rebuild=""
+
+pubtag="piper"
+
+if [ t"$1" = t"-c" ]; then
+    echo "(Building from clean)"
+    do_rebuild=yes
+    shift
+fi
+
+plugindirs="$@"
+if [ -z "$plugindirs" ]; then
+    plugindirs=$(cat METADATA/repos.txt |
+		     grep -v vamp-plugin-sdk |
+		     grep -v vamp-plugin-tester |
+		     grep -v '^piper' |
+		     awk '{ print $1; }')
+else 
+    for dir in $plugindirs ; do
+	if [ ! -d "$dir" ]; then
+	    echo "ERROR: Directory $dir not found"
+	    usage
+	fi
+    done
+fi
+
+set -u
+
+reportdir="REPORTS/piper-js"
+packagedir="PACKAGES/piper-js"
+
+mkdir -p "$reportdir" "$packagedir" || exit 1
+
+built="/tmp/built.$$.txt"
+testfailed="/tmp/testfailed.$$.txt"
+envcheckfailed="/tmp/envcheckfailed.$$.txt"
+notbuilt="/tmp/notbuilt.$$.txt"
+
+trap 'rm -f "$built" "$envcheckfailed" "$testfailed" "$notbuilt"' 0
+touch "$built" "$envcheckfailed" "$testfailed" "$notbuilt"
+
+logfile_for() {
+    local activity="$1"
+    local dir="$2"
+    echo "$reportdir/$dir.$activity.txt"
+}
+
+build_dir_for() {
+    local dir="$1"
+    echo "piper-vamp-js-builds/$dir"
+}
+
+build() {
+    local dir="$1"
+    local log=$(logfile_for build "$dir")
+    local build_dir=$(build_dir_for "$dir")
+    make -C "$build_dir" em 2>&1 | tee "$log"
+    return ${PIPESTATUS[0]}
+}
+
+rebuild() {
+    local dir="$1"
+    local log=$(logfile_for build "$dir")
+    local build_dir=$(build_dir_for "$dir")
+    if make -C "$build_dir" distclean; then
+	build "$dir"
+    elif make -C "$build_dir" clean; then
+	build "$dir"
+    else
+	echo "*** Failed to 'make clean' in $dir!" | tee "$log"
+	return 1
+    fi
+}
+
+build_or_rebuild() {
+    local dir="$1"
+    if [ -n "$do_rebuild" ]; then
+	rebuild "$dir"
+    else
+	build "$dir"
+    fi
+}
+
+package() {
+    local dir="$1"
+    local id=$(vcs_id "$dir")
+    local pstub="$dir-$pubtag-$id"
+    local pdir="$packagedir/$pstub"
+    local build_dir=piper-vamp-js-builds/"$dir"
+    mkdir -p "$pdir"
+    ( cd "$dir" ; 
+	cp -av \
+	    [Rr][Ee][Aa][Dd][Mm][Ee]* \
+	    [Cc][Oo][Pp][Yy][Ii][Nn][Gg]* \
+	    [Ll][Ii][Cc][Ee][Nn][CcSs][Ee]* \
+	    [Cc][Ii][Tt][Aa][Tt][Ii][Oo][Nn]* \
+	    [Cc][Hh][Aa][Nn][Gg][Ee][Ll][Oo][Gg]* \
+	    ../"$pdir"/ || true
+    )
+    cp "$build_dir"/*.js "$pdir/"
+    ( cd "$packagedir";
+      tar cvjf "$pstub".tar.bz2 "$pstub"
+      rm -rf "$pstub"
+    )
+}
+
+for dir in $plugindirs ; do
+    dir=${dir%/*}
+    build_dir=piper-vamp-js-builds/"$dir"
+    echo
+    echo "Processing: $dir"
+    if [ ! -d "$dir" ]; then
+	echo "Directory $dir not found!"
+	echo "$dir" >> "$notbuilt"
+    elif [ ! -d "$build_dir" ]; then
+	echo "Directory $dir lacks Piper build dir $build_dir"
+	echo "Skipping"
+	echo "$dir" >> "$notbuilt"
+    elif build_or_rebuild "$dir"; then
+	echo "$dir" >> "$built"
+    else
+	echo "$dir" >> "$notbuilt"
+    fi
+    slog=$(logfile_for summary "$dir")
+    echo "initialising logfile $slog for $dir"
+    cat /dev/null > "$slog"
+done
+	 
+cat "$built" | while read dir; do
+    package "$dir"
+done
+   
+echo
+echo "** Built and packaged:"
+cat "$built" | while read dir; do
+    slog=$(logfile_for summary "$dir")
+    echo "$dir"
+    echo "$dir: OK: Success" >> "$slog"
+done | sort
+
+echo
+echo "** Failed to build:"	    
+cat "$notbuilt" | sort | while read dir; do
+    slog=$(logfile_for summary "$dir")
+    echo "$dir"
+    echo "$dir: BUILD_FAILED: Failed to build" >> "$slog"
+done
+
+echo
--- a/SCRIPTS/process.sh	Fri Nov 11 14:34:56 2016 +0000
+++ b/SCRIPTS/process.sh	Fri Nov 11 15:49:32 2016 +0000
@@ -36,14 +36,16 @@
     echo 
     echo "Usage: $0 <platform> [-c] [<dir> ...]"
     echo 
-    echo " <platform>  one of native, linux32, linux64, mingw32, mingw64, osx32, osx64"
-    echo " -c          build from clean"
-    echo " <dir>       directory to build (default is all of them)"
+    echo " <platform> one of:"
+    echo "            native, linux32, linux64, mingw32, mingw64, osx32, osx64, piper"
+    echo " -c         build from clean"
+    echo " <dir>      directory to build (default is all of them)"
     echo
     echo "Platform usually should match the platform you are running this"
     echo "script on, unless you have a cross-compile toolset installed and"
-    echo "this script knows how to run it. The special platform 'native'"
-    echo "tries to guess the currently running platform."
+    echo "this script knows how to run it. The 'piper' platform builds a"
+    echo "portable Piper API Javascript module using Emscripten. The special"
+    echo "platform 'native' tries to guess the currently running platform."
     echo
     exit 2
 }
@@ -134,6 +136,10 @@
 	archflags="-mmacosx-version-min=10.7 -arch x86_64 -arch i386 -stdlib=libc++"
 	identpattern='Mach-O 64-bit .*x86_64'
 	;;
+    piper)
+	shift
+	exec "$mydir"/process-piper.sh "$@"
+	;;
     *)
 	usage
 	;;
--- a/SCRIPTS/summarise.sh	Fri Nov 11 14:34:56 2016 +0000
+++ b/SCRIPTS/summarise.sh	Fri Nov 11 15:49:32 2016 +0000
@@ -128,7 +128,11 @@
     case "$outcome" in
 	OK)
 	    id=$(vcs_id "$dir")
-	    package=$(echo "PACKAGES/$platform/$dir-$platform-$id".*)
+	    pubtag="$platform"
+	    if [ "$pubtag" = "piper-js" ]; then
+		pubtag=piper
+	    fi
+	    package=$(echo "PACKAGES/$platform/$dir-$pubtag-$id".*)
 	    echo "package is $package" 1>&2
 	    if [ -f "$package" ]; then
 		echo "<a href='$package'>$dl</a>"