58 lines
1.5 KiB
Bash
Executable File
58 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
LINUXCNC_ROOT="${LINUXCNC_ROOT:-$ROOT_DIR/../linuxcnc}"
|
|
UPSTREAM="$LINUXCNC_ROOT/src/emc/task/emccanon.cc"
|
|
SUBSET_SRC="$ROOT_DIR/vendor/linuxcnc/src/emc/task/emccanon_wasm_subset.cc"
|
|
SUBSET_HDR="$ROOT_DIR/vendor/linuxcnc/src/emc/task/emccanon_wasm_subset.hh"
|
|
BUILD_SCRIPT="$ROOT_DIR/tools/build_task_hal_wasm.sh"
|
|
|
|
print_kv() {
|
|
printf '%s=%s\n' "$1" "$2"
|
|
}
|
|
|
|
require_file() {
|
|
local key="$1"
|
|
local path="$2"
|
|
if [[ ! -f "$path" ]]; then
|
|
print_kv "$key" missing
|
|
print_kv "${key}_path" "$path"
|
|
exit 1
|
|
fi
|
|
print_kv "$key" ok
|
|
print_kv "${key}_path" "$path"
|
|
}
|
|
|
|
require_pattern() {
|
|
local key="$1"
|
|
local pattern="$2"
|
|
local path="$3"
|
|
if ! rg -q "$pattern" "$path"; then
|
|
print_kv "$key" missing
|
|
print_kv "${key}_pattern" "$pattern"
|
|
print_kv "${key}_path" "$path"
|
|
exit 1
|
|
fi
|
|
print_kv "$key" ok
|
|
}
|
|
|
|
require_file task_emccanon_subset_upstream "$UPSTREAM"
|
|
require_file task_emccanon_subset_source "$SUBSET_SRC"
|
|
require_file task_emccanon_subset_header "$SUBSET_HDR"
|
|
|
|
for fn in \
|
|
generate_fast_move \
|
|
generate_move \
|
|
STRAIGHT_TRAVERSE \
|
|
STRAIGHT_FEED
|
|
do
|
|
require_pattern "task_emccanon_subset_upstream_$fn" "$fn" "$UPSTREAM"
|
|
require_pattern "task_emccanon_subset_origin_$fn" "$fn" "$SUBSET_SRC"
|
|
done
|
|
|
|
require_pattern task_emccanon_subset_origin_path "src/emc/task/emccanon.cc" "$SUBSET_SRC"
|
|
require_pattern task_emccanon_subset_build_included "emccanon_wasm_subset.cc" "$BUILD_SCRIPT"
|
|
|
|
print_kv task_emccanon_subset_source_reuse ok
|