From aca8ce1535dcd030ac994a306e78b7588ffe95ac Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 27 Jan 2023 17:14:55 +0000 Subject: [PATCH] Extract emcc version in JS build and use it to conditionally set build flags. Initially a workaround for [https://github.com/emscripten-core/emscripten/issues/18610|Emscripten ticket #18610] but may have other uses. FossilOrigin-Name: 3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 --- ext/wasm/GNUmakefile | 16 ++++++++++++++-- manifest | 12 ++++++------ manifest.uuid | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index fa46c9633a..143ee8b9f1 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -59,6 +59,13 @@ emcc.bin ?= $(word 1,$(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc) $(shell ifeq (,$(emcc.bin)) $(error Cannot find emcc.) endif +emcc.version := $(shell "$(emcc.bin)" --version | sed -n 1p \ + | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;') +ifeq (,$(emcc.version)) + $(warning Cannot determine emcc version. This might unduly impact build flags.) +else + $(info using emcc version [$(emcc.version)]) +endif wasm-strip ?= $(shell which wasm-strip 2>/dev/null) ifeq (,$(filter clean,$(MAKECMDGOALS))) @@ -501,7 +508,6 @@ emcc.cflags := emcc.cflags += -std=c99 -fPIC # -------------^^^^^^^^ we need c99 for $(sqlite3-wasm.c). emcc.cflags += -I. -I$(dir.top) - ######################################################################## # emcc flags specific to building .js/.wasm files... emcc.jsflags := -fPIC @@ -509,7 +515,6 @@ emcc.jsflags += --minify 0 emcc.jsflags += --no-entry emcc.jsflags += -sWASM_BIGINT=$(emcc.WASM_BIGINT) emcc.jsflags += -sMODULARIZE -emcc.jsflags += -sSTRICT_JS emcc.jsflags += -sDYNAMIC_EXECUTION=0 emcc.jsflags += -sNO_POLYFILL emcc.jsflags += -sEXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS.api) @@ -519,6 +524,13 @@ emcc.exportedRuntimeMethods := \ emcc.jsflags += $(emcc.exportedRuntimeMethods) emcc.jsflags += -sUSE_CLOSURE_COMPILER=0 emcc.jsflags += -sIMPORTED_MEMORY +ifeq (3.1.31,$(emcc.version)) + emcc.jsflags += -sSTRICT_JS=0 + $(warning Disabling -sSTRICT_JS for emcc $(emcc.version): \ + https://github.com/emscripten-core/emscripten/issues/18610) +else + emcc.jsflags += -sSTRICT_JS=1 +endif emcc.environment := -sENVIRONMENT=web,worker ######################################################################## # -sINITIAL_MEMORY: How much memory we need to start with is governed diff --git a/manifest b/manifest index fc03db56d3..fd21e7b6dc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Work\saround\supstream\semscripten\s3.1.31\sbug\s[https://github.com/emscripten-core/emscripten/issues/18609]. -D 2023-01-27T05:14:34.038 +C Extract\semcc\sversion\sin\sJS\sbuild\sand\suse\sit\sto\sconditionally\sset\sbuild\sflags.\sInitially\sa\sworkaround\sfor\s[https://github.com/emscripten-core/emscripten/issues/18610|Emscripten\sticket\s#18610]\sbut\smay\shave\sother\suses. +D 2023-01-27T17:14:55.199 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,7 +466,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile e1bd4abe13929dbc4fd9da06d189c61d28fc7a539b2cab942f6300172539d8a5 +F ext/wasm/GNUmakefile 31cf62436f306eed8c8aa66991653395f62e52af7ad21a0de02f7d780cb8c398 F ext/wasm/README-dist.txt dab111337028af58ec11cb35c2e1a82398217c399c7499fefab0509a0499a5d7 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab @@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4 -R 652518ccc6e34aeabd9f5e7c9c0f903b +P fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a +R 3675add13eb3ce53caed9c7b4b0b8fb4 U stephan -Z 9f5aabec0ec6e83053759380211a0e0c +Z e36df8532ba6c8eb3243e966cb4c4025 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1ff4d9398a..df7e52ee6d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fa784101775b795077a23c211b5b16f51ad5a13967c284511f310dfcbfa9f77a \ No newline at end of file +3773934e91c20ca2433cc414aaba75de9a4a4318fd1126fb781dba510ddefd94 \ No newline at end of file