Skip to content

Commit fe9d446

Browse files
elliotttJakeChampion
authored andcommitted
Migrate console into a shared directory
1 parent e1a2faf commit fe9d446

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ wpt-runtime.wasm
2121
docs-app/bin/main.wasm
2222
docs-app/pkg/*.tar.gz
2323
c-dependencies/js-compute-runtime/xqd-world/xqd_world_component_type.o
24+
25+
*.a

c-dependencies/js-compute-runtime/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ WASI_CXX ?= $(WASI_SDK)/bin/clang++
4444
# The wasi-sdk provided c compiler wrapper.
4545
WASI_CC ?= $(WASI_SDK)/bin/clang
4646

47+
# The wasi-sdk provided ar wrapper.
48+
WASI_AR ?= $(WASI_SDK)/bin/ar
49+
4750
ifneq ($(DEBUG),false)
4851
MODE := debug
4952
CARGO_FLAG :=
@@ -142,6 +145,9 @@ $(OBJ_DIR)/xqd-world:
142145
$(OBJ_DIR)/builtins:
143146
$(call cmd,mkdir,$@)
144147

148+
$(OBJ_DIR)/builtins/shared:
149+
$(call cmd,mkdir,$@)
150+
145151
# Downloaded dependencies ######################################################
146152

147153
$(BUILD)/openssl-$(OPENSSL_VERSION).tar.gz: URL=https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz
@@ -237,6 +243,7 @@ endif
237243

238244
FSM_CPP := $(wildcard $(FSM_SRC)/*.cpp)
239245
FSM_CPP += $(wildcard $(FSM_SRC)/builtins/*.cpp)
246+
FSM_CPP += $(wildcard $(FSM_SRC)/builtins/shared/*.cpp)
240247
FSM_OBJ := $(patsubst $(FSM_SRC)/%.cpp,$(OBJ_DIR)/%.o,$(FSM_CPP))
241248

242249
# Build all the above object files
@@ -268,6 +275,13 @@ $(OBJ_DIR)/js-compute-runtime-component.wasm: $(OBJ_DIR)/xqd-world/xqd_world_ada
268275
$(WASI_CXX) $(LD_FLAGS) $(OPENSSL_LIBS) -o $@ $^
269276
$(call cmd_format,WASM_STRIP,$@) $(call WASM_STRIP,$@)
270277

278+
# The subset of javascript builtins that are reusable across other runtimes.
279+
shared-builtins.a: $(OBJ_DIR)/shared-builtins.a
280+
$(call cmd,cp,$@)
281+
282+
$(OBJ_DIR)/shared-builtins.a: $(OBJ_DIR)/builtins/shared/console.o
283+
$(call cmd,wasi_ar,$@)
284+
271285
# These two rules copy the built artifacts into the $(FSM_SRC) directory, and
272286
# are both marked phony as we need to do the right thing when running the
273287
# following sequence:

c-dependencies/js-compute-runtime/commands.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ cmd_rmdir = $(RM) -r $1
3838
cmd_wget_name := WGET
3939
cmd_wget = wget $(URL) $(call quiet_flag,--quiet) -O $1
4040

41+
cmd_wasi_ar_name := WASI_AR
42+
cmd_wasi_ar = $(WASI_AR) rcs $@ $<
43+
4144
cmd_wasi_cxx_name := WASI_CXX
4245
cmd_wasi_cxx = $(WASI_CXX) $(CXX_FLAGS) $(OPT_FLAGS) $(INCLUDES) $(DEFINES) -MMD -MP -c -o $1 $<
4346

c-dependencies/js-compute-runtime/js-compute-builtins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "builtins/cache-override.h"
4646
#include "builtins/compression-stream.h"
4747
#include "builtins/config-store.h"
48-
#include "builtins/console.h"
4948
#include "builtins/crypto.h"
5049
#include "builtins/decompression-stream.h"
5150
#include "builtins/dictionary.h"
@@ -55,6 +54,7 @@
5554
#include "builtins/native-stream-sink.h"
5655
#include "builtins/native-stream-source.h"
5756
#include "builtins/object-store.h"
57+
#include "builtins/shared/console.h"
5858
#include "builtins/subtle-crypto.h"
5959
#include "builtins/transform-stream-default-controller.h"
6060
#include "builtins/transform-stream.h"

0 commit comments

Comments
 (0)