Fossil SCM
| a3843d4… | stephan | 1 | #!/bin/sh |
| a3843d4… | stephan | 2 | # ^^^^^^^ Please try to keep this script Bourne-compatible. |
| 7fcb462… | stephan | 3 | ######################################################################## |
| 7fcb462… | stephan | 4 | # WARNING: emcc.sh is generated from emcc.sh.in by the configure |
| 7fcb462… | stephan | 5 | # process. Do not edit emcc.sh directly, as it may be deleted or |
| 7fcb462… | stephan | 6 | # overwritten by the configure script. |
| 7fcb462… | stephan | 7 | # |
| 7fcb462… | stephan | 8 | # A wrapper around the emcc compiler which uses configure-time state |
| 7fcb462… | stephan | 9 | # to locate the Emscripten SDK and import the SDK's environment |
| 7fcb462… | stephan | 10 | # script, if needed. |
| 7fcb462… | stephan | 11 | ######################################################################## |
| 7fcb462… | stephan | 12 | # EMSDK_HOME comes from the configure --with-emsdk=/dir flag. |
| a3843d4… | stephan | 13 | # EMSDK_ENV_SH is ${thatDir}/emsdk_env.sh and is also set by the |
| 7fcb462… | stephan | 14 | # configure process. |
| 7fcb462… | stephan | 15 | EMSDK_HOME="@EMSDK_HOME@" |
| a3843d4… | stephan | 16 | EMSDK_ENV_SH="@EMSDK_ENV_SH@" |
| a3843d4… | stephan | 17 | emcc="@BIN_EMCC@" |
| 7fcb462… | stephan | 18 | |
| a3843d4… | stephan | 19 | if [ x = "x${emcc}" ]; then |
| a3843d4… | stephan | 20 | emcc=`which emcc 2>/dev/null` |
| a3843d4… | stephan | 21 | fi |
| 7fcb462… | stephan | 22 | |
| 7fcb462… | stephan | 23 | if [ x = "x${emcc}" ]; then |
| 7fcb462… | stephan | 24 | # If emcc is not found in the path, try to find it via an emsdk |
| a3843d4… | stephan | 25 | # installation. The SDK variant is the official installation style |
| a3843d4… | stephan | 26 | # supported by the Emscripten project, but emcc is also available |
| a3843d4… | stephan | 27 | # via package managers on some OSes. |
| 7fcb462… | stephan | 28 | if [ x = "x${EMSDK_HOME}" ]; then |
| 7fcb462… | stephan | 29 | echo "EMSDK_HOME is not set. Pass --with-emsdk=/path/to/emsdk" \ |
| 7fcb462… | stephan | 30 | "to the configure script." 1>&2 |
| 7fcb462… | stephan | 31 | exit 1 |
| 7fcb462… | stephan | 32 | fi |
| 7fcb462… | stephan | 33 | |
| a3843d4… | stephan | 34 | if [ x = "x${EMSDK_ENV_SH}" ]; then |
| 7fcb462… | stephan | 35 | if [ -f "${EMSDK_HOME}/emsdk_env.sh" ]; then |
| a3843d4… | stephan | 36 | EMSDK_ENV_SH="${EMSDK_HOME}/emsdk_env.sh" |
| 7fcb462… | stephan | 37 | else |
| a3843d4… | stephan | 38 | echo "EMSDK_ENV_SH is not set. Expecting configure script to set it." 1>&2 |
| 7fcb462… | stephan | 39 | exit 2 |
| 7fcb462… | stephan | 40 | fi |
| 7fcb462… | stephan | 41 | fi |
| 7fcb462… | stephan | 42 | |
| a3843d4… | stephan | 43 | if [ ! -f "${EMSDK_ENV_SH}" ]; then |
| a3843d4… | stephan | 44 | echo "emsdk_env script not found: $EMSDK_ENV_SH" 1>&2 |
| 7fcb462… | stephan | 45 | exit 3 |
| 7fcb462… | stephan | 46 | fi |
| 7fcb462… | stephan | 47 | |
| 7fcb462… | stephan | 48 | # $EMSDK is part of the state set by emsdk_env.sh. |
| 7fcb462… | stephan | 49 | if [ x = "x${EMSDK}" ]; then |
| a3843d4… | stephan | 50 | EMSDK_QUIET=1 |
| a3843d4… | stephan | 51 | export EMSDK_QUIET |
| a3843d4… | stephan | 52 | # ^^^ Squelches informational output from ${EMSDK_ENV_SH}. |
| a3843d4… | stephan | 53 | source "${EMSDK_ENV_SH}" || { |
| 7fcb462… | stephan | 54 | rc=$? |
| a3843d4… | stephan | 55 | echo "Error sourcing ${EMSDK_ENV_SH}" |
| 7fcb462… | stephan | 56 | exit $rc |
| 7fcb462… | stephan | 57 | } |
| 7fcb462… | stephan | 58 | fi |
| a3843d4… | stephan | 59 | emcc=`which emcc 2>/dev/null` |
| 7fcb462… | stephan | 60 | if [ x = "x${emcc}" ]; then |
| a3843d4… | stephan | 61 | echo "emcc not found in PATH. Normally that's set up by ${EMSDK_ENV_SH}." 1>&2 |
| 7fcb462… | stephan | 62 | exit 4 |
| 7fcb462… | stephan | 63 | fi |
| 7fcb462… | stephan | 64 | fi |
| 7fcb462… | stephan | 65 | |
| f020f45… | stephan | 66 | exec $emcc "$@" |