From 19a9b185542fd84a156d42056a86d4df79eaab6e Mon Sep 17 00:00:00 2001 From: shenlei Date: Wed, 23 Sep 2026 09:53:28 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=E7=9B=AE=E6=A0=87=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E6=94=B6=E7=AA=84=E4=B8=BA=20macOS=20arm64=20+=20Android=20arm?= =?UTF-8?q?64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户决定:Linux 和 Windows 不做,不验收、不作为任何步骤的阻塞项。 - PORT-PLAN 第 1 节写明范围;2A step 3 的平台列表、2P step 1/2 措辞跟着改; 2P step 4 由「五个平台分别验证」改为「两个目标平台」,Linux/Windows 两行 划掉但保留原因备查(上游 2.7 只支持 MSVC + PC/pyconfig.h,mingw 下 posixmodule.c / dynload_win.c 与 MinGW 头文件冲突)。 - PLATFORMS.md 新增 Scope 段;THIRD-PARTY.md 的 CPython Windows 段由 "not built yet" 改为 out of scope;PYTHON-EMBED-EVAL.md 下一步两条。 - 仓库里的 mingw-w64 交叉编译只留作可移植性门禁(它抓到过 UserInterface/StdAfx.h 的真问题),不代表支持 Windows。 - iOS arm64 暂按次要目标记录:保持交叉编译干净,但不作为验收目标。 仅文档改动。port_map.py check 0 error;参考 EterPack.cpp 的 8 个 pack key 值逐个 git grep --cached -w,均未入库。 Co-Authored-By: Claude Opus 5 --- audit/history.jsonl | 1 + docs/PLATFORMS.md | 6 ++++++ docs/PORT-PLAN.md | 29 ++++++++++++++++------------- docs/PYTHON-EMBED-EVAL.md | 11 ++++++----- docs/THIRD-PARTY.md | 12 +++++++----- 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/audit/history.jsonl b/audit/history.jsonl index 8a916758..2ea9a888 100644 --- a/audit/history.jsonl +++ b/audit/history.jsonl @@ -496,3 +496,4 @@ {"time": "2026-09-23T17:30:00Z", "event": "port_round", "unit": "PORT-PLAN 批次 2P step 2: ScriptLib/PythonLauncher.cpp into port_logic on the embedded interpreter", "ported": ["ScriptLib/PythonLauncher.cpp (10 of 12 fns)", "ScriptLib/PythonMarshal.cpp (4 of 11)"], "adapted": [], "deleted": [], "divergent": [], "needs_live": [], "status_note": "statuses set only for what port.python_launcher actually runs. PythonUtils.cpp is copied and compiled but nothing calls it yet (the binding modules are 2V0), so all 19 stay TODO; TraceFunc/SetTraceFunc are _DEBUG-only; in PythonMarshal only the small-.pyc path runs (r_long, _PyMarshal_ReadLongFromFile, getfilesize, _PyMarshal_ReadLastObjectFromFile) because that one delegates to CPython's own PyMarshal_ReadObjectFromString under 16KB, leaving the ported r_object reader unreached. Two // PORT: edits: `unsigned char(val)` -> a cast (MSVC extension) in PythonUtils.cpp x2, and PyObject_AsCharBuffer's Py_ssize_t* in TraceFunc. CPythonLauncher::GetError dereferences the NULL PyErr_Fetch yields when nothing is pending — kept verbatim, the test only calls it with an error set.", "shims": "extension/src/port/common/shim/sdk/Python-2.7/: 12 forwarding headers for 40250's #include ; symtable.h forward-declares mod_ty instead of including Python-ast.h, whose one-word macros (Delete, Module, Set, Print) collide with EterLib/Pool.h — 40250 sidestepped the same clash by commenting out PySymtable_Build", "tests": ["ctest port.python_launcher (macOS arm64): Create/RunLine/RunMemoryTextFile(CRLF)/RunCompiledFile(.pyc)/RunFile PASS; RunFile(\"system.py\") reads the real pack and stops at ImportError: No module named app (the 2V0 C++ modules)", "ctest macOS: 27/27 PASS", "android arm64 NDK API 24 + ios arm64 iphoneos: port_logic (incl. ScriptLib) compiles"], "commit": "2P-step2"} {"time": "2026-09-23T19:30:00Z", "event": "port_round", "unit": "PORT-PLAN 批次 2P step 3a/3b: python27.zip on sys.path (platform/ScriptLib/PythonHost) + the pack module", "ported": ["UserInterface/PythonPackModule.cpp (3 of 5 fns: packExist, packGet, initpack)"], "adapted": [], "deleted": [], "divergent": [], "needs_live": [], "stdlib": {"builder": "tools/py_embed/make_stdlib_zip.py , CMake target mtpython_stdlib -> /python27.zip", "contents": "397 modules, 6876547 bytes, ZIP_STORED (no zlib module, so zipimport cannot inflate); deterministic (sorted, fixed timestamp) so the sha256 identifies it", "sha256": "5fce8f974a89b66110823d7529be96e359b56dea05fc6875189a241d2d37a7d6", "skipped": "test/tests trees, lib-tk, idlelib, lib2to3, bsddb, ensurepip, curses, distutils, unittest, wsgiref, multiprocessing, compiler, plat-*", "host": "platform/ScriptLib/PythonHost.cpp: Configure() sets Py_NoSiteFlag/IgnoreEnvironment/Frozen/DontWriteBytecode + program name before Py_Initialize; InstallStdLib() does PySys_SetPath then re-registers encodings.search_function, because 2.7 initializes the codec registry once at startup and never retries"}, "status_note": "PythonPackModule's other two functions are CAccountConnector's login key builder, which happens to live in that unit; kept verbatim under #if 0 until the 2V1 login slice brings AccountConnector.h. port/UserInterface/StdAfx.h is a partial mirror: the original includes every library's StdAfx plus /, so it carries only what compiles today (ScriptLib/StdAfx.h, APP_NAME, the name length enum, initpack) and grows with the 2V slices.", "tests": ["ctest python.embed now runs against python27.zip itself (zipimport), not the loose Lib/", "ctest port.python_launcher: InstallStdLib + `import os, string, types, codecs` + cp1252 encode; initpack then pack.Exist/pack.Get for system.py (byte count equals CEterPackManager's), uiscript/selectcharacterwindow.py and locale/en/locale_game.txt; .tga and a missing file give None", "ctest macOS: 27/27 PASS", "android arm64 + ios arm64: port_platform (incl. PythonHost, PythonPackModule) compiles"], "not_done": ["3c: stage python27.zip out of the app resources into the sandbox on Android/iOS and check it against the manifest sha256; PythonHost::DefaultStdLibPath() only reads MT_PYTHON_STDLIB today"], "commit": "2P-step3ab"} {"time": "2026-09-23T21:40:00Z", "event": "port_round", "unit": "PORT-PLAN 批次 2P step 3c: staging python27.zip into the mobile sandbox", "ported": [], "adapted": [], "deleted": [], "divergent": [], "needs_live": [], "staging": {"ships": "make_stdlib_zip.py also writes .sha256; target mtpython_stdlib_project copy_if_different's python27.zip + .sha256 into project/ (gitignored), and both export presets' include_filter lists them so they enter the PCK", "runtime": "extension/src/python_stdlib.cpp (GDScript: Metin2Python.stdlib_path(force_stage)) — desktop uses ProjectSettings.globalize_path(res://python27.zip) in place; exported builds read the bytes out of the PCK, write user://python27.zip.part, verify the sha256 of the written file, then rename to user://python27.zip. An existing sandbox copy is reused only when it hashes to the shipped digest, so a torn first start or a new build re-stages.", "handoff": "PythonHost::SetDefaultStdLibPath() — DefaultStdLibPath() now answers with the staged path; $MT_PYTHON_STDLIB still wins. python_stdlib.cpp is the only unit that knows res:// / user://; port_platform stays godot-free.", "build_fix": "the Windows gate (MinGW, no mtpython) was broken by step 3b and is fixed here: port/CMakeLists.txt now also excludes UserInterface/StdAfx.h (it includes ScriptLib/StdAfx.h, as the original PCH does) and UserInterface/PythonPackModule.cpp, and platform/CMakeLists.txt excludes platform/ScriptLib/ the way port_logic already excluded port/ScriptLib/."}, "status_note": "On-device staging is not verified: the macOS test drives the mobile path with force_stage=true, and Android/iOS user:// sandboxes come with step 4. The zip's presence in an exported pack was checked with --export-pack, not with an APK. Nothing in the app's boot path calls Metin2Python.stdlib_path() yet — the interpreter only starts in the process with 2V0; today the test is its only caller.", "tests": ["project/python_stdlib_test.gd (godot --headless --path project --script python_stdlib_test.gd) -> PASS: in-place path on desktop; force_stage copies into user://, sha256 matches the shipped digest, bytes equal res://, no .part left, ZIPReader opens it and finds encodings/__init__.py and os.py; a second call does not re-copy (mtime unchanged); a deliberately corrupted sandbox copy is re-staged", "godot --headless --export-pack macOS lists python27.zip (6876547) and python27.zip.sha256 (65)"], "not_done": "真机验证(Android/iOS 进程内落盘 + system.py -> prototype.RunApp())随 2P step 4;Linux/Windows 见 step 4 表格", "commit": "2P-step3c"} +{"time": "2026-09-23T22:20:00Z", "event": "scope_decision", "unit": "目标平台收窄为 macOS arm64 + Android arm64(Linux / Windows 不做)", "ported": [], "adapted": [], "deleted": [], "divergent": [], "needs_live": [], "decision": {"by": "user", "statement": "Linux 和 Windows 不考虑,目前主要支持 macOS arm64 和 Android arm64", "ios": "iOS arm64 保留为交叉编译干净的次要目标,不作为验收目标(我的判断,待用户确认)", "mingw": "仓库里的 mingw-w64 交叉编译只留作可移植性门禁——它这次抓到了 UserInterface/StdAfx.h 的真问题——不代表支持 Windows,不为它投入额外工作,也不阻塞任何步骤"}, "docs": ["docs/PORT-PLAN.md: 第 1 节新增范围段;批次 2A step 3 平台列表;批次 2P step 1/2 措辞;step 4 由「五个平台」改为「两个目标平台」,Linux/Windows 两行划掉并保留原因备查;总表 2P 行", "docs/PLATFORMS.md: 新增 Scope 段", "docs/THIRD-PARTY.md: CPython 的 Windows 段由「not built yet」改为 out of scope + 原因备查", "docs/PYTHON-EMBED-EVAL.md: 下一步 1/3 两条"], "tests": "仅文档改动,无代码改动;port_map.py check 0 error / 1 tag;参考 EterPack.cpp 的 8 个 pack key 值逐个 git grep --cached -w,均未入库", "not_done": "2P step 4 剩余项仍在:Android 真机 APK 进程内的 3c 沙盒落地,以及 app 进程里跑 system.py → prototype.RunApp()"} diff --git a/docs/PLATFORMS.md b/docs/PLATFORMS.md index cf5a99bc..d2d8c140 100644 --- a/docs/PLATFORMS.md +++ b/docs/PLATFORMS.md @@ -6,6 +6,12 @@ Metal) and **OnePlus 13** (Android arm64, Vulkan). The native deps that used to come from Homebrew are now vendored and cross-compile from the same tree — see `docs/THIRD-PARTY.md`. +**Scope (decided 2026-09-23, PORT-PLAN §1):** the shipping targets are **macOS +arm64** and **Android arm64**. iOS arm64 stays cross-compile-clean but is not an +acceptance target. **Linux and Windows are not done** — the mingw-w64 cross +build is kept only as a portability gate (it catches real include/layering bugs), +not as Windows support, and MSVC is not built at all. + ## What each script does | Script | Target | Output | diff --git a/docs/PORT-PLAN.md b/docs/PORT-PLAN.md index ceb6dedc..af2a6baf 100644 --- a/docs/PORT-PLAN.md +++ b/docs/PORT-PLAN.md @@ -10,7 +10,10 @@ ## 1. 目标与原则 -metin2-client 是 40250 Windows 客户端的跨平台版本(macOS / Windows / Linux / Android / iOS)。 +metin2-client 是 40250 Windows 客户端的跨平台版本。**目标平台是 macOS arm64 和 Android arm64**(2026-09-23 定); +iOS arm64 保持交叉编译干净,但不作为验收目标。**Linux 和 Windows 不做**——不验收、不作为任何步骤的阻塞项。 +仓库里的 mingw-w64 交叉编译只留作可移植性门禁(它这次抓到了 `UserInterface/StdAfx.h` 的真问题), +不代表支持 Windows,也不要为它投入额外工作。 除渲染和平台 API 外,所有玩法算法、分支、常量、状态顺序、计时来源、数据来源、封包副作用和清理路径都以 40250 为准。**40250 源码就是规格,不设计行为,只照抄。** @@ -82,7 +85,7 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 | — | 定下目录结构,评估内嵌 Python;Android 独立程序验证 | 完成(9d0e50de、b02c49bb) | | **2A** | 基础:Win32 类型层、参考公共头的最小闭包、`port_logic` CMake 目标、platform 接口骨架、头文件可编译门禁、port-map 重新基线 | **进行中**(剩 Python 库闭包头,等 2P) | | 2R | 资源包能力盘点:EPK 类型/密钥/覆盖顺序/路径大小写/移动端交付 | 完成:只有 NONE/COMPRESS/SECURITY,不需要服务器密钥;设备上直接读 EPK | -| **2P** | CPython 2.7.18 编进 libmtgodot,五个平台分别配置和验证 | **进行中**:step 1(静态库 + macOS/Android/iOS 配置)、step 2(ScriptLib 进 `port_logic`)、step 3a/3b(python27.zip + `PythonHost` + `pack` 模块)完成 | +| **2P** | CPython 2.7.18 编进 libmtgodot,macOS arm64 + Android arm64 分别配置和验证 | **进行中**:step 1(静态库 + macOS/Android/iOS 配置)、step 2(ScriptLib 进 `port_logic`)、step 3a/3b(python27.zip + `PythonHost` + `pack` 模块)完成 | | 2D | 数据源切到 40250(msm 路径、proto、资源根、严格资源测试) | 完成(5a26e93f、232d0461、240d2827、a9b31dec);资源根只切了 proto/pack 后端,其余按第 5 节由 2V 切片逐个切换 | | **2V0** | UI 壳:真实 `PythonLauncher/wndMgr/grp/app` + platform UI,其他玩法模块用桩,显示并操作 Logo/Popup | 需要 2A、2P 和 root/uiscript 子集 | | **2V1** | 登录/选角:真实 `net` phase、登录/选角脚本及所需模块,走到 Loading | 2V0 之后 | @@ -114,8 +117,8 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 按 D3DX8 的 float 语义实现。 2. 参考公共头的最小闭包:从第一批要移植的单元出发(`PythonPlayerEventHandler.h` 依赖 `ActorInstance.h`、`FlyHandler.h`、 `PythonNetworkStream.h`、`InstanceBase.h`),用脚本列出 `#include` 闭包,把闭包里的头文件先照抄为可编译的声明。 -3. `port_logic` 静态库 CMake 目标,链接进 `libmtgodot`;macOS、Android、iOS、Linux、Windows 五个平台分别编译。 - 某个平台的工具链暂不可用时,2A 对该平台保持 `BLOCKED`,不能用其他平台的通过结果替代。 +3. `port_logic` 静态库 CMake 目标,链接进 `libmtgodot`;macOS 和 Android 分别编译(iOS、mingw-w64 作为附带的 + 可移植性门禁一起编)。某个目标平台的工具链暂不可用时,2A 对该平台保持 `BLOCKED`,不能用其他平台的通过结果替代。 4. `extension/src/platform/` 接口骨架:闭包里出现的平台类(`CGraphicThingInstance`、`CSoundManager` 等)只声明 40250 调用方用到的方法,先给空实现。 5. 门禁:`port/**` 下每个头文件单独编译通过(header self-containment),序列化结构的 `static_assert` 全部通过。 @@ -196,8 +199,8 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 | macOS arm64 | PASS(含 `port.common` 测试) | | Android arm64(脚本取已装的最新 NDK,本机 28.2;API 24) | PASS | | iOS arm64 | PASS(Xcode,未签名) | -| Windows x64 | mingw-w64 PASS;MSVC 需在 Windows 主机上跑,**BLOCKED** | -| Linux x86_64 | **BLOCKED**(本机无 Linux 工具链;Linux 主机上直接运行脚本) | +| Windows x64 | mingw-w64 PASS(只是可移植性门禁,不是目标平台;MSVC 不做) | +| ~~Linux x86_64~~ | 不做(2026-09-23 定,见第 1 节) | 已知的无关问题:完整 Android 扩展构建在 `extension/src/net/text_codec.cpp` 失败(bionic 从 API 28 才声明 `iconv`, 而构建用 API 24;c9389431 引入);仓库里的 `build-android/` 缓存还指向旧路径 `mtgodot-poc`。 @@ -280,11 +283,11 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 ### 批次 2P:内嵌 Python 集成 -1. CPython 2.7.18 源码放进 `extension/third_party/cpython-2.7.18/`。**共用源码清单和静态模块清单**(`Modules/Setup` 中启用的 C 模块,见 `tools/py_embed_android/build-and-run.sh`);**每个平台各自一份 `pyconfig.h`**(由该平台的 configure 生成后提交,或 Windows 用 `PC/pyconfig.h`),因为它是对目标平台类型大小和系统 API 的探测结果,不能共用。已知平台差异:Android API 24 需关掉 `HAVE_LANGINFO_H`。 +1. CPython 2.7.18 源码放进 `extension/third_party/cpython-2.7.18/`。**共用源码清单和静态模块清单**(`Modules/Setup` 中启用的 C 模块,见 `tools/py_embed_android/build-and-run.sh`);**每个平台各自一份 `pyconfig.h`**(由该平台的 configure 生成后提交),因为它是对目标平台类型大小和系统 API 的探测结果,不能共用。已知平台差异:Android API 24 需关掉 `HAVE_LANGINFO_H`。 **已完成**:`mtpython` 静态库(`-DMTGODOT_EMBED_PYTHON=ON`,133 个目标文件 = 参考 `libpython2.7.a` 的全集), `tools/py_embed/gen_pyconfig.sh <平台>` 生成各平台 `config/<平台>/pyconfig.h` 并校验内建模块表一致, `extension/tests/py_embed_test.cpp`(ctest `python.embed`)。三处 vendor 补丁见 `docs/THIRD-PARTY.md`。 - Linux/Windows 见下表。 + 目标平台是 macOS arm64 和 Android arm64;Linux/Windows 不做(见第 1 节)。 2. 静态链接进 `libmtgodot`,照抄 `ScriptLib/PythonLauncher.cpp`。 **已完成**:`ScriptLib/{PythonLauncher,PythonUtils,PythonMarshal}.{h,cpp}` 进入 `port_logic`(`mt3p::python`), `common/shim/sdk/Python-2.7/` 12 个转发头让 40250 的 `#include ` 原样编译 @@ -292,8 +295,8 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 `extension/tests/port_python_launcher_test.cpp`(ctest `port.python_launcher`)按 `UserInterface.cpp:241-434` 的顺序跑: `Create()` → `__DEBUG__`/`__COMMAND_LINE__` → `TRUE/FALSE` → `RunMemoryTextFile`(CRLF)→ `RunCompiledFile`(.pyc) → `RunFile("system.py")` 从真 pack 里取脚本,停在 `ImportError: No module named app`,即 2V0 的 C++ 模块。 - `Py_NoSiteFlag` 等宿主标志目前在测试里设置,step 3 移进 platform 层。Windows 没有 `mtpython`, - `port_logic` 会自动排除 ScriptLib 和这些转发头。 + `Py_NoSiteFlag` 等宿主标志目前在测试里设置,step 3 移进 platform 层。mingw-w64 可移植性门禁下没有 `mtpython`, + `port_logic` 会自动排除 ScriptLib 和这些转发头(连带 `UserInterface/StdAfx.h`、`UserInterface/PythonPackModule.cpp`)。 3. `pack` 模块通过 `asset_io` 读取 40250 的 root/uiscript。标准库沿用已验证的 `python27.zip + sys.path`: - 桌面端把 zip 放在 CPython 可读的真实文件系统路径; - Android/iOS 首次启动从应用资源复制到应用沙盒,校验提交在资源清单中的 sha256,再加入 `sys.path`; @@ -328,15 +331,15 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次 app 的启动流程还没有调用它——解释器要到 2V0 才在进程里起来,现在只有测试调。 `port_platform` 现在在没有 `mtpython` 时也会排除 `platform/ScriptLib/`(与 `port_logic` 同一条规则), 否则 Windows 门禁会编到 `PythonHost.cpp`。 -4. 五个平台分别验证:编译、链接无未定义符号、`Py_Initialize`、静态 C 模块逐个 `import`、在 app 进程里跑 `system.py` → `prototype.RunApp()`(对照结果:74 个模块中 66 个加载成功,引导期调用 33 个 C++ 函数)。 +4. 两个目标平台分别验证:编译、链接无未定义符号、`Py_Initialize`、静态 C 模块逐个 `import`、在 app 进程里跑 `system.py` → `prototype.RunApp()`(对照结果:74 个模块中 66 个加载成功,引导期调用 33 个 C++ 函数)。 | 平台 | 状态 | | --- | --- | | macOS arm64 | step 1、2 完成:`mtpython` 静态库 + `python.embed`(39 个内建模块全部 import,标准库 codec/pickle 通过)+ `port.python_launcher`(`CPythonLauncher` 跑到 `system.py` 的第一个 import);`system.py` 在 app 进程内未做 | | Android arm64 | step 1 完成:NDK API 24 交叉编译出 `libmtpython.a`;独立可执行文件在真机跑通(b02c49bb);APK 进程内未做。step 2 的 ScriptLib 只在 macOS 编译过 | | iOS arm64 | step 1 完成:iphoneos arm64 编出 133 个目标文件,无 `_system`/`_fork`/`_popen` 未定义符号;真机未跑。step 2 的 ScriptLib 只在 macOS 编译过 | - | Linux x86_64 | 未做(`gen_pyconfig.sh linux` 需要 Linux 主机,当前无) | - | Windows x64 | 未做:上游 2.7 只支持 MSVC + `PC/pyconfig.h`,而本项目 Windows 门禁是 MinGW 交叉编译,`PC/pyconfig.h` 的 gnu-win32 分支不设 `HAVE_UNISTD_H`,`posixmodule.c`/`dynload_win.c` 与 MinGW 头文件冲突,需要一套补丁——在本步骤(step 4)决定走 MSVC 还是打补丁 | + | ~~Linux x86_64~~ | 不做(2026-09-23 定,见第 1 节) | + | ~~Windows x64~~ | 不做(2026-09-23 定,见第 1 节)。记录原因备查:上游 2.7 只支持 MSVC + `PC/pyconfig.h`,而本仓库的 Windows 门禁是 mingw-w64 交叉编译,`PC/pyconfig.h` 的 gnu-win32 分支不设 `HAVE_UNISTD_H`,`posixmodule.c`/`dynload_win.c` 与 MinGW 头文件冲突。因此 mingw 门禁下不建 `mtpython`,`port_logic`/`port_platform` 自动排除 ScriptLib | ### 批次 2V0–2V3:纵向切片 diff --git a/docs/PYTHON-EMBED-EVAL.md b/docs/PYTHON-EMBED-EVAL.md index 794600f8..c0af7fa0 100644 --- a/docs/PYTHON-EMBED-EVAL.md +++ b/docs/PYTHON-EMBED-EVAL.md @@ -96,13 +96,14 @@ Godot 这边只剩一个宿主 Control:把输入转发给 `CPythonWindowManage ## 下一步 -1. ~~把 CPython 2.7.18 放进 `extension/third_party/`,共用源码/静态模块清单,但为 macOS、Linux、Windows、 - Android、iOS 分别生成或维护 `pyconfig.h`~~,静态链接进 `libmtgodot`; +1. ~~把 CPython 2.7.18 放进 `extension/third_party/`,共用源码/静态模块清单,但为各平台分别生成或维护 + `pyconfig.h`~~,静态链接进 `libmtgodot`; 源码和三平台配置已完成(2026-09-23,批次 2P step 1):`mtpython` 静态库(`-DMTGODOT_EMBED_PYTHON=ON`)、 - `tools/py_embed/gen_pyconfig.sh`、ctest `python.embed`;macOS/Android/iOS 编译通过,Linux 缺主机、 - Windows 的 MinGW 冲突见 `docs/THIRD-PARTY.md`。静态链接进 `libmtgodot` 是 step 2; + `tools/py_embed/gen_pyconfig.sh`、ctest `python.embed`;macOS/Android/iOS 编译通过。 + Linux 和 Windows 不做(2026-09-23 定,见 `docs/PORT-PLAN.md` 第 1 节);mingw-w64 只作可移植性门禁, + 那里不建 `mtpython`,冲突原因见 `docs/THIRD-PARTY.md`。静态链接进 `libmtgodot` 是 step 2; 2. `pack` 模块走 `asset_io`,继续负责 40250 的 root/uiscript。标准库沿用已验证的 `python27.zip + sys.path` 方案:桌面端放在解释器可读的真实文件系统路径,移动端首次启动从应用资源复制到应用沙盒并校验 sha256;静态启用 `zipimport`。不要依赖 `system.py` 的简单 `name + '.py'` 钩子加载带 package/dotted import 的标准库; -3. 在 APK app 进程里跑同样的引导流程(C++ 桩模块),然后分别验证 iOS、Linux 和 Windows; +3. 在 APK app 进程里跑同样的引导流程(C++ 桩模块);iOS 只保交叉编译干净,不作验收目标; 4. 按 `docs/PORT-PLAN.md` 的 2V0-2V3 切片依次替换桩模块和旧运行路径。 diff --git a/docs/THIRD-PARTY.md b/docs/THIRD-PARTY.md index b8bea059..0857c9e7 100644 --- a/docs/THIRD-PARTY.md +++ b/docs/THIRD-PARTY.md @@ -132,11 +132,13 @@ one via a 1-line shim header, see below). (2.7's configure refuses a darwin cross build) and drops process control plus ``/`getentropy`, but keeps `HAVE_GETGROUPS` because `posixmodule.c` defines `MAX_GROUPS` — which its `setgroups` path needs — only - inside that `#ifdef`. **Windows is not built yet**: upstream supports MSVC + - `PC/pyconfig.h`, while our Windows gate cross-compiles with MinGW, where - `PC/pyconfig.h`'s gnu-win32 branch leaves `HAVE_UNISTD_H` unset and - `posixmodule.c` / `dynload_win.c` then collide with the MinGW headers. Decided - in 批次 2P step 4 (PORT-PLAN). + inside that `#ifdef`. **Windows is out of scope** (decided 2026-09-23, PORT-PLAN §1: the + targets are macOS arm64 and Android arm64). It is also not buildable as-is: + upstream supports MSVC + `PC/pyconfig.h`, while the mingw-w64 portability gate + cross-compiles with MinGW, where `PC/pyconfig.h`'s gnu-win32 branch leaves + `HAVE_UNISTD_H` unset and `posixmodule.c` / `dynload_win.c` then collide with + the MinGW headers. So that gate simply builds no `mtpython`, and `port_logic` / + `port_platform` drop ScriptLib there. * **License:** PSF License Agreement (`cpython-2.7.18/LICENSE`). Ship-safe; the only obligation is keeping the license and a change notice, which this section and the patched files' comments serve.