changeset 19:b7f35acc8561

Further fixes for mingw32 cross-compile
author Chris Cannam
date Tue, 05 Aug 2014 11:12:50 +0100
parents f4c61cff1c40
children 9aff44415b22
files .hgsubstate METADATA/maketarget.txt SCRIPTS/process.sh
diffstat 3 files changed, 104 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Tue Aug 05 11:12:23 2014 +0100
+++ b/.hgsubstate	Tue Aug 05 11:12:50 2014 +0100
@@ -1,14 +1,14 @@
-be38b27374a2abe0f397213d4daaa59cfcd77192 match-vamp
+fec395fcdc7c38589bac50541e5c6e19502d9eb6 match-vamp
 ca32a96c123a2c3f7548e37a8d5f4205632bdd9d mazurka-plugins
-beb388e64d3e8a6ad2301653a43fa393787e76cd nnls-chroma
-a2102b3641b9dc72b29d40c5741da1401faea6f0 pyin
-c73d23a73cf1c3aec5a96a1ec70feeec2e2b18ff qm-vamp-plugins
+90c2f0b597f8130c906ff3ea019480bc433d7db2 nnls-chroma
+3b37e7be34dad2fc12afced53ade57038e8ae336 pyin
+9d19d80f61f5555215af0ac34598205021e35dd4 qm-vamp-plugins
 4cc12d2d64e47b72122320f5e165b0b534811f24 segmenter-vamp-plugin
 e5f897b2d5e882487d19d228787a76b416891a20 silvet
 b835875739968beb870e7e09132aa361656a8a30 vamp-aubio-plugins
 32407651025d8334f4d1f93dedbcd492b24bd93a vamp-libxtract-plugins
 717aa5a28254817c48be2450af49b9b84c61c91e vamp-onsetsds-plugin
-ff78d47310af75524cf4d087c1a5861d0fa01afc vamp-plugin-sdk
-0973204bf4469449d6870890734d23996166748c vamp-plugin-tester
+cb6c59627bcc569a99d0be256beff50edd9ecb98 vamp-plugin-sdk
+d83ac7c87f9c7352b255772174df8072d7081b7d vamp-plugin-tester
 886d1071c282201f67504690ea6476417193db18 vamp-test-plugin
 4ffac7dedddfbbdffc18f74a71c05e8e0f88bd67 vampy
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/METADATA/maketarget.txt	Tue Aug 05 11:12:50 2014 +0100
@@ -0,0 +1,2 @@
+constant-q-cpp: libs
+pyin: plugin
--- a/SCRIPTS/process.sh	Tue Aug 05 11:12:23 2014 +0100
+++ b/SCRIPTS/process.sh	Tue Aug 05 11:12:50 2014 +0100
@@ -9,18 +9,27 @@
 ##   does not export any unnecessary symbols
 ##   has valid .cat and .n3
 
+mydir=$(dirname "$0")
+case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
+
 #platform=linux
 #bits=64
-
-mydir=$(dirname "$0")
-case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
+#toolprefix=""
+#pluginext=.so
+#hostwrapper=""
+#hostext=""
 
 platform=mingw
 bits=32
 toolprefix=i686-w64-mingw32- 
+pluginext=.dll
+hostwrapper=wine
+hostext=.exe
 
-depincdir="$mydir"/../DEPENDENCIES/win32-mingw/include
-deplibdir="$mydir"/../DEPENDENCIES/win32-mingw/lib
+depincdir="$mydir"/../DEPENDENCIES/$platform$bits/include
+deplibdir="$mydir"/../DEPENDENCIES/$platform$bits/lib
+
+depincdir_generic="$mydir"/../DEPENDENCIES/generic/include
 
 plugindirs="$@"
 if [ -z "$plugindirs" ]; then
@@ -32,9 +41,10 @@
 
 built="/tmp/built.$$.txt"
 testfailed="/tmp/testfailed.$$.txt"
+envcheckfailed="/tmp/envcheckfailed.$$.txt"
 notbuilt="/tmp/notbuilt.$$.txt"
-trap 'rm -f "$built" "$testfailed" "$notbuilt"' 0
-touch "$built" "$testfailed" "$notbuilt"
+trap 'rm -f "$built" "$envcheckfailed" "$testfailed" "$notbuilt"' 0
+touch "$built" "$envcheckfailed" "$testfailed" "$notbuilt"
 
 configure() {
     dir="$1"
@@ -46,12 +56,15 @@
 find_makefile() {
     dir="$1"
     for f in \
+	build/$platform$bits/Makefile.$platform$bits \
 	build/$platform/Makefile.$platform$bits \
+	build/$platform$bits/Makefile.$platform \
+	build/$platform$bits/Makefile \
+	build/Makefile.$platform$bits \
+	Makefile.$platform$bits \
 	build/$platform/Makefile.$platform \
 	build/$platform/Makefile \
-	build/Makefile.$platform$bits \
 	build/Makefile.$platform \
-	Makefile.$platform$bits \
 	Makefile.$platform \
 	Makefile ; do
 	if [ -f "$dir/$f" ]; then
@@ -69,12 +82,23 @@
     fi
 }
 
+target_for() {
+    dir="$1"
+    if grep -q "^$dir: " METADATA/maketarget.txt ; then
+	grep "^$dir: " METADATA/maketarget.txt | head -1 | sed 's/^[^:]*: //'
+    fi
+}
+
 build() {
     dir="$1"
     if configure_maybe "$dir"; then
 	mfile=$(find_makefile "$dir")
 	if [ -n "$mfile" ]; then
-	    TOOLPREFIX="$toolprefix" CXXFLAGS="-I$depincdir" LDFLAGS="-L$deplibdir" make -C "$dir" -f "$mfile" 2>&1 | tee "$reportdir/$dir.build.txt"
+	    target=$(target_for "$dir")
+	    TOOLPREFIX="$toolprefix" \
+		CXXFLAGS="-I${depincdir} -I${depincdir_generic} -I../vamp-plugin-sdk" LDFLAGS="-L${deplibdir} -L../vamp-plugin-sdk" \
+		make -C "$dir" -f "$mfile" $target 2>&1 | \
+		tee "$reportdir/$dir.build.txt"
 	    return ${PIPESTATUS[0]}
 	else
 	    echo "Failed to find a Makefile in $dir"
@@ -89,8 +113,7 @@
 	mfile=$(find_makefile "$dir")
 	if [ -n "$mfile" ]; then
 	    make -C "$dir" -f "$mfile" clean
-	    TOOLPREFIX="$toolprefix" CXXFLAGS="-I$depincdir" LDFLAGS="-L$deplibdir" make -C "$dir" -f "$mfile" 2>&1 | tee "$reportdir/$dir.build.txt"
-	    return ${PIPESTATUS[0]}
+	    build "$dir"
 	else
 	    echo "Failed to find a Makefile in $dir"
 	    return 1
@@ -98,10 +121,25 @@
     fi
 }
 
+have_plugin() {
+    dir="$1"
+    for x in "$dir/"*"$pluginext"; do 
+	if [ -f "$x" ]; then
+	    return 0
+	fi
+    done
+    return 1
+}
+
+is_nondeterministic() {
+    plugin_id="$1"
+    grep -q "^$id\$" METADATA/nondeterministic.txt
+}
+
 run_tester() {
     ##!!! todo: timeout if the plugin takes too long and report as failure?
     dir="$1"
-    ids=$(VAMP_PATH="$dir" vamp-plugin-sdk/host/vamp-simple-host --list-ids | sed 's/^vamp://')
+    ids=$(VAMP_PATH="$dir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | sed 's/^vamp://' | sed 's/\r//g' )
     if [ -z "$ids" ]; then
 	echo 
 	echo "No plugins reported to test in $dir"
@@ -109,16 +147,17 @@
     else
 	for id in $ids; do
 	    extra=""
-	    if grep -q "^$id\$" METADATA/nondeterministic.txt; then
+	    if is_nondeterministic "$id"; then
 		extra="-n"
 	    fi
-	    if ( VAMP_PATH="$dir" vamp-plugin-tester/vamp-plugin-tester "$extra" "$id" 2>&1 | tee "$reportdir/$dir.test.txt" ; exit ${PIPESTATUS[0]} ) ; then
+	    echo "Running command: VAMP_PATH=\"$dir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\""
+	    if ( VAMP_PATH="$dir" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee "$reportdir/$dir.test.txt" ; exit ${PIPESTATUS[0]} ) ; then
 		echo "OK"
 	    else
 		echo
 		echo "Tester failed for id $id: running again with valgrind and verbose for a report..."
 		echo "$dir" >> "$testfailed"
-		VAMP_PATH="$dir" valgrind vamp-plugin-tester/vamp-plugin-tester -v "$extra" "$id" 2>&1 | tee -a "$reportdir/$dir.test.txt"
+		VAMP_PATH="$dir" valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$reportdir/$dir.test.txt"
 		return 1
 	    fi
 	done
@@ -127,25 +166,36 @@
 
 public_symbols() {
     lib="$1"
-    nm -g --defined-only "$lib" | awk '{ print $3; }'
+    "$toolprefix"nm -g --defined-only "$lib" | awk '{ print $3; }'
 }
 
 run_environmental_tests() {
     dir="$1"
-    for lib in $dir/*.so; do 
-	if public_symbols "$lib" | grep -q vampGetPluginDescriptor; then
-	    others=`public_symbols "$lib" | grep -v vampGetPluginDescriptor`
-	    if [ -n "$others" ]; then
-		count=`echo "$others" | wc -l`
-		echo "WARNING: $count extra symbols exported by plugin library"
-		#!!! what to do about it?
+    good=yes
+    for lib in $dir/*$pluginext; do 
+	if [ ! -f "$lib" ]; then
+	    echo "NOTE: no library found in $dir?"
+	    good=no
+	else
+	    echo 
+	    echo "Testing for exported symbols in $lib..."
+	    if public_symbols "$lib" | grep -q vampGetPluginDescriptor; then
+		others=`public_symbols "$lib" | grep -v vampGetPluginDescriptor`
+		if [ -n "$others" ]; then
+		    count=`echo "$others" | wc -l`
+		    echo "WARNING: $count extra symbols exported by plugin library"
+		    good=no
+		else
+		    echo "GOOD: library $lib only exports vampGetPluginDescriptor"
+		fi
 	    else
-		echo "GOOD: library $lib only exports vampGetPluginDescriptor"
+		echo "NOTE: found library $lib that is not a Vamp plugin library"
 	    fi
-	else
-	    echo "NOTE: found library $lib that is not a Vamp plugin library"
 	fi
     done
+    if [ "$good" != "yes" ]; then
+	echo "$dir" >> "$envcheckfailed"
+    fi
 }
 
 if ! build "vamp-plugin-sdk"; then 
@@ -153,7 +203,7 @@
     exit 1
 fi
 
-if ! rebuild "vamp-plugin-tester"; then 
+if ! build "vamp-plugin-tester"; then 
     echo "Failed to build Vamp plugin tester!"
     exit 1
 fi
@@ -161,10 +211,15 @@
 for dir in $plugindirs ; do
     echo
     echo "Processing: $dir"
-    if rebuild "$dir"; then
-	echo "$dir" >> "$built"
-	run_tester "$dir"
-	run_environmental_tests "$dir"
+    if build "$dir"; then
+	if have_plugin "$dir" ; then
+	    echo "$dir" >> "$built"
+	    run_tester "$dir"
+	    run_environmental_tests "$dir"
+	else 
+	    echo "Build apparently succeeded, but no resulting plugin(s) found" | tee -a "$reportdir/$dir.build.txt"
+	    echo "$dir" >> "$notbuilt"
+	fi
     else
 	echo "$dir" >> "$notbuilt"
     fi
@@ -173,7 +228,7 @@
 cat /dev/null > "$reportdir/$dir.summary.txt"
 
 echo
-echo "** Successfully built and tested:"
+echo "** Successfully built, tested, and checked:"
 cat "$built" | while read d; do
     if ! grep -q "^$d\$" "$testfailed"; then
 	echo "$d"
@@ -182,13 +237,20 @@
 done | sort
 
 echo
-echo "** Built, but failed tests:"
+echo "** Failed tests:"
 cat "$testfailed" | sort | uniq | while read d; do
     echo "$d"
     echo "Built successfully, but failed tests" >> "$reportdir/$d.summary.txt"
 done
 
 echo
+echo "** Failed environmental checks:"
+cat "$envcheckfailed" | sort | uniq | while read d; do
+    echo "$d"
+    echo "Built successfully, but failed environmental checks" >> "$reportdir/$d.summary.txt"
+done
+
+echo
 echo "** Failed to build:"	    
 cat "$notbuilt" | sort | while read d; do
     echo "$d"