🛠️🐜 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.

78 lines
1.7 KiB

  1. #!/bin/bash
  2. if [ -z "$SDKDIR" ]; then
  3. SDKDIR="/emsdk_portable"
  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=physfs-emscripten.tar.xz
  14. fi
  15. cd `dirname "$0"`
  16. cd ..
  17. PHYSFSBASE=`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. MAKECMD="$MAKE"
  39. unset MAKE # prevent warnings about jobserver mode.
  40. echo "Setting up Emscripten SDK environment..."
  41. source "$ENVSCRIPT"
  42. echo "Setting up..."
  43. cd "$PHYSFSBASE"
  44. rm -rf buildbot
  45. mkdir buildbot
  46. cd buildbot
  47. echo "Configuring..."
  48. emcmake cmake -G "Unix Makefiles" -DPHYSFS_BUILD_SHARED=False -DCMAKE_BUILD_TYPE=MinSizeRel .. || exit $?
  49. echo "Building..."
  50. emmake $MAKECMD || exit $?
  51. set -e
  52. rm -rf "$TARBALL" physfs-emscripten
  53. mkdir -p physfs-emscripten
  54. echo "Archiving to '$TARBALL' ..."
  55. cp ../src/physfs.h libphysfs.a physfs-emscripten
  56. chmod -R a+r physfs-emscripten
  57. chmod a+x physfs-emscripten
  58. chmod -R go-w physfs-emscripten
  59. tar -cJvvf "$TARBALL" physfs-emscripten
  60. echo "Done."
  61. exit 0
  62. # end of emscripten-buildbot.sh ...