emscripten-buildbot.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. cd `dirname "$0"`
  9. cd ..
  10. SDLBASE=`pwd`
  11. if [ -z "$MAKE" ]; then
  12. OSTYPE=`uname -s`
  13. if [ "$OSTYPE" == "Linux" ]; then
  14. NCPU=`cat /proc/cpuinfo |grep vendor_id |wc -l`
  15. let NCPU=$NCPU+1
  16. elif [ "$OSTYPE" = "Darwin" ]; then
  17. NCPU=`sysctl -n hw.ncpu`
  18. elif [ "$OSTYPE" = "SunOS" ]; then
  19. NCPU=`/usr/sbin/psrinfo |wc -l |sed -e 's/^ *//g;s/ *$//g'`
  20. else
  21. NCPU=1
  22. fi
  23. if [ -z "$NCPU" ]; then
  24. NCPU=1
  25. elif [ "$NCPU" = "0" ]; then
  26. NCPU=1
  27. fi
  28. MAKE="make -j$NCPU"
  29. fi
  30. echo "\$MAKE is '$MAKE'"
  31. echo "Setting up Emscripten SDK environment..."
  32. source "$ENVSCRIPT"
  33. echo "Setting up..."
  34. set -e
  35. set -x
  36. cd "$SDLBASE"
  37. rm -rf buildbot
  38. mkdir buildbot
  39. cd buildbot
  40. echo "Configuring..."
  41. emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths"
  42. echo "Building..."
  43. emmake $MAKE
  44. set +x
  45. echo "Done! The library is in $SDLBASE/buildbot/build/.libs/libSDL2.a ..."
  46. exit 0
  47. # end of emscripten-buildbot.sh ...