结论:LinuxCNC rs274ngc 源码移植边界继续收拢。已将 rs274ngc 头文件纳入 manifest 跟踪,core 编译组仍只包含可编译源文件;启用 CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND 时 API 默认使用 LinuxCNC rs274 后端;M428/M429/M430 与 5axis/TRT/TDR/RTCP 相关路径继续保持来自 LinuxCNC 源码或 remap 配置的薄桥接。 验证:./test-linuxcnc-source-syntax.sh;./test-linuxcnc-api-native.sh;./test-native.sh;./test-linuxcnc-source-link.sh。
146 lines
4.1 KiB
Bash
Executable File
146 lines
4.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
|
|
manifest=${1:-linuxcnc-rs274-wasm-source-files.txt}
|
|
|
|
LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs.sh "$manifest"
|
|
|
|
python_blockers=()
|
|
core_python_sources=()
|
|
dlopen_blockers=()
|
|
core_dlopen_sources=()
|
|
tooldata_blockers=()
|
|
core_tooldata_sources=()
|
|
shimmed_tooldata_users=()
|
|
core_tooldata_users=()
|
|
native_backend_blockers=()
|
|
native_fs_blockers=()
|
|
core_native_fs_sources=()
|
|
core_count=0
|
|
blocked_count=0
|
|
blocked_replacements=()
|
|
|
|
blocked_replacement_for() {
|
|
case "$1" in
|
|
src/emc/tooldata/tooldata_mmap.cc)
|
|
./list-linuxcnc-wasm-safe-shims.sh tooldata_mmap_backend.cc
|
|
;;
|
|
*)
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
core_source_output=$(./list-linuxcnc-wasm-manifest-sources.sh "$manifest" core)
|
|
mapfile -t core_sources <<<"$core_source_output"
|
|
blocked_source_output=$(./list-linuxcnc-wasm-manifest-sources.sh "$manifest" blocked)
|
|
mapfile -t blocked_sources <<<"$blocked_source_output"
|
|
core_count=${#core_sources[@]}
|
|
blocked_count=${#blocked_sources[@]}
|
|
|
|
scan_source() {
|
|
local group=$1
|
|
local path=$2
|
|
full_path=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-files.sh \
|
|
--missing-message "missing manifest source" \
|
|
"$path")
|
|
if [[ "$group" == "blocked" ]]; then
|
|
if ! replacement=$(blocked_replacement_for "$path"); then
|
|
echo "missing blocked replacement mapping: $path" >&2
|
|
exit 1
|
|
fi
|
|
if [[ ! -f "$replacement" ]]; then
|
|
echo "missing blocked replacement source: $replacement" >&2
|
|
exit 1
|
|
fi
|
|
blocked_replacements+=("$path -> $replacement")
|
|
fi
|
|
|
|
if [[ "$path" == src/emc/tooldata/* ]]; then
|
|
if [[ "$group" == "blocked" ]]; then
|
|
tooldata_blockers+=("$path")
|
|
else
|
|
core_tooldata_sources+=("$path")
|
|
fi
|
|
fi
|
|
|
|
if [[ "$path" == "src/emc/tooldata/tooldata_mmap.cc" ]]; then
|
|
native_backend_blockers+=("$path")
|
|
fi
|
|
|
|
if grep -Eq 'Python\.h|boost/python|pythonplugin|PyObject|PyInit_' "$full_path"; then
|
|
if [[ "$group" == "blocked" ]]; then
|
|
python_blockers+=("$path")
|
|
else
|
|
core_python_sources+=("$path")
|
|
fi
|
|
fi
|
|
|
|
if grep -Eq 'dlopen|dlsym|RTLD_' "$full_path"; then
|
|
if [[ "$group" == "blocked" ]]; then
|
|
dlopen_blockers+=("$path")
|
|
else
|
|
core_dlopen_sources+=("$path")
|
|
fi
|
|
fi
|
|
|
|
if grep -Eq 'mkstemp|mkstemps|dirent\.h|opendir|readdir|unistd\.h' "$full_path"; then
|
|
if [[ "$group" == "blocked" ]]; then
|
|
native_fs_blockers+=("$path")
|
|
else
|
|
core_native_fs_sources+=("$path")
|
|
fi
|
|
fi
|
|
|
|
if [[ "$path" != src/emc/tooldata/* ]] && grep -Eq 'tooldata/tooldata.hh|tooldata_' "$full_path"; then
|
|
if [[ "$group" == "blocked" ]]; then
|
|
shimmed_tooldata_users+=("$path")
|
|
else
|
|
core_tooldata_users+=("$path")
|
|
fi
|
|
fi
|
|
}
|
|
|
|
for path in "${core_sources[@]}"; do
|
|
[[ -z "$path" ]] && continue
|
|
scan_source core "$path"
|
|
done
|
|
|
|
for path in "${blocked_sources[@]}"; do
|
|
[[ -z "$path" ]] && continue
|
|
scan_source blocked "$path"
|
|
done
|
|
|
|
print_group() {
|
|
local title=$1
|
|
shift
|
|
echo "[$title]"
|
|
if [[ $# -eq 0 ]]; then
|
|
echo "(none)"
|
|
else
|
|
printf '%s\n' "$@" | LC_ALL=C sort -u
|
|
fi
|
|
echo
|
|
}
|
|
|
|
echo "[manifest]"
|
|
echo "core=$core_count"
|
|
echo "blocked=$blocked_count"
|
|
echo
|
|
|
|
print_group "python" "${python_blockers[@]}"
|
|
print_group "dlopen" "${dlopen_blockers[@]}"
|
|
print_group "tooldata" "${tooldata_blockers[@]}"
|
|
print_group "tooldata-users" "${shimmed_tooldata_users[@]}"
|
|
print_group "native-backend" "${native_backend_blockers[@]}"
|
|
print_group "native-fs" "${native_fs_blockers[@]}"
|
|
print_group "blocked-replacements" "${blocked_replacements[@]}"
|
|
print_group "core-python-shimmed" "${core_python_sources[@]}"
|
|
print_group "core-dlopen-shimmed" "${core_dlopen_sources[@]}"
|
|
print_group "core-tooldata-shimmed" "${core_tooldata_sources[@]}"
|
|
print_group "core-tooldata-users-shimmed" "${core_tooldata_users[@]}"
|
|
print_group "core-native-fs-shimmed" "${core_native_fs_sources[@]}"
|