From 0a375179fa71f562f171a7b9696156b354865e7b Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Wed, 15 Jul 2026 20:18:38 +0800 Subject: [PATCH 1/7] SEP --- devel/0747.md | 11 +++++ xmake/goldfish.lua | 98 +++++++++++++++----------------------- xmake/options.lua | 5 ++ xmake/requires.lua | 4 +- xmake/targets/libmogan.lua | 4 +- xmake/targets/stem.lua | 6 ++- xmake/tests.lua | 8 +++- 7 files changed, 72 insertions(+), 64 deletions(-) create mode 100644 devel/0747.md diff --git a/devel/0747.md b/devel/0747.md new file mode 100644 index 0000000000..e9258a733d --- /dev/null +++ b/devel/0747.md @@ -0,0 +1,11 @@ +# [0747] 添加选项排除 goldfish + +## What +在 options.lua 中添加了选项排除 goldfish 构建 + +## 如何测试 +``` +xmake f -m debug --goldfish=no +xmake b stem +``` +观察无 goldfish 构建产物 diff --git a/xmake/goldfish.lua b/xmake/goldfish.lua index be7610b714..8ef7b8abd0 100644 --- a/xmake/goldfish.lua +++ b/xmake/goldfish.lua @@ -26,23 +26,29 @@ package("goldfish") package:add("deps", "argh v1.3.2") end) - on_install("bsd", "cross", "cygwin", "linux", "macosx", "mingw", "msys", "wasm", "windows", function (package) - -- 在包缓存目录中构建,保持工作树干净。先把内置的 s7 源码和我们的 - -- port/xmake.lua(定义了 libgoldfish 静态库 target)拷进缓存目录, - -- 再交给 package.tools.xmake 构建。这里必须由我们自己放置 xmake.lua, - -- 否则 xmake 会自动生成默认工程(把 s7.c 误当成二进制 target 链接, - -- 报缺少 _main)。 - -- {curdir = curdir} 告诉 package.tools.xmake 在该缓存目录下执行 - -- xmake f/build/install。 - local curdir = package:cachedir() - os.cp(path.join(goldfish_src, "*.c"), curdir) - os.cp(path.join(goldfish_src, "*.h"), curdir) - io.writefile(path.join(curdir, "xmake.lua"), [[ -add_rules("mode.release", "mode.debug") + on_test(function (package) + assert(package:check_csnippets([[ + static s7_pointer old_add; /* the original "+" function for non-string cases */ + static s7_pointer old_string_append; /* same, for "string-append" */ + + static s7_pointer our_add(s7_scheme *sc, s7_pointer args) + { + /* this will replace the built-in "+" operator, extending it to include strings: + * (+ "hi" "ho") -> "hiho" and (+ 3 4) -> 7 + */ + if ((s7_is_pair(args)) && + (s7_is_string(s7_car(args)))) + return(s7_apply_function(sc, old_string_append, args)); + return(s7_apply_function(sc, old_add, args)); + } + ]], {includes = "s7.h"})) + end) +package_end() target("libgoldfish") do set_kind("$(kind)") set_languages("c11") + add_packages("liii-tbox") add_defines("WITH_SYSTEM_EXTRAS=0") if not is_plat("wasm") then add_defines("HAVE_OVERFLOW_CHECKS=0") @@ -51,25 +57,25 @@ target("libgoldfish") do add_defines("WITH_R7RS=1") set_basename("goldfish") add_files( - "s7.c", - "s7_continuation.c", - "s7_ctables.c", - "s7_dtoa.c", - "s7_module.c", - "s7_op_names.c", - "s7_scheme_base.c", - "s7_scheme_char.c", - "s7_scheme_complex.c", - "s7_scheme_format.c", - "s7_scheme_inexact.c", - "s7_scheme_predicate.c", - "s7_scheme_symbol.c", - "s7_scheme_write.c", - "s7_liii_bitwise.c", - "s7_liii_hash_table.c", - "s7_liii_list.c", - "s7_liii_string.c", - "s7_liii_vector.c" + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_continuation.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_ctables.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_dtoa.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_module.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_op_names.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_base.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_char.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_complex.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_format.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_inexact.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_predicate.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_symbol.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_write.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_bitwise.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_hash_table.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_list.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_string.c", + "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_vector.c" ) add_headerfiles("$(curdir)/s7.h") add_includedirs(".", {public = true}) @@ -80,37 +86,11 @@ target("libgoldfish") do if is_mode("debug") then add_defines("S7_DEBUGGING") end - add_packages("liii-tbox") end -]]) - local configs = {} - if package:config("shared") then - configs.kind = "shared" - end - import("package.tools.xmake").install(package, configs, {curdir = curdir}) - end) - - on_test(function (package) - assert(package:check_csnippets([[ - static s7_pointer old_add; /* the original "+" function for non-string cases */ - static s7_pointer old_string_append; /* same, for "string-append" */ - - static s7_pointer our_add(s7_scheme *sc, s7_pointer args) - { - /* this will replace the built-in "+" operator, extending it to include strings: - * (+ "hi" "ho") -> "hiho" and (+ 3 4) -> 7 - */ - if ((s7_is_pair(args)) && - (s7_is_string(s7_car(args)))) - return(s7_apply_function(sc, old_string_append, args)); - return(s7_apply_function(sc, old_add, args)); - } - ]], {includes = "s7.h"})) - end) -package_end() target ("goldfish") do set_languages("c++17") + add_deps("libgoldfish") set_targetdir("$(projectdir)/TeXmacs/plugins/goldfish/bin/") add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp") add_files({ diff --git a/xmake/options.lua b/xmake/options.lua index 31d9e65530..8b9237d487 100644 --- a/xmake/options.lua +++ b/xmake/options.lua @@ -29,6 +29,11 @@ option("pdfhummus") set_description("Enable PDFHummus plugin") option_end() +option("goldfish") + set_default(true) + set_description("Enable Goldfish plugin") +option_end() + option("mupdf") set_default(true) set_description("Enable MuPDF library") diff --git a/xmake/requires.lua b/xmake/requires.lua index 8923fe90da..0c8f25d17f 100644 --- a/xmake/requires.lua +++ b/xmake/requires.lua @@ -8,7 +8,9 @@ -- It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE -- in the root directory or . -add_requires("goldfish", {system=false}) +if has_config("goldfish") then + add_requires("goldfish", {system=false}) +end add_requires("liii-tbox", {system=false}) if not is_plat("wasm") then add_requires("cpr", {system=false}) diff --git a/xmake/targets/libmogan.lua b/xmake/targets/libmogan.lua index 96840ae489..7996a20dac 100644 --- a/xmake/targets/libmogan.lua +++ b/xmake/targets/libmogan.lua @@ -85,7 +85,9 @@ target("libmogan") do add_packages("liii-pdfhummus") end add_packages("freetype") - add_packages("goldfish") + if has_config("goldfish") then + add_packages("goldfish") + end add_packages("liii-tbox") if not is_plat("wasm") then add_packages("cpr") diff --git a/xmake/targets/stem.lua b/xmake/targets/stem.lua index f88cf9059b..32e1c205ec 100644 --- a/xmake/targets/stem.lua +++ b/xmake/targets/stem.lua @@ -26,7 +26,11 @@ local stem_files = { } target("stem") do - add_deps("goldfish") + if has_config("goldfish") then + add_deps("goldfish") + else + add_deps("libgoldfish") + end if is_plat("windows") and is_mode("release") then add_deps("liii_windows_icon") end diff --git a/xmake/tests.lua b/xmake/tests.lua index 400588987d..562179b5b3 100644 --- a/xmake/tests.lua +++ b/xmake/tests.lua @@ -29,7 +29,9 @@ function add_target_cpp_test(filepath, dep1, dep2) if not is_plat("windows") then add_syslinks("pthread") end - add_packages("goldfish") + if has_config("goldfish") then + add_packages("goldfish") + end add_packages("liii-pdfhummus") add_includedirs({"$(builddir)", "tests/Base"}) @@ -78,7 +80,9 @@ function add_target_cpp_bench(filepath, dep) if not is_plat("windows") then add_syslinks("pthread") end - add_packages("goldfish") + if has_config("goldfish") then + add_packages("goldfish") + end add_packages("liii-pdfhummus") add_includedirs({"$(builddir)", "tests/Base"}) From f5ce25d8b9f4c2aae18e10ac891e34f005dfb8f1 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Wed, 15 Jul 2026 20:50:31 +0800 Subject: [PATCH 2/7] fix --- moebius/xmake.lua | 10 ++++++++-- xmake/targets/stem.lua | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 250741addc..1821855e67 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -30,7 +30,9 @@ local moe_includedirs = { add_requires("liii-doctest", {system=false}) add_requires("nanobench", {system=false}) -add_requires("goldfish", {system=false}) +if has_config("goldfish") then + add_requires("goldfish", {system=false}) +end target("libmoebius") do @@ -43,7 +45,11 @@ target("libmoebius") do add_files(moe_files) add_deps("liblolly") - add_packages("goldfish") + if has_config("goldfish") then + add_packages("goldfish") + else + add_deps("libgoldfish") + end add_headerfiles("Data/Convert/(*.hpp)") add_headerfiles("Data/History/(*.hpp)") diff --git a/xmake/targets/stem.lua b/xmake/targets/stem.lua index 32e1c205ec..40354f6743 100644 --- a/xmake/targets/stem.lua +++ b/xmake/targets/stem.lua @@ -125,7 +125,9 @@ target("stem") do add_frameworks("QtQml", "QtQuick", "QtBodymovin") end - add_packages("goldfish") + if has_config("goldfish") then + add_packages("goldfish") + end add_packages("mupdf") if not has_config("qt_frontend") and not is_plat("wasm") then -- WASM GLFW is in EMCC add_packages("glfw") From 10bff4440eddf00e6296b30c009ca4f56cc944b0 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Wed, 15 Jul 2026 21:01:28 +0800 Subject: [PATCH 3/7] FIX --- TeXmacs/doc/about/mogan/stem.en.tmu | 2 +- moebius/xmake.lua | 9 ++--- xmake/goldfish.lua | 55 ++--------------------------- xmake/requires.lua | 3 -- xmake/targets/libmogan.lua | 2 +- xmake/targets/stem.lua | 2 +- xmake/tests.lua | 4 +-- 7 files changed, 9 insertions(+), 68 deletions(-) diff --git a/TeXmacs/doc/about/mogan/stem.en.tmu b/TeXmacs/doc/about/mogan/stem.en.tmu index b92dfce45b..0ec0b290ef 100644 --- a/TeXmacs/doc/about/mogan/stem.en.tmu +++ b/TeXmacs/doc/about/mogan/stem.en.tmu @@ -1,4 +1,4 @@ -> +> > diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 1821855e67..34ecca79b2 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -30,10 +30,6 @@ local moe_includedirs = { add_requires("liii-doctest", {system=false}) add_requires("nanobench", {system=false}) -if has_config("goldfish") then - add_requires("goldfish", {system=false}) -end - target("libmoebius") do set_kind ("static") @@ -45,10 +41,9 @@ target("libmoebius") do add_files(moe_files) add_deps("liblolly") + add_deps("libgoldfish") if has_config("goldfish") then - add_packages("goldfish") - else - add_deps("libgoldfish") + add_deps("goldfish") end add_headerfiles("Data/Convert/(*.hpp)") diff --git a/xmake/goldfish.lua b/xmake/goldfish.lua index 8ef7b8abd0..104778a13d 100644 --- a/xmake/goldfish.lua +++ b/xmake/goldfish.lua @@ -15,36 +15,6 @@ -- 污染源码目录),而是在 on_install 里把源码拷贝到包缓存目录后构建。 local goldfish_src = "$(projectdir)/TeXmacs/plugins/goldfish/src" -package("goldfish") - set_homepage("https://github.com/goldfishscheme/goldfish") - set_description("Goldfish Scheme: a Scheme interpreter intended as an extension language for other applications.") - - add_deps("liii-tbox") - - on_load(function (package) - package:addenv("PATH", "bin") - package:add("deps", "argh v1.3.2") - end) - - on_test(function (package) - assert(package:check_csnippets([[ - static s7_pointer old_add; /* the original "+" function for non-string cases */ - static s7_pointer old_string_append; /* same, for "string-append" */ - - static s7_pointer our_add(s7_scheme *sc, s7_pointer args) - { - /* this will replace the built-in "+" operator, extending it to include strings: - * (+ "hi" "ho") -> "hiho" and (+ 3 4) -> 7 - */ - if ((s7_is_pair(args)) && - (s7_is_string(s7_car(args)))) - return(s7_apply_function(sc, old_string_append, args)); - return(s7_apply_function(sc, old_add, args)); - } - ]], {includes = "s7.h"})) - end) -package_end() - target("libgoldfish") do set_kind("$(kind)") set_languages("c11") @@ -77,8 +47,8 @@ target("libgoldfish") do "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_string.c", "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_vector.c" ) - add_headerfiles("$(curdir)/s7.h") - add_includedirs(".", {public = true}) + add_headerfiles("$(projectdir)/TeXmacs/plugins/goldfish/src/s7.h") + add_includedirs("$(projectdir)/TeXmacs/plugins/goldfish/src", {public = true}) if is_plat("windows") then set_optimize("faster") add_cxxflags("/fp:precise") @@ -102,27 +72,6 @@ target ("goldfish") do "$(projectdir)/TeXmacs/plugins/goldfish/src/liii_subprocess.cpp", "$(projectdir)/TeXmacs/plugins/goldfish/src/scheme_base.cpp", }) - add_files({ - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_continuation.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_ctables.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_dtoa.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_module.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_op_names.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_base.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_char.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_complex.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_format.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_inexact.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_predicate.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_symbol.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_scheme_write.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_bitwise.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_hash_table.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_list.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_string.c", - "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_vector.c", - }, {languages = "c11"}) add_files({ "$(projectdir)/3rdparty/json-schema-validator/src/smtp-address-validator.cpp", "$(projectdir)/3rdparty/json-schema-validator/src/json-schema-draft7.json.cpp", diff --git a/xmake/requires.lua b/xmake/requires.lua index 0c8f25d17f..e573cf614a 100644 --- a/xmake/requires.lua +++ b/xmake/requires.lua @@ -8,9 +8,6 @@ -- It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE -- in the root directory or . -if has_config("goldfish") then - add_requires("goldfish", {system=false}) -end add_requires("liii-tbox", {system=false}) if not is_plat("wasm") then add_requires("cpr", {system=false}) diff --git a/xmake/targets/libmogan.lua b/xmake/targets/libmogan.lua index 7996a20dac..4e7cf3a061 100644 --- a/xmake/targets/libmogan.lua +++ b/xmake/targets/libmogan.lua @@ -86,7 +86,7 @@ target("libmogan") do end add_packages("freetype") if has_config("goldfish") then - add_packages("goldfish") + add_deps("goldfish") end add_packages("liii-tbox") if not is_plat("wasm") then diff --git a/xmake/targets/stem.lua b/xmake/targets/stem.lua index 40354f6743..b2d4bd77f4 100644 --- a/xmake/targets/stem.lua +++ b/xmake/targets/stem.lua @@ -126,7 +126,7 @@ target("stem") do end if has_config("goldfish") then - add_packages("goldfish") + add_deps("goldfish") end add_packages("mupdf") if not has_config("qt_frontend") and not is_plat("wasm") then -- WASM GLFW is in EMCC diff --git a/xmake/tests.lua b/xmake/tests.lua index 562179b5b3..3e544cb2dd 100644 --- a/xmake/tests.lua +++ b/xmake/tests.lua @@ -30,7 +30,7 @@ function add_target_cpp_test(filepath, dep1, dep2) add_syslinks("pthread") end if has_config("goldfish") then - add_packages("goldfish") + add_deps("goldfish") end add_packages("liii-pdfhummus") @@ -81,7 +81,7 @@ function add_target_cpp_bench(filepath, dep) add_syslinks("pthread") end if has_config("goldfish") then - add_packages("goldfish") + add_deps("goldfish") end add_packages("liii-pdfhummus") From edd20e141b3184b753b81cd89b7ed664d8dbdf7a Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Wed, 15 Jul 2026 22:19:49 +0800 Subject: [PATCH 4/7] typo --- TeXmacs/doc/about/mogan/stem.en.tmu | 2 +- xmake/goldfish.lua | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/TeXmacs/doc/about/mogan/stem.en.tmu b/TeXmacs/doc/about/mogan/stem.en.tmu index 0ec0b290ef..b92dfce45b 100644 --- a/TeXmacs/doc/about/mogan/stem.en.tmu +++ b/TeXmacs/doc/about/mogan/stem.en.tmu @@ -1,4 +1,4 @@ -> +> > diff --git a/xmake/goldfish.lua b/xmake/goldfish.lua index 104778a13d..d72df88d52 100644 --- a/xmake/goldfish.lua +++ b/xmake/goldfish.lua @@ -13,7 +13,6 @@ -- binary target 内联编译的那一份完全相同。不使用 set_sourcedir() 直接指向 -- 工作树(否则 package.tools.xmake 会把 port 出来的 xmake.lua 写进工作树, -- 污染源码目录),而是在 on_install 里把源码拷贝到包缓存目录后构建。 -local goldfish_src = "$(projectdir)/TeXmacs/plugins/goldfish/src" target("libgoldfish") do set_kind("$(kind)") From b41bd32b9e39dd49615414322948e5296b05e1d5 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Thu, 16 Jul 2026 09:35:04 +0800 Subject: [PATCH 5/7] REF --- moebius/xmake.lua | 3 --- xmake/targets/libmogan.lua | 12 +++--------- xmake/targets/stem.lua | 13 +++++-------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 34ecca79b2..846b3e21e5 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -42,9 +42,6 @@ target("libmoebius") do add_deps("liblolly") add_deps("libgoldfish") - if has_config("goldfish") then - add_deps("goldfish") - end add_headerfiles("Data/Convert/(*.hpp)") add_headerfiles("Data/History/(*.hpp)") diff --git a/xmake/targets/libmogan.lua b/xmake/targets/libmogan.lua index 4e7cf3a061..3b4173b902 100644 --- a/xmake/targets/libmogan.lua +++ b/xmake/targets/libmogan.lua @@ -27,6 +27,7 @@ target("libmogan") do add_deps("libmoebius") add_deps("liblolly") + add_deps("libgoldfish") if has_config("qt_frontend") then add_deps("QWKCore", "QWKWidgets") add_rules("qt.static") @@ -85,9 +86,6 @@ target("libmogan") do add_packages("liii-pdfhummus") end add_packages("freetype") - if has_config("goldfish") then - add_deps("goldfish") - end add_packages("liii-tbox") if not is_plat("wasm") then add_packages("cpr") @@ -250,9 +248,6 @@ target("libmogan") do "$(projectdir)/src/Mogan/Telemetry", "$(projectdir)/TeXmacs/include", "$(builddir)/glue", - "$(projectdir)/TeXmacs/plugins/goldfish/src/", - "$(projectdir)/3rdparty/nlohmann_json/include", - "$(projectdir)/3rdparty/json-schema-validator/src" }, {public = true}) add_files({ @@ -280,9 +275,8 @@ target("libmogan") do "$(projectdir)/src/Plugins/Tex/**.cpp", "$(projectdir)/src/Plugins/Xml/**.cpp", "$(projectdir)/src/Plugins/Html/**.cpp", - "$(projectdir)/src/Plugins/Updater/**.cpp", - "$(projectdir)/TeXmacs/plugins/goldfish/src/**.cpp", - "$(projectdir)/3rdparty/json-schema-validator/src/**.cpp"}) + "$(projectdir)/src/Plugins/Updater/**.cpp" + }) if has_config("pdfhummus") then add_includedirs("$(projectdir)/src/Plugins/Pdf/**.hpp", {public=true}) diff --git a/xmake/targets/stem.lua b/xmake/targets/stem.lua index b2d4bd77f4..b032b55598 100644 --- a/xmake/targets/stem.lua +++ b/xmake/targets/stem.lua @@ -26,11 +26,6 @@ local stem_files = { } target("stem") do - if has_config("goldfish") then - add_deps("goldfish") - else - add_deps("libgoldfish") - end if is_plat("windows") and is_mode("release") then add_deps("liii_windows_icon") end @@ -125,13 +120,15 @@ target("stem") do add_frameworks("QtQml", "QtQuick", "QtBodymovin") end - if has_config("goldfish") then - add_deps("goldfish") - end add_packages("mupdf") if not has_config("qt_frontend") and not is_plat("wasm") then -- WASM GLFW is in EMCC add_packages("glfw") end + if has_config("goldfish") then + add_deps("goldfish") + else + add_deps("libgoldfish") + end add_deps("liblolly") add_deps("libmogan") add_deps("libmoebius") From 11a80ce535c27950f6a4ab76264817500769122f Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Thu, 16 Jul 2026 09:59:22 +0800 Subject: [PATCH 6/7] fix --- moebius/xmake.lua | 2 +- xmake/goldfish.lua | 16 +++++++++++----- xmake/targets/libmogan.lua | 8 +++----- xmake/targets/stem.lua | 5 ++--- xmake/vars.lua | 2 ++ 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/moebius/xmake.lua b/moebius/xmake.lua index 846b3e21e5..e837c944aa 100644 --- a/moebius/xmake.lua +++ b/moebius/xmake.lua @@ -41,7 +41,7 @@ target("libmoebius") do add_files(moe_files) add_deps("liblolly") - add_deps("libgoldfish") + add_deps("goldfish") add_headerfiles("Data/Convert/(*.hpp)") add_headerfiles("Data/History/(*.hpp)") diff --git a/xmake/goldfish.lua b/xmake/goldfish.lua index d72df88d52..2a6ecd9d19 100644 --- a/xmake/goldfish.lua +++ b/xmake/goldfish.lua @@ -15,7 +15,7 @@ -- 污染源码目录),而是在 on_install 里把源码拷贝到包缓存目录后构建。 target("libgoldfish") do - set_kind("$(kind)") + set_kind("static") set_languages("c11") add_packages("liii-tbox") add_defines("WITH_SYSTEM_EXTRAS=0") @@ -24,7 +24,7 @@ target("libgoldfish") do end add_defines("WITH_WARNINGS") add_defines("WITH_R7RS=1") - set_basename("goldfish") + set_basename("libgoldfish") add_files( "$(projectdir)/TeXmacs/plugins/goldfish/src/s7.c", "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_continuation.c", @@ -47,7 +47,6 @@ target("libgoldfish") do "$(projectdir)/TeXmacs/plugins/goldfish/src/s7_liii_vector.c" ) add_headerfiles("$(projectdir)/TeXmacs/plugins/goldfish/src/s7.h") - add_includedirs("$(projectdir)/TeXmacs/plugins/goldfish/src", {public = true}) if is_plat("windows") then set_optimize("faster") add_cxxflags("/fp:precise") @@ -58,9 +57,9 @@ target("libgoldfish") do end target ("goldfish") do + set_kind("static") set_languages("c++17") add_deps("libgoldfish") - set_targetdir("$(projectdir)/TeXmacs/plugins/goldfish/bin/") add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp") add_files({ "$(projectdir)/TeXmacs/plugins/goldfish/src/liii_base64.cpp", @@ -87,7 +86,7 @@ target ("goldfish") do "$(projectdir)/TeXmacs/plugins/goldfish/src", "$(projectdir)/3rdparty/nlohmann_json/include", "$(projectdir)/3rdparty/json-schema-validator/src", - }) + }, {public = true}) add_defines("WITH_SYSTEM_EXTRAS=0") if not is_plat("wasm") then @@ -110,3 +109,10 @@ target ("goldfish") do on_install(function (target) end) end + +target ("goldfish-bin") do + set_kind("binary") + add_deps("goldfish") + set_targetdir("$(projectdir)/TeXmacs/plugins/goldfish/bin/") + add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp") +end diff --git a/xmake/targets/libmogan.lua b/xmake/targets/libmogan.lua index 3b4173b902..99c380088c 100644 --- a/xmake/targets/libmogan.lua +++ b/xmake/targets/libmogan.lua @@ -27,7 +27,7 @@ target("libmogan") do add_deps("libmoebius") add_deps("liblolly") - add_deps("libgoldfish") + add_deps("goldfish") if has_config("qt_frontend") then add_deps("QWKCore", "QWKWidgets") add_rules("qt.static") @@ -247,7 +247,7 @@ target("libmogan") do "$(projectdir)/src/Mogan/TemplateCenter", "$(projectdir)/src/Mogan/Telemetry", "$(projectdir)/TeXmacs/include", - "$(builddir)/glue", + "$(builddir)/glue" }, {public = true}) add_files({ @@ -275,8 +275,7 @@ target("libmogan") do "$(projectdir)/src/Plugins/Tex/**.cpp", "$(projectdir)/src/Plugins/Xml/**.cpp", "$(projectdir)/src/Plugins/Html/**.cpp", - "$(projectdir)/src/Plugins/Updater/**.cpp" - }) + "$(projectdir)/src/Plugins/Updater/**.cpp",}) if has_config("pdfhummus") then add_includedirs("$(projectdir)/src/Plugins/Pdf/**.hpp", {public=true}) @@ -294,7 +293,6 @@ target("libmogan") do add_files("$(projectdir)/src/Plugins/Qt/moganqml.qrc") else add_files("$(projectdir)/src/Plugins/ImGui/**.cpp") - remove_files("$(projectdir)/TeXmacs/plugins/goldfish/src/liii_http.cpp") end if is_plat("macosx") then diff --git a/xmake/targets/stem.lua b/xmake/targets/stem.lua index b032b55598..d6b2dead56 100644 --- a/xmake/targets/stem.lua +++ b/xmake/targets/stem.lua @@ -125,10 +125,9 @@ target("stem") do add_packages("glfw") end if has_config("goldfish") then - add_deps("goldfish") - else - add_deps("libgoldfish") + add_deps("goldfish-bin") end + add_deps("goldfish") add_deps("liblolly") add_deps("libmogan") add_deps("libmoebius") diff --git a/xmake/vars.lua b/xmake/vars.lua index 436a2f38ad..f90ae14cf2 100644 --- a/xmake/vars.lua +++ b/xmake/vars.lua @@ -117,6 +117,8 @@ libstem_headers = { "$(builddir)/glue", "$(projectdir)/TeXmacs/include", "$(projectdir)/TeXmacs/plugins/goldfish/src", + "$(projectdir)/3rdparty/nlohmann_json/include", + "$(projectdir)/3rdparty/json-schema-validator/src" } libstem_srcs = { From e68c128ee8958dfc9501f0a26fad9f0e5a2fb650 Mon Sep 17 00:00:00 2001 From: Jim Zhou Date: Thu, 16 Jul 2026 10:09:49 +0800 Subject: [PATCH 7/7] fix --- xmake/goldfish.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xmake/goldfish.lua b/xmake/goldfish.lua index 2a6ecd9d19..b028eb3601 100644 --- a/xmake/goldfish.lua +++ b/xmake/goldfish.lua @@ -18,6 +18,7 @@ target("libgoldfish") do set_kind("static") set_languages("c11") add_packages("liii-tbox") + add_packages("argh", {public = true}) add_defines("WITH_SYSTEM_EXTRAS=0") if not is_plat("wasm") then add_defines("HAVE_OVERFLOW_CHECKS=0") @@ -60,7 +61,6 @@ target ("goldfish") do set_kind("static") set_languages("c++17") add_deps("libgoldfish") - add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp") add_files({ "$(projectdir)/TeXmacs/plugins/goldfish/src/liii_base64.cpp", "$(projectdir)/TeXmacs/plugins/goldfish/src/liii_hashlib.cpp", @@ -105,14 +105,15 @@ target ("goldfish") do if not is_plat("wasm") then add_packages("cpr") end - add_packages("argh") - on_install(function (target) - end) + add_packages("argh", {public = true}) end target ("goldfish-bin") do set_kind("binary") add_deps("goldfish") + set_basename("goldfish") + add_packages("liii-tbox") + add_packages("argh", {public = true}) set_targetdir("$(projectdir)/TeXmacs/plugins/goldfish/bin/") add_files ("$(projectdir)/TeXmacs/plugins/goldfish/src/goldfish.cpp") end