emscripten-buildbot.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. SDKDIR="/emsdk_portable"
  3. ENVSCRIPT="$SDKDIR/emsdk_env.sh"
  4. if [ ! -f "$ENVSCRIPT" ]; then
  5. echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2
  6. exit 1
  7. fi
  8. TARBALL="$1"
  9. if [ -z $1 ]; then
  10. TARBALL=sdl-emscripten.tar.xz
  11. fi
  12. cd `dirname "$0"`
  13. cd ..
  14. SDLBASE=`pwd`
  15. if [ -z "$MAKE" ]; then
  16. OSTYPE=`uname -s`
  17. if [ "$OSTYPE" == "Linux" ]; then
  18. NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
  19. let NCPU=$NCPU+1
  20. elif [ "$OSTYPE" = "Darwin" ]; then
  21. NCPU=`sysctl -n hw.ncpu`
  22. elif [ "$OSTYPE" = "SunOS" ]; then
  23. NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
  24. else
  25. NCPU=1
  26. fi
  27. if [ -z "$NCPU" ]; then
  28. NCPU=1
  29. elif [ "$NCPU" = "0" ]; then
  30. NCPU=1
  31. fi
  32. MAKE="make -j$NCPU"
  33. fi
  34. echo "\$MAKE is '$MAKE'"
  35. echo "Setting up Emscripten SDK environment..."
  36. source "$ENVSCRIPT"
  37. echo "Setting up..."
  38. set -x
  39. cd "$SDLBASE"
  40. rm -rf buildbot
  41. rm -rf emscripten-sdl2-installed
  42. mkdir buildbot
  43. pushd buildbot
  44. echo "Configuring..."
  45. emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$SDLBASE/emscripten-sdl2-installed"
  46. echo "Building..."
  47. emmake $MAKE
  48. echo "Moving things around..."
  49. emmake $MAKE install
  50. mkdir -p ./usr
  51. mv "$SDLBASE/emscripten-sdl2-installed" ./usr/local
  52. popd
  53. tar -cJvvf $TARBALL -C buildbot usr
  54. rm -rf buildbot
  55. exit 0
  56. # end of emscripten-buildbot.sh ...