You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2024/10/13 23:22:04 UTC
(couchdb) 03/04: feat(quickjs): LTO and static linking pthreads on Win (#5299)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch catch-up.3.4.x-from-main-3
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit ab56a1e8410683e2ee275c215dd7697e9a2a2f50
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Sun Oct 13 20:16:42 2024 +0200
feat(quickjs): LTO and static linking pthreads on Win (#5299)
Enable link-time-optimization (LTO) for QuickJS on Windows and
link the pthreads library statically into couchjs_[mainjs|coffee].exe.
---
src/couch_quickjs/rebar.config.script | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/couch_quickjs/rebar.config.script b/src/couch_quickjs/rebar.config.script
index bf4655a85..a07c19c7a 100644
--- a/src/couch_quickjs/rebar.config.script
+++ b/src/couch_quickjs/rebar.config.script
@@ -18,7 +18,7 @@ Msys = "msys2_shell.cmd -defterm -no-start -ucrt64 -here -lc ".
PreHooks = [
{"(linux|darwin)", compile, "make CONFIG_LTO=y -C quickjs -j8 libquickjs.lto.a qjsc"},
{"freebsd", compile, "gmake -C quickjs -j8 libquickjs.a qjsc"},
- {"win32", compile, Msys ++ "'make -C quickjs qjsc'"},
+ {"win32", compile, Msys ++ "'make CONFIG_LTO=y -C quickjs -j8 libquickjs.lto.a qjsc'"},
{"(linux|darwin|freebsd|win32)", compile, "escript build_js.escript compile"}
].
@@ -49,7 +49,8 @@ FreeBSDEnv = [
] ++ ResetFlags.
WindowsEnv = [
- {"CFLAGS", "-D_GNU_SOURCE -DCONFIG_BIGNUM -O2 -fwrapv -DCONFIG_VERSION=\\\"0\\\" -Iquickjs"},
+ {"CFLAGS", "-flto -D_GNU_SOURCE -DCONFIG_BIGNUM -DCONFIG_LTO=y -O2 -fwrapv -DCONFIG_VERSION=\\\"0\\\" -Iquickjs"},
+ {"LDFLAGS", "$LDFLAGS -flto -lm -Wl,-Bstatic -lpthread quickjs/libquickjs.lto.a"},
{"EXE_CC_TEMPLATE", "gcc.exe -g -c $CFLAGS $PORT_IN_FILES -o $PORT_OUT_FILE"},
{"EXE_LINK_TEMPLATE", "gcc.exe -g -lm $PORT_IN_FILES $LDFLAGS -o $PORT_OUT_FILE"}
].