🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.8 KiB

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