2024-10-08 18:05:54 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# ^^^^^^^ Please try to keep this script Bourne-compatible.
|
2024-09-26 00:13:49 +02:00
|
|
|
########################################################################
|
|
|
|
# WARNING: emcc.sh is generated from emcc.sh.in by the configure
|
|
|
|
# process. Do not edit emcc.sh directly, as it may be deleted or
|
|
|
|
# overwritten by the configure script.
|
|
|
|
#
|
|
|
|
# A wrapper around the emcc compiler which uses configure-time state
|
|
|
|
# to locate the Emscripten SDK and import the SDK's environment
|
|
|
|
# script, if needed.
|
|
|
|
########################################################################
|
|
|
|
# EMSDK_HOME comes from the configure --with-emsdk=/dir flag.
|
|
|
|
# EMSDK_ENV is ${thatDir}/emsdk_env.sh and is also set by the
|
|
|
|
# configure process.
|
|
|
|
EMSDK_HOME="@EMSDK_HOME@"
|
|
|
|
EMSDK_ENV="@EMSDK_ENV@"
|
|
|
|
emcc="@BIN_EMCC@"
|
|
|
|
|
2024-10-22 14:56:00 +02:00
|
|
|
if [ x = "x${emcc}" ]; then
|
2024-10-08 18:05:54 +02:00
|
|
|
emcc=`which emcc 2>/dev/null`
|
2024-09-26 00:13:49 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ x = "x${emcc}" ]; then
|
|
|
|
# If emcc is not found in the path, try to find it via an emsdk
|
|
|
|
# installation. The SDK variant is the official installation
|
|
|
|
# style supported by the Emscripten folks, but emcc is also
|
|
|
|
# available via package managers on some OSes.
|
|
|
|
if [ x = "x${EMSDK_HOME}" ]; then
|
|
|
|
echo "EMSDK_HOME is not set. Pass --with-emsdk=/path/to/emsdk" \
|
|
|
|
"to the configure script." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ x = "x${EMSDK_ENV}" ]; then
|
|
|
|
if [ -f "${EMSDK_HOME}/emsdk_env.sh" ]; then
|
|
|
|
EMSDK_ENV="${EMSDK_HOME}/emsdk_env.sh"
|
|
|
|
else
|
|
|
|
echo "EMSDK_ENV is not set. Expecting configure script to set it." 1>&2
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "${EMSDK_ENV}" ]; then
|
|
|
|
echo "emsdk_env script not found: $EMSDK_ENV" 1>&2
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
|
|
|
# $EMSDK is part of the state set by emsdk_env.sh.
|
|
|
|
if [ x = "x${EMSDK}" ]; then
|
|
|
|
source "${EMSDK_ENV}" >/dev/null 2>&1 || {
|
|
|
|
# ^^^ unfortunately outputs lots of noise to stderr
|
|
|
|
rc=$?
|
|
|
|
echo "Error sourcing ${EMSDK_ENV}"
|
|
|
|
exit $rc
|
|
|
|
}
|
|
|
|
fi
|
2024-10-08 18:05:54 +02:00
|
|
|
emcc=`which emcc 2>/dev/null`
|
2024-09-26 00:13:49 +02:00
|
|
|
if [ x = "x${emcc}" ]; then
|
2024-10-08 18:05:54 +02:00
|
|
|
echo "emcc not found in PATH. Normally that's set up by ${EMSDK_ENV}." 1>&2
|
2024-09-26 00:13:49 +02:00
|
|
|
exit 4
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec emcc "$@"
|