changeset 109:c4758b1b1089

Support linux32 builds from linux64 host; fix mistaken misidentification of all plugins as VamPy plugins
author Chris Cannam
date Tue, 08 Sep 2015 11:35:05 +0100
parents 080ce3dcdd8c
children dcbcbbc20109
files SCRIPTS/process.sh
diffstat 1 files changed, 38 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/SCRIPTS/process.sh	Mon Sep 07 14:43:59 2015 +0100
+++ b/SCRIPTS/process.sh	Tue Sep 08 11:35:05 2015 +0100
@@ -49,18 +49,21 @@
 }
 
 platform_arg="$1"
+platform_native="unknown"
+case `uname -a` in
+    Linux*x86_64*) platform_native=linux64;;
+    Linux*) platform_native=linux32;;
+    Darwin*) platform_native=osx64;;
+    CYG*) platform_native=mingw32;;
+    MINGW*) platform_native=mingw32;;
+esac
 
 if [ "$platform_arg" = "native" ]; then
-    case `uname -a` in
-	Linux*x86_64*) platform_arg=linux64;;
-	Linux*) platform_arg=linux32;;
-	Darwin*) platform_arg=osx64;;
-	CYG*) platform_arg=mingw32;;
-	MINGW*) platform_arg=mingw32;;
-    esac
+    platform_arg="$platform_native"
 fi
 
 platform=
+platform_defines=
 bits=32
 altbits=
 toolprefix=
@@ -75,6 +78,10 @@
 case "$platform_arg" in
     linux32)
 	platform=linux
+	if [ "$platform_native" = "linux64" ]; then
+	    toolprefix=x86_64-unknown-linux-gnu-
+	    platform_defines=("CXX=${toolprefix}g++ -m32" "CC=${toolprefix}gcc -m32" "LD=${toolprefix}g++ -m32")
+	fi
 	pluginext=.so
 	valgrind=valgrind
 	identpattern='ELF 32'
@@ -194,13 +201,25 @@
     fi
 }
 
-plugin_dir_for() {
+custom_plugin_dir_for() {
     local dir="$1"
     if grep -q "^$dir: " ${metadir}/plugindir.txt ; then
 	echo "${mydir}/../${dir}"/$(grep "^$dir: " ${metadir}/plugindir.txt | head -1 | sed 's/^[^:]*: //')
     fi
 }
 
+plugin_dir_for() {
+    local dir="$1"
+    local pdir=$(custom_plugin_dir_for "$dir")
+    if [ -z "$pdir" ]; then
+	case "$dir" in
+	    /*) pdir="$dir" ;;
+	    *) pdir="${mydir}/../${dir}";;
+	esac
+    fi
+    echo "$pdir"
+}
+
 configure() {
     local dir="$1"
     if [ -f "$dir/configure" ] ; then
@@ -238,12 +257,6 @@
 find_vampy_plugins_in() {
     local dir="$1"
     local pdir=$(plugin_dir_for "$dir")
-    if [ -z "$pdir" ]; then
-	case "$dir" in
-	    /*) pdir="$dir" ;;
-	    *) pdir="${mydir}/../${dir}";;
-	esac
-    fi
     find "$pdir" -name \*.py -print0 | xargs -0 grep -l 'import.*\bvampy\b'
 }
 
@@ -286,7 +299,7 @@
 		CXXFLAGS="-I${depincdir} -I${pyincdir} -I${numpyincdir} -I${depincdir_generic} -I${mydir}/../vamp-plugin-sdk" \
 		LDFLAGS="-L${deplibdir} -L${pylibdir} -L${mydir}/../vamp-plugin-sdk" \
 		ARCHFLAGS="$archflags" \
-		make -C "$dir" -f "$mfile" $target 2>&1 | \
+		make -C "$dir" -f "$mfile" $target "${platform_defines[@]}" 2>&1 | \
 		tee "$log"
 	    return ${PIPESTATUS[0]}
 	elif have_vampy_plugins "$dir"; then
@@ -360,7 +373,7 @@
     fi
     # can't use sed to remove \r from DOS line endings -- BSD and GNU
     # vary in how they interpret \r escape -- so we use perl for that...
-    VAMP_PATH="$dir$sep$pdir$sep$vampydir" $hostwrapper \
+    VAMP_PATH="$pdir$sep$vampydir" $hostwrapper \
 	vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | \
 	grep '^vamp:' | \
 	sed 's/^vamp://' | \
@@ -386,8 +399,8 @@
 	if is_nondeterministic "$id"; then
 	    extra="-n"
 	fi
-	echo "Running command: VAMP_PATH=\"$dir$sep$pdir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log"
-	if ( VAMP_PATH="$dir$sep$pdir$sep./vampy" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then
+	echo "Running command: VAMP_PATH=\"$pdir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log"
+	if ( VAMP_PATH="$pdir$sep./vampy" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then
 	    echo "OK" | tee -a "$log"
 	else
 	    if have_vampy_plugins "$pdir"; then # (don't attempt vampy+valgrind)
@@ -396,7 +409,7 @@
 	    else
 		echo | tee -a "$log"
 		echo "Tester failed for id $id: running again with valgrind (if available) and verbose for a report..." | tee -a "$log"
-		VAMP_PATH="$dir$sep$pdir$sep./vampy" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log"
+		VAMP_PATH="$pdir$sep./vampy" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log"
 	    fi
 	    good=no
 	fi
@@ -416,7 +429,9 @@
     # nm -g --defined-only; the OS/X docs suggest nm -gu should work,
     # but it doesn't. What I think will work with both is simply
     # grepping out the undefineds:
-    "$toolprefix"nm -g "$lib" | grep -v ' U ' | awk '{ print $3; }'
+    nm="${toolprefix}nm"
+    if ! type -path "$nm" >/dev/null; then nm=nm; fi
+    "$nm" -g "$lib" | grep -v ' U ' | awk '{ print $3; }'
 }
 
 env_test_exports() {
@@ -453,7 +468,7 @@
     local log=$(logfile_for envtest "$dir")
     local pdir=$(plugin_dir_for "$dir")
     local good=yes
-    local ids=$(VAMP_PATH="$dir$sep$pdir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids);
+    local ids=$(VAMP_PATH="$pdir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids);
     echo 
     echo "Testing for any unwanted output to stdout..."
     for id in $ids; do
@@ -471,7 +486,7 @@
 env_test_cat() {
     local dir="$1"
     local log=$(logfile_for envtest "$dir")
-    local pdir=$(plugin_dir_for "$dir")
+    local pdir=$(custom_plugin_dir_for "$dir")
     local cdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi)
     local good=yes
     local first=yes
@@ -509,7 +524,7 @@
 env_test_ttl() {
     local dir="$1"
     local log=$(logfile_for envtest "$dir")
-    local pdir=$(plugin_dir_for "$dir")
+    local pdir=$(custom_plugin_dir_for "$dir")
     local rdir=$(if test -n "$pdir" ; then echo "$pdir" ; else echo "$dir" ; fi)
     local good=yes
     local first=yes