annotate SCRIPTS/process.sh @ 73:e9d2ba7cce95 emscripten

Emscripten hacky stuff
author Chris Cannam
date Thu, 30 Oct 2014 08:30:07 +0000
parents aeeb2c3d7cd5
children e58ce2aebd18
rev   line source
Chris@1 1 #!/bin/bash
Chris@1 2
Chris@6 3 # Run this from the top-level vamp-build-and-test directory
Chris@6 4
Chris@1 5 ## Things to test:
Chris@1 6 ## the plugin builds!
Chris@1 7 ## plugin loads
Chris@1 8 ## passes vamp-plugin-tester tests
Chris@1 9 ## does not export any unnecessary symbols
Chris@1 10 ## has valid .cat and .n3
Chris@1 11
Chris@19 12 mydir=$(dirname "$0")
Chris@19 13 case "$mydir" in /*);; *) mydir=$(pwd)/"$mydir";; esac
Chris@19 14
Chris@57 15 have_all=true
Chris@66 16 for program in make perl git svn hg zip tar ; do
Chris@57 17 if ! $program --version >/dev/null 2>&1; then
Chris@57 18 if ! $program -v 2>&1 | grep -q version; then
Chris@57 19 echo " ** $program program not found"
Chris@57 20 have_all=false
Chris@57 21 fi
Chris@57 22 fi
Chris@57 23 done
Chris@57 24 if [ "$have_all" != "true" ]; then
Chris@57 25 echo "Not all dependencies found, exiting"
Chris@57 26 exit 1
Chris@57 27 fi
Chris@57 28
Chris@22 29 do_rebuild=""
Chris@14 30
Chris@22 31 usage() {
Chris@22 32 echo
Chris@22 33 echo "Usage: $0 <platform> [-c] [<dir> ...]"
Chris@22 34 echo
Chris@73 35 echo " <platform> one of native, linux32, linux64, mingw32, mingw64, osx32, osx64, emscripten"
Chris@22 36 echo " -c build from clean"
Chris@22 37 echo " <dir> directory to build (default is all of them)"
Chris@22 38 echo
Chris@22 39 echo "Platform usually should match the platform you are running this"
Chris@22 40 echo "script on, unless you have a cross-compile toolset installed and"
Chris@31 41 echo "this script knows how to run it. The special platform 'native'"
Chris@31 42 echo "tries to guess the currently running platform."
Chris@22 43 echo
Chris@22 44 exit 2
Chris@22 45 }
Chris@21 46
Chris@31 47 platform_arg="$1"
Chris@31 48
Chris@31 49 if [ "$platform_arg" = "native" ]; then
Chris@31 50 case `uname -a` in
Chris@31 51 Linux*x86_64*) platform_arg=linux64;;
Chris@31 52 Linux*) platform_arg=linux32;;
Chris@31 53 Darwin*) platform_arg=osx64;;
Chris@31 54 CYG*) platform_arg=mingw32;;
Chris@31 55 MINGW*) platform_arg=mingw32;;
Chris@31 56 esac
Chris@31 57 fi
Chris@31 58
Chris@31 59 case "$platform_arg" in
Chris@22 60 linux32)
Chris@22 61 platform=linux
Chris@22 62 bits=32
Chris@22 63 toolprefix=
Chris@22 64 pluginext=.so
Chris@22 65 hostwrapper=
Chris@22 66 hostext=
Chris@38 67 valgrind=valgrind
Chris@22 68 archflags=
Chris@42 69 identpattern='ELF 32'
Chris@22 70 ;;
Chris@22 71 linux64)
Chris@22 72 platform=linux
Chris@22 73 bits=64
Chris@22 74 toolprefix=
Chris@22 75 pluginext=.so
Chris@22 76 hostwrapper=
Chris@22 77 hostext=
Chris@38 78 valgrind=valgrind
Chris@22 79 archflags=
Chris@42 80 identpattern='ELF 64'
Chris@22 81 ;;
Chris@22 82 mingw32)
Chris@22 83 platform=mingw
Chris@22 84 bits=32
Chris@22 85 toolprefix=i686-w64-mingw32-
Chris@22 86 pluginext=.dll
Chris@22 87 hostwrapper=wine
Chris@22 88 hostext=.exe
Chris@38 89 valgrind=
Chris@22 90 archflags=
Chris@36 91 identpattern='PE32.*386.*Windows'
Chris@22 92 ;;
Chris@22 93 mingw64)
Chris@22 94 platform=mingw
Chris@22 95 bits=64
Chris@22 96 toolprefix=x86_64-w64-mingw32-
Chris@22 97 pluginext=.dll
Chris@22 98 hostwrapper=wine
Chris@22 99 hostext=.exe
Chris@38 100 valgrind=
Chris@22 101 archflags=
Chris@36 102 identpattern='not known yet' ##!!!
Chris@22 103 ;;
Chris@22 104 osx32)
Chris@22 105 platform=osx
Chris@22 106 bits=32
Chris@22 107 toolprefix=
Chris@22 108 pluginext=.dylib
Chris@22 109 hostwrapper=
Chris@22 110 hostext=
Chris@38 111 valgrind=
Chris@22 112 archflags="-arch i386"
Chris@40 113 identpattern='Mach-O .*i386'
Chris@22 114 ;;
Chris@22 115 osx64)
Chris@22 116 platform=osx
Chris@22 117 bits=64
Chris@22 118 toolprefix=
Chris@22 119 pluginext=.dylib
Chris@22 120 hostwrapper=
Chris@22 121 hostext=
Chris@38 122 valgrind=
Chris@26 123 # This is a difficult choice for various reasons... have to ponder
Chris@26 124 archflags="-mmacosx-version-min=10.6 -arch x86_64 -arch i386"
Chris@40 125 identpattern='Mach-O 64-bit .*x86_64'
Chris@22 126 ;;
Chris@73 127 emscripten)
Chris@73 128 platform=emscripten
Chris@73 129 bits=32
Chris@73 130 toolprefix=
Chris@73 131 pluginext=.so
Chris@73 132 hostwrapper=
Chris@73 133 hostext=
Chris@73 134 makewrapper=emmake
Chris@73 135 configwrapper=emconfigure
Chris@73 136 valgrind=
Chris@73 137 archflags=
Chris@73 138 identpattern='not known yet'
Chris@73 139 ;;
Chris@22 140 esac;
Chris@22 141
Chris@22 142 shift
Chris@22 143
Chris@22 144 if [ -z "$platform" ]; then
Chris@22 145 usage
Chris@22 146 else
Chris@22 147 echo "(Platform is $platform, $bits bits)"
Chris@22 148 fi
Chris@22 149
Chris@22 150 if [ t"$1" = t"-c" ]; then
Chris@22 151 echo "(Building from clean)"
Chris@22 152 do_rebuild=yes
Chris@22 153 shift
Chris@22 154 fi
Chris@15 155
Chris@19 156 depincdir="$mydir"/../DEPENDENCIES/$platform$bits/include
Chris@19 157 deplibdir="$mydir"/../DEPENDENCIES/$platform$bits/lib
Chris@19 158
Chris@19 159 depincdir_generic="$mydir"/../DEPENDENCIES/generic/include
Chris@1 160
Chris@11 161 plugindirs="$@"
Chris@11 162 if [ -z "$plugindirs" ]; then
Chris@11 163 plugindirs=$(cat .hgsub | grep -v vamp-plugin-sdk | grep -v vamp-plugin-tester | awk '{ print $1; }')
Chris@61 164 else
Chris@61 165 for dir in $plugindirs ; do
Chris@61 166 if [ ! -d "$dir" ]; then
Chris@61 167 echo "ERROR: Directory $dir not found"
Chris@61 168 usage
Chris@61 169 fi
Chris@61 170 done
Chris@11 171 fi
Chris@11 172
Chris@6 173 reportdir="REPORTS/$platform$bits"
Chris@49 174 packagedir="PACKAGES/$platform$bits"
Chris@49 175
Chris@49 176 mkdir -p "$reportdir" "$packagedir" || exit 1
Chris@6 177
Chris@9 178 built="/tmp/built.$$.txt"
Chris@9 179 testfailed="/tmp/testfailed.$$.txt"
Chris@19 180 envcheckfailed="/tmp/envcheckfailed.$$.txt"
Chris@9 181 notbuilt="/tmp/notbuilt.$$.txt"
Chris@49 182
Chris@19 183 trap 'rm -f "$built" "$envcheckfailed" "$testfailed" "$notbuilt"' 0
Chris@19 184 touch "$built" "$envcheckfailed" "$testfailed" "$notbuilt"
Chris@9 185
Chris@4 186 configure() {
Chris@4 187 dir="$1"
Chris@4 188 if [ -f "$dir/configure" ] ; then
Chris@73 189 ( cd "$dir" ; $configwrapper ./configure ) 2>&1 | \
Chris@73 190 tee "$reportdir/$dir.configure.txt"
Chris@73 191 return ${PIPESTATUS[0]}
Chris@4 192 fi
Chris@4 193 }
Chris@4 194
Chris@1 195 find_makefile() {
Chris@1 196 dir="$1"
Chris@9 197 for f in \
Chris@19 198 build/$platform$bits/Makefile.$platform$bits \
Chris@13 199 build/$platform/Makefile.$platform$bits \
Chris@19 200 build/$platform$bits/Makefile.$platform \
Chris@19 201 build/$platform$bits/Makefile \
Chris@19 202 build/Makefile.$platform$bits \
Chris@19 203 Makefile.$platform$bits \
Chris@13 204 build/$platform/Makefile.$platform \
Chris@13 205 build/$platform/Makefile \
Chris@13 206 build/Makefile.$platform \
Chris@9 207 Makefile.$platform \
Chris@13 208 Makefile ; do
Chris@1 209 if [ -f "$dir/$f" ]; then
Chris@1 210 echo $f
Chris@1 211 break
Chris@1 212 fi
Chris@1 213 done
Chris@1 214 }
Chris@1 215
Chris@13 216 configure_maybe() {
Chris@13 217 dir="$1"
Chris@43 218 if [ t"$do_rebuild" = t"yes" ]; then
Chris@43 219 configure "$dir"
Chris@43 220 else
Chris@43 221 mfile=$(find_makefile "$dir")
Chris@43 222 if [ -z "$mfile" ]; then
Chris@43 223 configure "$dir"
Chris@43 224 fi
Chris@13 225 fi
Chris@13 226 }
Chris@13 227
Chris@19 228 target_for() {
Chris@19 229 dir="$1"
Chris@19 230 if grep -q "^$dir: " METADATA/maketarget.txt ; then
Chris@19 231 grep "^$dir: " METADATA/maketarget.txt | head -1 | sed 's/^[^:]*: //'
Chris@19 232 fi
Chris@19 233 }
Chris@19 234
Chris@44 235 logfile_for() {
Chris@44 236 activity="$1"
Chris@44 237 dir="$2"
Chris@44 238 echo "$reportdir/$dir.$activity.txt"
Chris@44 239 }
Chris@44 240
Chris@4 241 build() {
Chris@4 242 dir="$1"
Chris@44 243 log=$(logfile_for build "$dir")
Chris@1 244 if configure_maybe "$dir"; then
Chris@1 245 mfile=$(find_makefile "$dir")
Chris@1 246 if [ -n "$mfile" ]; then
Chris@19 247 target=$(target_for "$dir")
Chris@19 248 TOOLPREFIX="$toolprefix" \
Chris@21 249 CXXFLAGS="-I${depincdir} -I${depincdir_generic} -I../vamp-plugin-sdk" \
Chris@21 250 LDFLAGS="-L${deplibdir} -L../vamp-plugin-sdk" \
Chris@21 251 ARCHFLAGS="$archflags" \
Chris@73 252 $makewrapper make -C "$dir" -f "$mfile" $target 2>&1 | \
Chris@44 253 tee "$log"
Chris@9 254 return ${PIPESTATUS[0]}
Chris@1 255 else
Chris@44 256 echo "Failed to find a Makefile in $dir!" | tee "$log"
Chris@4 257 return 1
Chris@1 258 fi
Chris@1 259 fi
Chris@4 260 }
Chris@4 261
Chris@4 262 rebuild() {
Chris@4 263 dir="$1"
Chris@44 264 log=$(logfile_for build "$dir")
Chris@13 265 if configure_maybe "$dir"; then
Chris@4 266 mfile=$(find_makefile "$dir")
Chris@4 267 if [ -n "$mfile" ]; then
Chris@73 268 if $makewrapper make -C "$dir" -f "$mfile" clean; then
Chris@32 269 build "$dir"
Chris@32 270 else
Chris@44 271 echo "Failed to 'make clean' in $dir!" | tee "$log"
Chris@32 272 return 1
Chris@32 273 fi
Chris@4 274 else
Chris@44 275 echo "Failed to find a Makefile in $dir!" | tee "$log"
Chris@4 276 return 1
Chris@4 277 fi
Chris@4 278 fi
Chris@4 279 }
Chris@4 280
Chris@22 281 build_or_rebuild() {
Chris@22 282 dir="$1"
Chris@22 283 if [ -n "$do_rebuild" ]; then
Chris@22 284 rebuild "$dir"
Chris@22 285 else
Chris@22 286 build "$dir"
Chris@22 287 fi
Chris@22 288 }
Chris@22 289
Chris@19 290 have_plugin() {
Chris@19 291 dir="$1"
Chris@44 292 log=$(logfile_for build "$dir")
Chris@19 293 for x in "$dir/"*"$pluginext"; do
Chris@19 294 if [ -f "$x" ]; then
Chris@36 295 if file "$x" | grep -q "$identpattern" ; then
Chris@36 296 return 0
Chris@36 297 else
Chris@44 298 echo "Plugin $x exists, but fails to match file type for correct platform (file type is: `file $x`, expected pattern is: $identpattern)" | tee "$log"
Chris@36 299 return 1
Chris@36 300 fi
Chris@19 301 fi
Chris@19 302 done
Chris@19 303 return 1
Chris@19 304 }
Chris@19 305
Chris@19 306 is_nondeterministic() {
Chris@19 307 plugin_id="$1"
Chris@19 308 grep -q "^$id\$" METADATA/nondeterministic.txt
Chris@19 309 }
Chris@19 310
Chris@44 311 plugin_ids_in() {
Chris@5 312 dir="$1"
Chris@40 313 # can't use sed to remove \r from DOS line endings -- BSD and GNU
Chris@44 314 # vary in how they interpret \r escape -- so we use perl for that...
Chris@44 315 VAMP_PATH="$dir" $hostwrapper \
Chris@44 316 vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids | \
Chris@44 317 grep '^vamp:' | \
Chris@44 318 sed 's/^vamp://' | \
Chris@44 319 perl -p -e 's/\r//g'
Chris@44 320 }
Chris@44 321
Chris@44 322 run_tester() {
Chris@44 323 ##!!! todo: timeout if the plugin takes too long and report as failure
Chris@44 324 dir="$1"
Chris@44 325 log=$(logfile_for test "$dir")
Chris@44 326 ids=$(plugin_ids_in "$dir")
Chris@44 327 cat /dev/null > "$log"
Chris@6 328 if [ -z "$ids" ]; then
Chris@6 329 echo
Chris@44 330 echo "No plugins reported to test in $dir" | tee -a "$log"
Chris@44 331 echo "$dir" >> "$testfailed"
Chris@44 332 return 1
Chris@44 333 fi
Chris@44 334 good=yes
Chris@44 335 for id in $ids; do
Chris@44 336 extra=""
Chris@44 337 if is_nondeterministic "$id"; then
Chris@44 338 extra="-n"
Chris@44 339 fi
Chris@44 340 echo "Running command: VAMP_PATH=\"$dir\" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext \"$extra\" \"$id\"" | tee -a "$log"
Chris@44 341 if ( VAMP_PATH="$dir" $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext "$extra" "$id" 2>&1 | tee -a "$log" ; exit ${PIPESTATUS[0]} ) ; then
Chris@62 342 echo "OK" | tee -a "$log"
Chris@44 343 else
Chris@62 344 echo | tee -a "$log"
Chris@44 345 echo "Tester failed for id $id: running again with valgrind (if available) and verbose for a report..." | tee -a "$log"
Chris@44 346 VAMP_PATH="$dir" $valgrind $hostwrapper vamp-plugin-tester/vamp-plugin-tester$hostext -v "$extra" "$id" 2>&1 | tee -a "$log"
Chris@44 347 good=no
Chris@44 348 fi
Chris@44 349 done
Chris@44 350 if [ "$good" != "yes" ]; then
Chris@23 351 echo "$dir" >> "$testfailed"
Chris@6 352 return 1
Chris@5 353 else
Chris@44 354 return 0
Chris@5 355 fi
Chris@5 356 }
Chris@5 357
Chris@44 358 public_symbols_in() {
Chris@9 359 lib="$1"
Chris@23 360 # nm -g prints global symbols in both OS/X and GNU tools, but
Chris@23 361 # printing only global *defined* symbols is harder. In GNU it is
Chris@23 362 # nm -g --defined-only; the OS/X docs suggest nm -gu should work,
Chris@23 363 # but it doesn't. What I think will work with both is simply
Chris@23 364 # grepping out the undefineds:
Chris@23 365 "$toolprefix"nm -g "$lib" | grep -v ' U ' | awk '{ print $3; }'
Chris@9 366 }
Chris@9 367
Chris@44 368 env_test_exports() {
Chris@44 369 dir="$1"
Chris@44 370 log=$(logfile_for envtest "$dir")
Chris@44 371 good=yes
Chris@44 372 for lib in "$dir"/*"$pluginext"; do
Chris@44 373 if [ ! -f "$lib" ]; then
Chris@44 374 # This should only happen if the glob was not expanded at all
Chris@44 375 echo "NOTE: no library found in $dir?" | tee -a "$log"
Chris@44 376 good=no
Chris@44 377 break
Chris@44 378 fi
Chris@44 379 echo
Chris@44 380 echo "Testing for exported symbols in $lib..."
Chris@44 381 if public_symbols_in "$lib" | grep -q vampGetPluginDescriptor; then
Chris@44 382 others=`public_symbols_in "$lib" | grep -v vampGetPluginDescriptor`
Chris@44 383 if [ -n "$others" ]; then
Chris@44 384 count=`echo "$others" | wc -l`
Chris@44 385 echo "ERROR: library $lib exports $count extra symbols in addition to vampGetPluginDescriptor" | tee -a "$log"
Chris@44 386 good=no
Chris@44 387 else
Chris@44 388 echo "GOOD: library $lib only exports vampGetPluginDescriptor" | tee -a "$log"
Chris@44 389 fi
Chris@44 390 else
Chris@44 391 echo "NOTE: found library $lib that is not a Vamp plugin library" | tee -a "$log"
Chris@44 392 fi
Chris@44 393 done
Chris@44 394 [ "$good" = "yes" ]
Chris@44 395 }
Chris@44 396
Chris@44 397 env_test_stdout() {
Chris@44 398 dir="$1"
Chris@44 399 log=$(logfile_for envtest "$dir")
Chris@44 400 good=yes
Chris@44 401 ids=$(VAMP_PATH="$dir" $hostwrapper vamp-plugin-sdk/host/vamp-simple-host$hostext --list-ids);
Chris@44 402 echo
Chris@44 403 echo "Testing for any unwanted output to stdout..."
Chris@44 404 for id in $ids; do
Chris@44 405 case "$id" in
Chris@44 406 vamp:*) ;;
Chris@44 407 *)
Chris@44 408 echo "ERROR: plugin in $dir prints to stdout as it runs: found text $id (should use stderr for debug logging to avoid mixing with batch output stream)" | tee -a "$log"
Chris@44 409 good=no
Chris@44 410 ;;
Chris@44 411 esac
Chris@44 412 done
Chris@44 413 [ "$good" = "yes" ]
Chris@44 414 }
Chris@44 415
Chris@44 416 env_test_cat() {
Chris@44 417 dir="$1"
Chris@44 418 log=$(logfile_for envtest "$dir")
Chris@44 419 good=yes
Chris@44 420 first=yes
Chris@44 421 echo
Chris@44 422 echo "Testing some details of .cat files..."
Chris@44 423 for catfile in "$dir"/*".cat"; do
Chris@44 424 if [ ! -f "$catfile" ]; then
Chris@44 425 # This should only happen if the glob was not expanded at all
Chris@44 426 echo "ERROR: no .cat file found in $dir" | tee -a "$log"
Chris@44 427 good=no
Chris@44 428 break
Chris@44 429 fi
Chris@44 430 if [ "$first" = "yes" ]; then
Chris@44 431 first=no
Chris@44 432 else
Chris@44 433 echo "NOTE: multiple .cat files found in $dir" | tee -a "$log"
Chris@44 434 fi
Chris@44 435 done
Chris@44 436 if [ "$good" = "yes" ]; then
Chris@46 437 excess=$(plugin_ids_in "$dir" | sed 's/^/vamp:/' | \
Chris@44 438 cat "$dir"/*".cat" - | \
Chris@47 439 sed 's/::.*//' | \
Chris@47 440 sort | \
Chris@47 441 uniq -u)
Chris@44 442 if [ -n "$excess" ]; then
Chris@47 443 echo "ERROR: excess or missing definitions in .cat file? $excess" | tee -a "$log"
Chris@44 444 good=no
Chris@44 445 else
Chris@47 446 echo "GOOD: no excess or missing definitions in .cat files" | tee -a "$log"
Chris@44 447 fi
Chris@44 448 fi
Chris@44 449 [ "$good" = "yes" ]
Chris@44 450 }
Chris@44 451
Chris@44 452 env_test_ttl() {
Chris@44 453 dir="$1"
Chris@44 454 log=$(logfile_for envtest "$dir")
Chris@44 455 good=yes
Chris@44 456 first=yes
Chris@44 457 echo
Chris@44 458 echo "Testing existence of RDF files..."
Chris@44 459 for ttlfile in "$dir"/*.{n3,ttl}; do
Chris@44 460 if [ ! -f "$ttlfile" ]; then
Chris@44 461 # Because we have two different extensions, this isn't an
Chris@44 462 # error as it is with e.g. .cat (because one or the other
Chris@44 463 # of .n3 and .ttl almost certainly won't exist). But if we
Chris@44 464 # drop out the bottom and first is still true, then we
Chris@44 465 # know neither matched.
Chris@44 466 :
Chris@44 467 elif [ "$first" = "yes" ]; then
Chris@44 468 first=no
Chris@44 469 else
Chris@44 470 echo "NOTE: multiple .ttl or .n3 files found in $dir" | tee -a "$log"
Chris@44 471 fi
Chris@44 472 done
Chris@45 473 if [ "$first" = "yes" ]; then
Chris@45 474 good=no;
Chris@45 475 else
Chris@45 476 echo "GOOD: found one or more .ttl or .n3 files (we don't actually test their validity or content here though)" | tee -a "$log"
Chris@45 477 fi
Chris@45 478 [ "$good" = "yes" ]
Chris@45 479 }
Chris@45 480
Chris@45 481 env_test_accompaniments() {
Chris@45 482 dir="$1"
Chris@45 483 log=$(logfile_for envtest "$dir")
Chris@45 484 good=yes
Chris@46 485 echo
Chris@46 486 echo "Testing existence of README and accompanying files..."
Chris@66 487 if ! ls -1 "$dir" | egrep -qi "^readme(.txt)?$"; then
Chris@45 488 echo "ERROR: no README file found" | tee -a "$log"
Chris@45 489 good=no
Chris@45 490 fi
Chris@53 491 if ! ls -1 "$dir" | egrep -qi "^(copying|licen[cs]e)(.txt)?$"; then
Chris@45 492 echo "ERROR: no COPYING or LICEN[CS]E file found" | tee -a "$log"
Chris@45 493 good=no
Chris@45 494 fi
Chris@53 495 if ! ls -1 "$dir" | egrep -qi "^citation(.txt)?$"; then
Chris@45 496 echo "NOTE: no CITATION file found" | tee -a "$log"
Chris@45 497 fi
Chris@44 498 [ "$good" = "yes" ]
Chris@44 499 }
Chris@44 500
Chris@9 501 run_environmental_tests() {
Chris@9 502 dir="$1"
Chris@44 503 log=$(logfile_for envtest "$dir")
Chris@44 504 allgood=yes
Chris@44 505 cat /dev/null > "$log"
Chris@45 506 for test in exports stdout cat ttl accompaniments; do
Chris@44 507 "env_test_$test" "$dir" || allgood=no
Chris@9 508 done
Chris@44 509 if [ "$allgood" != "yes" ]; then
Chris@19 510 echo "$dir" >> "$envcheckfailed"
Chris@44 511 return 1
Chris@44 512 else
Chris@44 513 return 0
Chris@19 514 fi
Chris@9 515 }
Chris@4 516
Chris@49 517 vcs_id() {
Chris@49 518 dir="$1"
Chris@49 519 ( cd "$dir" ;
Chris@49 520 if [ -d .hg ]; then
Chris@49 521 hg id | awk '{ print $1; }'
Chris@49 522 elif [ -d .git ]; then
Chris@49 523 git rev-parse --short HEAD
Chris@49 524 elif [ -d .svn ]; then
Chris@49 525 svn info | grep ^Revision | awk '{ print $2; }'
Chris@49 526 else
Chris@49 527 echo "unknown"
Chris@49 528 fi
Chris@49 529 )
Chris@49 530 }
Chris@49 531
Chris@49 532 package() {
Chris@49 533 dir="$1"
Chris@49 534 id=$(vcs_id "$dir")
Chris@53 535 pstub="$dir-$platform$bits-$id"
Chris@53 536 pdir="$packagedir/$pstub"
Chris@49 537 mkdir -p "$pdir"
Chris@49 538 ( cd "$dir" ;
Chris@49 539 cp -av \
Chris@49 540 *"$pluginext" \
Chris@49 541 *.cat \
Chris@49 542 *.n3 \
Chris@49 543 *.ttl \
Chris@49 544 [Rr][Ee][Aa][Dd][Mm][Ee]* \
Chris@49 545 [Cc][Oo][Pp][Yy][Ii][Nn][Gg]* \
Chris@49 546 [Ll][Ii][Cc][Ee][Nn][CcSs][Ee]* \
Chris@49 547 [Cc][Ii][Tt][Aa][Tt][Ii][Oo][Nn]* \
Chris@49 548 [Cc][Hh][Aa][Nn][Gg][Ee][Ll][Oo][Gg]* \
Chris@49 549 ../"$pdir"/
Chris@49 550 )
Chris@49 551 ( cd "$packagedir";
Chris@49 552 if [ "$platform" = "mingw" ]; then
Chris@54 553 zip -r "$pstub".zip "$pstub"
Chris@49 554 else
Chris@53 555 tar cvjf "$pstub".tar.bz2 "$pstub"
Chris@49 556 fi;
Chris@53 557 rm -rf "$pstub"
Chris@49 558 )
Chris@49 559 }
Chris@49 560
Chris@22 561 if ! build_or_rebuild "vamp-plugin-sdk"; then
Chris@5 562 echo "Failed to build Vamp plugin SDK!"
Chris@5 563 exit 1
Chris@5 564 fi
Chris@5 565
Chris@26 566 # Ensure we can only link statically against these
Chris@26 567 for x in vamp-hostsdk vamp-sdk; do
Chris@26 568 for y in dylib dll so; do
Chris@26 569 rm -f "vamp-plugin-sdk/lib$x.$y"
Chris@26 570 rm -f "vamp-plugin-sdk/$x.$y"
Chris@26 571 done
Chris@26 572 done
Chris@26 573
Chris@22 574 if ! build_or_rebuild "vamp-plugin-tester"; then
Chris@5 575 echo "Failed to build Vamp plugin tester!"
Chris@5 576 exit 1
Chris@5 577 fi
Chris@5 578
Chris@11 579 for dir in $plugindirs ; do
Chris@31 580 dir=${dir%/*}
Chris@4 581 echo
Chris@4 582 echo "Processing: $dir"
Chris@31 583 if [ ! -d "$dir" ]; then
Chris@31 584 echo "Directory $dir not found!"
Chris@31 585 echo "$dir" >> "$notbuilt"
Chris@31 586 elif build_or_rebuild "$dir"; then
Chris@19 587 if have_plugin "$dir" ; then
Chris@19 588 echo "$dir" >> "$built"
Chris@19 589 run_tester "$dir"
Chris@19 590 run_environmental_tests "$dir"
Chris@19 591 else
Chris@44 592 log=$(logfile_for build "$dir")
Chris@44 593 echo "Build apparently succeeded, but no resulting plugin(s) found, or plugin(s) have wrong file type or platform" | tee -a "$log"
Chris@19 594 echo "$dir" >> "$notbuilt"
Chris@19 595 fi
Chris@4 596 else
Chris@6 597 echo "$dir" >> "$notbuilt"
Chris@4 598 fi
Chris@44 599 slog=$(logfile_for summary "$dir")
Chris@44 600 cat /dev/null > "$slog"
Chris@1 601 done
Chris@1 602
Chris@49 603 cat "$built" | while read dir; do
Chris@49 604 package "$dir"
Chris@49 605 done
Chris@49 606
Chris@4 607 echo
Chris@49 608 echo "** Built, tested, checked, and packaged:"
Chris@44 609 cat "$built" | while read dir; do
Chris@44 610 slog=$(logfile_for summary "$dir")
Chris@44 611 if ! grep -q "^$dir\$" "$testfailed"; then
Chris@44 612 if ! grep -q "^$dir\$" "$envcheckfailed"; then
Chris@44 613 echo "$dir"
Chris@59 614 echo "$dir: OK: Success" >> "$slog"
Chris@32 615 fi
Chris@6 616 fi
Chris@6 617 done | sort
Chris@4 618
Chris@4 619 echo
Chris@19 620 echo "** Failed tests:"
Chris@44 621 cat "$testfailed" | sort | uniq | while read dir; do
Chris@44 622 slog=$(logfile_for summary "$dir")
Chris@44 623 echo "$dir"
Chris@59 624 echo "$dir: TEST_FAILED: Built successfully, but failed tests" >> "$slog"
Chris@6 625 done
Chris@5 626
Chris@5 627 echo
Chris@19 628 echo "** Failed environmental checks:"
Chris@44 629 cat "$envcheckfailed" | sort | uniq | while read dir; do
Chris@44 630 slog=$(logfile_for summary "$dir")
Chris@44 631 echo "$dir"
Chris@59 632 echo "$dir: ENV_FAILED: Built successfully, but failed environmental checks" >> "$slog"
Chris@19 633 done
Chris@19 634
Chris@19 635 echo
Chris@4 636 echo "** Failed to build:"
Chris@44 637 cat "$notbuilt" | sort | while read dir; do
Chris@44 638 slog=$(logfile_for summary "$dir")
Chris@44 639 echo "$dir"
Chris@59 640 echo "$dir: BUILD_FAILED: Failed to compile" >> "$slog"
Chris@6 641 done
Chris@4 642
Chris@4 643 echo