Clean way to patch the std

This commit is contained in:
2026-03-18 19:58:23 +01:00
parent a087bdd523
commit 9b8afd2c5c
7 changed files with 258 additions and 277 deletions

View File

@@ -6,25 +6,13 @@ patch-std:
@echo "Start patching the std..."
@find {{ PATCH_DIR }} -type f | while read -r patch_file; do \
relative_path="${patch_file#{{ PATCH_DIR }}/}"; \
case "$patch_file" in \
*.rs) \
echo "📄 [COPY] $relative_path"; \
mkdir -p "{{ SRC_DIR }}/$(dirname "$relative_path")"; \
cp "$patch_file" "{{ SRC_DIR }}/$relative_path"; \
;; \
*.sed) \
target_file="${relative_path%.sed}.rs"; \
if [ -f "{{ SRC_DIR }}/$target_file" ]; then \
echo " [SED] $target_file"; \
sed -i -f "$patch_file" "{{ SRC_DIR }}/$target_file"; \
else \
echo "⚠️[WARN] target doesn't exist: $target_file"; \
fi \
;; \
*) \
echo "❓ [SKIP] Unknown file : $relative_path"; \
;; \
esac; \
target_file="${relative_path%.sed}.rs"; \
if [ -f "{{ SRC_DIR }}/$target_file" ]; then \
echo " [SED] $target_file"; \
sed -i -f "$patch_file" "{{ SRC_DIR }}/$target_file"; \
else \
echo "⚠ [WARN] target doesn't exist: $target_file"; \
fi; \
done
@echo "✅ Patching done."
@@ -167,13 +155,14 @@ setup-std:
@just cp_std "sys/io/is_terminal/unsupported.rs"
@just cp_std "sys/io/kernel_copy/mod.rs"
@just cp_std "sys/io/mod.rs"
@just cp_std "sys/io/error/mod.rs"
@just cp_std "sys/pipe/mod.rs"
@just cp_std "sys/pipe/unsupported.rs"
@just cp_std "sys/stdio/mod.rs"
@just cp_std "sys/stdio/unsupported.rs"
@just cp_std "sys/alloc/mod.rs"
@just cp_std "sys/backtrace.rs"
@just cp_std "alloc.rs"
@# Copied but edited for the moment
# @just cp_std "sys/process/unsupported.rs"
@just cp_std "sys/io/error/mod.rs"
# @just cp_std "alloc.rs"
# @just cp_std "path.rs"