changeset 22:5b4cb5af2a90

Add args for platform, build-from-clean
author Chris Cannam
date Tue, 05 Aug 2014 15:00:40 +0100
parents ee6b7d71155b
children fb1f7489a5dc e1b89e300e76
files SCRIPTS/process.sh
diffstat 1 files changed, 97 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/SCRIPTS/process.sh	Tue Aug 05 12:55:55 2014 +0100
+++ b/SCRIPTS/process.sh	Tue Aug 05 15:00:40 2014 +0100
@@ -12,29 +12,93 @@
 mydir=$(dirname "$0")
 case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
 
-#platform=linux
-#bits=64
-#toolprefix=""
-#pluginext=.so
-#hostwrapper=""
-#hostext=""
-#archflags=
+do_rebuild=""
 
-#platform=mingw
-#bits=32
-#toolprefix=i686-w64-mingw32- 
-#pluginext=.dll
-#hostwrapper=wine
-#hostext=.exe
-#archflags=
+usage() {
+    echo 
+    echo "Usage: $0 <platform> [-c] [<dir> ...]"
+    echo 
+    echo " <platform>  one of linux32, linux64, mingw32, mingw64, osx32, osx64"
+    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."
+    echo
+    exit 2
+}
 
-platform=osx
-bits=64
-toolprefix=
-pluginext=.dylib
-hostwrapper=
-hostext=
-archflags="-arch x86_64"
+case "$1" in
+    linux32)
+	platform=linux
+	bits=32
+	toolprefix=
+	pluginext=.so
+	hostwrapper=
+	hostext=
+	archflags=
+	;;
+    linux64)
+	platform=linux
+	bits=64
+	toolprefix=
+	pluginext=.so
+	hostwrapper=
+	hostext=
+	archflags=
+	;;
+    mingw32)
+	platform=mingw
+	bits=32
+	toolprefix=i686-w64-mingw32- 
+	pluginext=.dll
+	hostwrapper=wine
+	hostext=.exe
+	archflags=
+	;;
+    mingw64)
+	platform=mingw
+	bits=64
+	toolprefix=x86_64-w64-mingw32- 
+	pluginext=.dll
+	hostwrapper=wine
+	hostext=.exe
+	archflags=
+	;;
+    osx32)
+	platform=osx
+	bits=32
+	toolprefix=
+	pluginext=.dylib
+	hostwrapper=
+	hostext=
+	archflags="-arch i386"
+	;;
+    osx64)
+	platform=osx
+	bits=64
+	toolprefix=
+	pluginext=.dylib
+	hostwrapper=
+	hostext=
+	archflags="-arch x86_64"
+	;;
+esac;
+
+shift
+
+if [ -z "$platform" ]; then
+    usage
+else
+    echo "(Platform is $platform, $bits bits)"
+fi
+
+if [ t"$1" = t"-c" ]; then
+    echo "(Building from clean)"
+    do_rebuild=yes
+    shift
+fi
 
 depincdir="$mydir"/../DEPENDENCIES/$platform$bits/include
 deplibdir="$mydir"/../DEPENDENCIES/$platform$bits/lib
@@ -133,6 +197,15 @@
     fi
 }
 
+build_or_rebuild() {
+    dir="$1"
+    if [ -n "$do_rebuild" ]; then
+	rebuild "$dir"
+    else
+	build "$dir"
+    fi
+}
+
 have_plugin() {
     dir="$1"
     for x in "$dir/"*"$pluginext"; do 
@@ -210,12 +283,12 @@
     fi
 }
 
-if ! rebuild "vamp-plugin-sdk"; then 
+if ! build_or_rebuild "vamp-plugin-sdk"; then 
     echo "Failed to build Vamp plugin SDK!"
     exit 1
 fi
 
-if ! rebuild "vamp-plugin-tester"; then 
+if ! build_or_rebuild "vamp-plugin-tester"; then 
     echo "Failed to build Vamp plugin tester!"
     exit 1
 fi
@@ -223,7 +296,7 @@
 for dir in $plugindirs ; do
     echo
     echo "Processing: $dir"
-    if rebuild "$dir"; then
+    if build_or_rebuild "$dir"; then
 	if have_plugin "$dir" ; then
 	    echo "$dir" >> "$built"
 	    run_tester "$dir"