build.sh 942 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. if [ "$1" = "" ]; then
  3. echo "usage: $0 <platform> [<sourcedir>]"
  4. exit 0
  5. else
  6. PLATFORM="$1"
  7. shift
  8. fi
  9. BASEDIR=`dirname $0`
  10. if [ ! -f "$BASEDIR/$PLATFORM.sh" ]; then
  11. echo "Unknown port: $PLATFORM"
  12. exit 0
  13. fi
  14. . "$BASEDIR/global.sh"
  15. . "$BASEDIR/$PLATFORM.sh"
  16. if [ "$1" = "" ]; then
  17. pushd $HOME/megazeux >/dev/null
  18. else
  19. pushd $1 >/dev/null
  20. shift
  21. fi
  22. LOGDIR=build/logs/$PLATFORM
  23. rm -rf build/$PLATFORM build/dist/$PLATFORM $LOGDIR
  24. mkdir -p $LOGDIR
  25. export ERRNO=0
  26. platform_enter_hook
  27. ./config.sh $CONFIG_FLAGS 2>&1 | tee $LOGDIR/config.log
  28. make -j3 $BUILD_FLAGS 2>&1 | tee $LOGDIR/build.log
  29. platform_build_test_hook
  30. if [ "$ERRNO" = "0" ]; then
  31. make archive 2>&1 | tee $LOGDIR/archive.log
  32. platform_archive_test_hook
  33. if [ "$ERRNO" != "0" ]; then
  34. echo "Archive test failed, aborting.."
  35. fi
  36. else
  37. echo "Build test failed, aborting.."
  38. fi
  39. make distclean >/dev/null 2>&1
  40. platform_exit_hook
  41. popd >/dev/null
  42. exit $ERRNO