Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

foo_spider_monkey_panel · x64 移植构建

为 foobar2000 (x64) 构建 Spider Monkey Panel。官方 SMP 一直以来只有 32 位(组件 vcxproj 仅 Win32、预编译 mozjs-102.lib 也是 32 位),本仓库给出 x64 全链路自建方案: 把 SpiderMonkey 102.12.0esr 引擎编译成 x64,并把 SMP 组件整个编译链接成 x64,打包成可安装的 foo_spider_monkey_panel.fb2k-component。

上游:https://github.com/TheQwertiest/foo_spider_monkey_panel(MIT,2018–2021 Yuri Shutenko)。本仓库是其 x64 适配分支。

目录结构

scripts/     x64 构建脚本(configure_x64.sh / build_x64.sh / pack_x64.py / fix_sln_x64.py / add_x64.py)
prebuilt/    foo_spider_monkey_panel.fb2k-component  —— 已编译好的 x64 组件(可直接装 foobar2000 x64)
patches/     x64 源码改动(组件源码 diff + SpiderMonkey Wrapper.h 导出修复)
panel/       SMP 面板示例脚本 + 《如何写 SMP 面板》教程
LICENSE      上游 MIT 许可证
third_party_licenses.txt  依赖库许可证清单

快速安装(不想自己编译)

prebuilt/foo_spider_monkey_panel.fb2k-component 是 64 位组件包(含 foo_spider_monkey_panel.dll + mozjs-102.dll,均 x64): 把里面两个 dll 放进 foobar2000(x64) 的 components\(旧 32 位组件请先移出),重启 foobar,新建一个 Spider Monkey Panel 面板即可。

自己编译(Windows,x64)

前置工具链:

  • VS 2026/18(MSVC 14.51,平台工具集实际为 v145;v143 本机没有 → 用 msbuild ... /p:PlatformToolset=v145)
  • LLVM/clang ≥ 20(新版 VS 的 MSVC STL 14.51 有 STL1000 检查,强制要求 clang ≥ 20)
  • Rust 1.62.0(引擎内置 crate jsrust 用老式 &error::Error trait,较新 rust 编不过)
  • MozillaBuild 3.4(提供 MSYS shell + mozmake,到 C:\mozilla-build)
  • 因用户目录含单引号(Jason's Miku)会破坏 nmake/MSYS 的 8.3 短名,rust 装到无引号路径 C:\smp-build\tools\{cargo,rustup} 并把 CARGO_HOME/RUSTUP_HOME 指向它。

步骤:

  1. 下载并解压 firefox-102.12.0esr.source.tar.xz(官方 archive.mozilla.org)到 mozjs-src/firefox-102.12.0。
  2. 用 scripts/configure_x64.sh 配置(--target/host=x86_64-pc-mingw32、--disable-lto、注入 MSVC_BIN 解决 vswhere 认不出 VS2026 prerelease 导致的 ATL 检测失败、rust 1.62 default)。

    注意:别去掉 --disable-js-shell——那样 js/src/moz.build 不编 jsrust,链接会缺 encoding_mem_*。

  3. scripts/build_x64.sh(mozmake -j8)产出 x64 mozjs-102.dll/.lib/js_static.lib。
  4. 把 firefox-102.12.0 的 dist/include 与编译产物放进 SMP 的 mozjs/Release/{include,bin,lib}(目前放 32 位预编译,替换为 x64)。
  5. scripts/fix_sln_x64.py 修 workspaces/foo_spider_monkey_panel.sln 里 6 个项目的 Release|x64 平台映射。
  6. msbuild workspaces/foo_spider_monkey_panel.sln /m /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v145 编译组件。
  7. scripts/pack_x64.py 打包出 foo_spider_monkey_panel.fb2k-component。

完整坑记录见 patches/x64-component-src.patch(组件源码 x64 类型修复) 与 patches/mozjs-Wrapper-ctor-export.md(SpiderMonkey 导出修复)。

层层踩过的坑(重点给想自建的人)

  • clang 必须 ≥20:新 VS STL 的 yvals_core.h 有 STL1000 静态断言直接拒绝旧 clang。
  • rust 必须 1.62:jsrust 老 crate 的 trait-object 语法,1.97 编不过。
  • --disable-js-shell 会连带不编 jsrust → mozjs-102.dll 链接缺 encoding_mem_*/install_rust_*。
  • winheap.cpp 在 --disable-jemalloc 下定义 HeapAlloc 等 → 与 kernel32 重复:给 dll 链接加 LDFLAGS=/FORCE:MULTIPLE。
  • mozjs-1751561-duplicate_dll_main.patch 的 git apply 没真正写进 jsapi.cpp:需手动把 DllMain 条件改成 defined(XP_WIN) && (defined(MOZ_MEMORY) || !defined(JS_STANDALONE))。
  • ForwardingProxyHandler ctor 未导出 → SMP 在 x64 下 LNK2001:见 patches/mozjs-Wrapper-ctor-export.md(把 Wrapper.h 的 using BaseProxyHandler::... 改成显式 constexpr ctor)。
  • 组件链接缺 Scintilla_RegisterClasses/ReleaseResources:SMP 静态链 libscintilla.lib,需用 lib.exe(MSVC,支持 /GL 对象)把 Scintilla/Lexilla 的 x64 obj 归档成静态库并覆盖 projectref 目标。
  • CRT 不匹配:组件用 /MT,把 Scintilla/Lexilla 的 Release|x64 也设 <RuntimeLibrary>MultiThreaded</RuntimeLibrary> 再归档。

面板连接后端(Apple Music Streamer)

SMP 的 JS 没有内建 WebSocket。演示面板见 panel/;要驱动 Python 后端,给后端加一个本机 HTTP 桥(GET /api/state、POST /api/play…),面板轮询/点按钮即可,思路见 panel/README-如何写SMP面板.md。

许可证

  • 上游 foo_spider_monkey_panel:MIT(见 LICENSE)
  • 依赖库:third_party_licenses.txt
  • SpiderMonkey:MPL-2.0(ozilla Public License 2.0),见 SpiderMonkey 源码许可。

About

Spider Monkey Panel (foobar2000) x64 build: SpiderMonkey 102 x64 engine + SMP component + 预编译包 + 面板/Core 教程

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages