From 1ae7202e25f445a39f32555452cd3dbbd5888f71 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 11 Jan 2024 12:30:25 -0700 Subject: [PATCH] move preview2.h to wasi directory Signed-off-by: Joel Dice --- Makefile | 11 ++++++++--- expected/wasm32-wasi-preview2/include-all.c | 2 +- libc-bottom-half/headers/public/{ => wasi}/preview2.h | 0 libc-bottom-half/sources/preview2.c | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) rename libc-bottom-half/headers/public/{ => wasi}/preview2.h (100%) diff --git a/Makefile b/Makefile index 709cc684e..9cb35cc42 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ BULK_MEMORY_THRESHOLD ?= 32 # Set the default WASI target triple. TARGET_TRIPLE = wasm32-wasi -# Threaded version necessitates a different traget, as objects from different +# Threaded version necessitates a different target, as objects from different # targets can't be mixed together while linking. ifeq ($(THREAD_MODEL), posix) TARGET_TRIPLE = wasm32-wasi-threads @@ -885,8 +885,13 @@ bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen --rename wasi:cli/terminal-stdout@0.2.0-rc-2023-12-05=terminal_stdout \ --rename wasi:cli/terminal-stderr@0.2.0-rc-2023-12-05=terminal_stderr \ ./wasi-cli/wit && \ - mv preview2.h ../../libc-bottom-half/headers/public/ && \ - mv preview2.c preview2_component_type.o ../../libc-bottom-half/sources + mv preview2.h ../../libc-bottom-half/headers/public/wasi/ && \ + mv preview2_component_type.o ../../libc-bottom-half/sources && \ + sed 's_#include "preview2.h"_#include "wasi/preview2.h"_' \ + < preview2.c \ + > ../../libc-bottom-half/sources/preview2.c && \ + rm preview2.c + clean: $(RM) -r "$(BINDING_WORK_DIR)" diff --git a/expected/wasm32-wasi-preview2/include-all.c b/expected/wasm32-wasi-preview2/include-all.c index ea1724008..95829adf8 100644 --- a/expected/wasm32-wasi-preview2/include-all.c +++ b/expected/wasm32-wasi-preview2/include-all.c @@ -113,7 +113,6 @@ #include #include #include -#include #include #include #include @@ -168,5 +167,6 @@ #include #include #include +#include #include #include diff --git a/libc-bottom-half/headers/public/preview2.h b/libc-bottom-half/headers/public/wasi/preview2.h similarity index 100% rename from libc-bottom-half/headers/public/preview2.h rename to libc-bottom-half/headers/public/wasi/preview2.h diff --git a/libc-bottom-half/sources/preview2.c b/libc-bottom-half/sources/preview2.c index ad5caad68..a5765c845 100644 --- a/libc-bottom-half/sources/preview2.c +++ b/libc-bottom-half/sources/preview2.c @@ -1,5 +1,5 @@ // Generated by `wit-bindgen` 0.16.0. DO NOT EDIT! -#include "preview2.h" +#include "wasi/preview2.h" __attribute__((__import_module__("wasi:cli/environment@0.2.0-rc-2023-12-05"), __import_name__("get-environment")))