高效率推进 LinuxCNC 源码对齐流程

说明:集中 LinuxCNC 源码清单与 wasm/native probe 的路径解析,补强 manifest、shim、source-link 检查,并保持 LinuxCNC 源码后端对齐验证流程可复用。

验证:./test-native.sh;./test-linuxcnc-source-link.sh;./test-all-native.sh;wasm source/probe 相关脚本。
This commit is contained in:
cnc
2026-05-27 11:14:06 +08:00
parent ce2f3f3769
commit 40a63c76f7
44 changed files with 3566 additions and 475 deletions

View File

@@ -13,6 +13,9 @@ if [[ ! -d "$linuxcnc_root" ]]; then
fi
trap 'rm -rf "$build_dir"' EXIT
tooldata_mmap_backend_shim=$(./list-linuxcnc-wasm-safe-shims.sh tooldata_mmap_backend.cc)
tooldata_mmap_source=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-files.sh src/emc/tooldata/tooldata_mmap.cc)
common_flags=(
-std=c++17
-DULAPI
@@ -26,42 +29,36 @@ common_flags=(
)
"$cxx" "${common_flags[@]}" \
-c core/wasm_shims/tooldata/tooldata_mmap_backend.cc \
-c "$tooldata_mmap_backend_shim" \
-o "$build_dir/tooldata_mmap_backend.o"
"$cxx" "${common_flags[@]}" \
-c "$tooldata_mmap_source" \
-o "$build_dir/linuxcnc_tooldata_mmap.o"
nm --defined-only "$build_dir/tooldata_mmap_backend.o" \
| awk '$2 ~ /^[A-Z]$/ {print $3}' \
| LC_ALL=C sort -u \
> "$build_dir/backend.exports"
expected_exports=(
tool_mmap_close
tool_mmap_creator
tool_mmap_is_random_toolchanger
tool_mmap_user
tooldata_find_index_for_tool
tooldata_get
tooldata_last_index_get
tooldata_last_index_set
tooldata_put
tooldata_reset
)
nm --defined-only "$build_dir/linuxcnc_tooldata_mmap.o" \
| awk '$2 ~ /^[A-Z]$/ {print $3}' \
| LC_ALL=C sort -u \
> "$build_dir/linuxcnc.exports"
printf '%s\n' "${expected_exports[@]}" | LC_ALL=C sort -u > "$build_dir/expected.exports"
if ! comm -23 "$build_dir/expected.exports" "$build_dir/backend.exports" > "$build_dir/missing.exports"; then
if ! comm -23 "$build_dir/linuxcnc.exports" "$build_dir/backend.exports" > "$build_dir/missing.exports"; then
exit 1
fi
if [[ -s "$build_dir/missing.exports" ]]; then
echo "missing wasm tooldata mmap backend exports:" >&2
echo "missing wasm tooldata mmap backend exports from LinuxCNC tooldata_mmap.cc:" >&2
cat "$build_dir/missing.exports" >&2
exit 1
fi
comm -13 "$build_dir/expected.exports" "$build_dir/backend.exports" > "$build_dir/unexpected.exports"
comm -13 "$build_dir/linuxcnc.exports" "$build_dir/backend.exports" > "$build_dir/unexpected.exports"
if [[ -s "$build_dir/unexpected.exports" ]]; then
echo "unexpected wasm tooldata mmap backend exports:" >&2
echo "unexpected wasm tooldata mmap backend exports beyond LinuxCNC tooldata_mmap.cc:" >&2
cat "$build_dir/unexpected.exports" >&2
exit 1
fi