Fossil SCM
Refactored the configure script's emsdk detection in the hopes that this reformulation will work on systems where emcc is installed via a package manager.
Commit
98dd262675a2fac157586353a93b79105da7e8522e77e3727007135208bc199f
Parent
b256c5bc7bb0b16…
2 files changed
+1
-1
+41
-33
M
auto.def
+1
-1
| --- auto.def | ||
| +++ auto.def | ||
| @@ -754,11 +754,11 @@ | ||
| 754 | 754 | # Linux can only infer the dependency on pthread from OpenSSL when |
| 755 | 755 | # doing dynamic linkage. |
| 756 | 756 | define-append LIBS -lpthread |
| 757 | 757 | } |
| 758 | 758 | |
| 759 | -if {[get-define EMSDK_ENV] ne ""} { | |
| 759 | +if {[get-define EMSDK_HOME] ne ""} { | |
| 760 | 760 | define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh |
| 761 | 761 | make-template tools/emcc.sh.in |
| 762 | 762 | catch {exec chmod u+x tools/emcc.sh} |
| 763 | 763 | } else { |
| 764 | 764 | define EMCC_WRAPPER "" |
| 765 | 765 |
| --- auto.def | |
| +++ auto.def | |
| @@ -754,11 +754,11 @@ | |
| 754 | # Linux can only infer the dependency on pthread from OpenSSL when |
| 755 | # doing dynamic linkage. |
| 756 | define-append LIBS -lpthread |
| 757 | } |
| 758 | |
| 759 | if {[get-define EMSDK_ENV] ne ""} { |
| 760 | define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh |
| 761 | make-template tools/emcc.sh.in |
| 762 | catch {exec chmod u+x tools/emcc.sh} |
| 763 | } else { |
| 764 | define EMCC_WRAPPER "" |
| 765 |
| --- auto.def | |
| +++ auto.def | |
| @@ -754,11 +754,11 @@ | |
| 754 | # Linux can only infer the dependency on pthread from OpenSSL when |
| 755 | # doing dynamic linkage. |
| 756 | define-append LIBS -lpthread |
| 757 | } |
| 758 | |
| 759 | if {[get-define EMSDK_HOME] ne ""} { |
| 760 | define EMCC_WRAPPER $::autosetup(dir)/../tools/emcc.sh |
| 761 | make-template tools/emcc.sh.in |
| 762 | catch {exec chmod u+x tools/emcc.sh} |
| 763 | } else { |
| 764 | define EMCC_WRAPPER "" |
| 765 |
+41
-33
| --- tools/emcc.sh.in | ||
| +++ tools/emcc.sh.in | ||
| @@ -12,41 +12,49 @@ | ||
| 12 | 12 | # EMSDK_ENV is ${thatDir}/emsdk_env.sh and is also set by the |
| 13 | 13 | # configure process. |
| 14 | 14 | EMSDK_HOME="@EMSDK_HOME@" |
| 15 | 15 | EMSDK_ENV="@EMSDK_ENV@" |
| 16 | 16 | |
| 17 | -if [ x = "x${EMSDK_HOME}" ]; then | |
| 18 | - echo "EMSDK_HOME is not set. Pass --with-emsdk=/path/to/emsdk" \ | |
| 19 | - "to the configure script." 1>&2 | |
| 20 | - exit 1 | |
| 21 | -fi | |
| 22 | - | |
| 23 | -if [ x = "x${EMSDK_ENV}" ]; then | |
| 24 | - if [ -f "${EMSDK_HOME}/emsdk_env.sh" ]; then | |
| 25 | - EMSDK_ENV="${EMSDK_HOME}/emsdk_env.sh" | |
| 26 | - else | |
| 27 | - echo "EMSDK_ENV is not set. Expecting configure script to set it." 1>&2 | |
| 28 | - exit 2 | |
| 29 | - fi | |
| 30 | -fi | |
| 31 | - | |
| 32 | -if [ ! -f "${EMSDK_ENV}" ]; then | |
| 33 | - echo "emsdk_env script not found: $EMSDK_ENV" 1>&2 | |
| 34 | - exit 3 | |
| 35 | -fi | |
| 36 | - | |
| 37 | -# $EMSDK is part of the state set by emsdk_env.sh. | |
| 38 | -if [ x = "x${EMSDK}" ]; then | |
| 39 | - source "${EMSDK_ENV}" >/dev/null 2>&1 || { | |
| 40 | - # ^^^ unfortunately outputs lots of noise to stderr | |
| 41 | - rc=$? | |
| 42 | - echo "Error sourcing ${EMSDK_ENV}" | |
| 43 | - exit $rc | |
| 44 | - } | |
| 45 | -fi | |
| 46 | - | |
| 47 | -if ! which emcc >/dev/null; then | |
| 48 | - echo "emcc not found in PATH. Expecting EMSDK_ENV to set that." 1>&2 | |
| 49 | - exit 4 | |
| 17 | +emcc=$(which emcc 2>/dev/null) | |
| 18 | + | |
| 19 | +if [ x = "x${emcc}" ]; then | |
| 20 | + # If emcc is not found in the path, try to find it via an emsdk | |
| 21 | + # installation. The SDK variant is the official installation | |
| 22 | + # style supported by the Emscripten folks, but emcc is also | |
| 23 | + # available via package managers on some OSes. | |
| 24 | + if [ x = "x${EMSDK_HOME}" ]; then | |
| 25 | + echo "EMSDK_HOME is not set. Pass --with-emsdk=/path/to/emsdk" \ | |
| 26 | + "to the configure script." 1>&2 | |
| 27 | + exit 1 | |
| 28 | + fi | |
| 29 | + | |
| 30 | + if [ x = "x${EMSDK_ENV}" ]; then | |
| 31 | + if [ -f "${EMSDK_HOME}/emsdk_env.sh" ]; then | |
| 32 | + EMSDK_ENV="${EMSDK_HOME}/emsdk_env.sh" | |
| 33 | + else | |
| 34 | + echo "EMSDK_ENV is not set. Expecting configure script to set it." 1>&2 | |
| 35 | + exit 2 | |
| 36 | + fi | |
| 37 | + fi | |
| 38 | + | |
| 39 | + if [ ! -f "${EMSDK_ENV}" ]; then | |
| 40 | + echo "emsdk_env script not found: $EMSDK_ENV" 1>&2 | |
| 41 | + exit 3 | |
| 42 | + fi | |
| 43 | + | |
| 44 | + # $EMSDK is part of the state set by emsdk_env.sh. | |
| 45 | + if [ x = "x${EMSDK}" ]; then | |
| 46 | + source "${EMSDK_ENV}" >/dev/null 2>&1 || { | |
| 47 | + # ^^^ unfortunately outputs lots of noise to stderr | |
| 48 | + rc=$? | |
| 49 | + echo "Error sourcing ${EMSDK_ENV}" | |
| 50 | + exit $rc | |
| 51 | + } | |
| 52 | + fi | |
| 53 | + emcc=$(which emcc 2>/dev/null) | |
| 54 | + if [ x = "x${emcc}" ]; then | |
| 55 | + echo "emcc not found in PATH. Normally that's set up by EMSDK_ENV." 1>&2 | |
| 56 | + exit 4 | |
| 57 | + fi | |
| 50 | 58 | fi |
| 51 | 59 | |
| 52 | 60 | exec emcc "$@" |
| 53 | 61 |
| --- tools/emcc.sh.in | |
| +++ tools/emcc.sh.in | |
| @@ -12,41 +12,49 @@ | |
| 12 | # EMSDK_ENV is ${thatDir}/emsdk_env.sh and is also set by the |
| 13 | # configure process. |
| 14 | EMSDK_HOME="@EMSDK_HOME@" |
| 15 | EMSDK_ENV="@EMSDK_ENV@" |
| 16 | |
| 17 | if [ x = "x${EMSDK_HOME}" ]; then |
| 18 | echo "EMSDK_HOME is not set. Pass --with-emsdk=/path/to/emsdk" \ |
| 19 | "to the configure script." 1>&2 |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
| 23 | if [ x = "x${EMSDK_ENV}" ]; then |
| 24 | if [ -f "${EMSDK_HOME}/emsdk_env.sh" ]; then |
| 25 | EMSDK_ENV="${EMSDK_HOME}/emsdk_env.sh" |
| 26 | else |
| 27 | echo "EMSDK_ENV is not set. Expecting configure script to set it." 1>&2 |
| 28 | exit 2 |
| 29 | fi |
| 30 | fi |
| 31 | |
| 32 | if [ ! -f "${EMSDK_ENV}" ]; then |
| 33 | echo "emsdk_env script not found: $EMSDK_ENV" 1>&2 |
| 34 | exit 3 |
| 35 | fi |
| 36 | |
| 37 | # $EMSDK is part of the state set by emsdk_env.sh. |
| 38 | if [ x = "x${EMSDK}" ]; then |
| 39 | source "${EMSDK_ENV}" >/dev/null 2>&1 || { |
| 40 | # ^^^ unfortunately outputs lots of noise to stderr |
| 41 | rc=$? |
| 42 | echo "Error sourcing ${EMSDK_ENV}" |
| 43 | exit $rc |
| 44 | } |
| 45 | fi |
| 46 | |
| 47 | if ! which emcc >/dev/null; then |
| 48 | echo "emcc not found in PATH. Expecting EMSDK_ENV to set that." 1>&2 |
| 49 | exit 4 |
| 50 | fi |
| 51 | |
| 52 | exec emcc "$@" |
| 53 |
| --- tools/emcc.sh.in | |
| +++ tools/emcc.sh.in | |
| @@ -12,41 +12,49 @@ | |
| 12 | # EMSDK_ENV is ${thatDir}/emsdk_env.sh and is also set by the |
| 13 | # configure process. |
| 14 | EMSDK_HOME="@EMSDK_HOME@" |
| 15 | EMSDK_ENV="@EMSDK_ENV@" |
| 16 | |
| 17 | emcc=$(which emcc 2>/dev/null) |
| 18 | |
| 19 | if [ x = "x${emcc}" ]; then |
| 20 | # If emcc is not found in the path, try to find it via an emsdk |
| 21 | # installation. The SDK variant is the official installation |
| 22 | # style supported by the Emscripten folks, but emcc is also |
| 23 | # available via package managers on some OSes. |
| 24 | if [ x = "x${EMSDK_HOME}" ]; then |
| 25 | echo "EMSDK_HOME is not set. Pass --with-emsdk=/path/to/emsdk" \ |
| 26 | "to the configure script." 1>&2 |
| 27 | exit 1 |
| 28 | fi |
| 29 | |
| 30 | if [ x = "x${EMSDK_ENV}" ]; then |
| 31 | if [ -f "${EMSDK_HOME}/emsdk_env.sh" ]; then |
| 32 | EMSDK_ENV="${EMSDK_HOME}/emsdk_env.sh" |
| 33 | else |
| 34 | echo "EMSDK_ENV is not set. Expecting configure script to set it." 1>&2 |
| 35 | exit 2 |
| 36 | fi |
| 37 | fi |
| 38 | |
| 39 | if [ ! -f "${EMSDK_ENV}" ]; then |
| 40 | echo "emsdk_env script not found: $EMSDK_ENV" 1>&2 |
| 41 | exit 3 |
| 42 | fi |
| 43 | |
| 44 | # $EMSDK is part of the state set by emsdk_env.sh. |
| 45 | if [ x = "x${EMSDK}" ]; then |
| 46 | source "${EMSDK_ENV}" >/dev/null 2>&1 || { |
| 47 | # ^^^ unfortunately outputs lots of noise to stderr |
| 48 | rc=$? |
| 49 | echo "Error sourcing ${EMSDK_ENV}" |
| 50 | exit $rc |
| 51 | } |
| 52 | fi |
| 53 | emcc=$(which emcc 2>/dev/null) |
| 54 | if [ x = "x${emcc}" ]; then |
| 55 | echo "emcc not found in PATH. Normally that's set up by EMSDK_ENV." 1>&2 |
| 56 | exit 4 |
| 57 | fi |
| 58 | fi |
| 59 | |
| 60 | exec emcc "$@" |
| 61 |