emscripten-buildbot.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. mkdir buildbot
  42. pushd buildbot
  43. echo "Configuring..."
  44. 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="$PWD/emscripten-sdl2-installed" || exit $?
  45. echo "Building..."
  46. emmake $MAKE || exit $?
  47. echo "Moving things around..."
  48. emmake $MAKE install || exit $?
  49. # Fix up a few things to a real install path
  50. perl -w -pi -e "s#$PWD/emscripten-sdl2-installed#/usr/local#g;" ./emscripten-sdl2-installed/lib/libSDL2.la ./emscripten-sdl2-installed/lib/pkgconfig/sdl2.pc ./emscripten-sdl2-installed/bin/sdl2-config
  51. mkdir -p ./usr
  52. mv ./emscripten-sdl2-installed ./usr/local
  53. popd
  54. tar -cJvvf $TARBALL -C buildbot usr
  55. rm -rf buildbot
  56. exit 0
  57. # end of emscripten-buildbot.sh ...