From 2dbbfd57b43f2f8a4b408fd0cddd7ea0d443ca69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=9A=93?= Date: Sun, 5 Jan 2025 17:03:17 -0500 Subject: [PATCH] Use WASI SDK C compiler for preprocessing Ruby headers instead of native C compiler --- retro/Makefile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/retro/Makefile b/retro/Makefile index 09cbd8826..007a6e8f3 100644 --- a/retro/Makefile +++ b/retro/Makefile @@ -78,7 +78,19 @@ $(LIBDIR)/ruby.wasm $(OUTDIR)/mkxp-retro-dist.zip.c: $(DOWNLOADS)/ruby/Makefile xxd -i mkxp-retro-dist.zip mkxp-retro-dist.zip.c; \ rm mkxp-retro-dist.zip -$(DOWNLOADS)/ruby/Makefile: $(DOWNLOADS)/ruby/configure $(RUBY) $(LIBDIR)/usr/local/lib/libyaml.a $(LIBDIR)/usr/local/lib/libz.a $(LIBDIR)/usr/local/lib/libssl.a +$(OUTDIR)/mkxp-sandbox-bindgen.cpp $(OUTDIR)/mkxp-sandbox-bindgen.h: $(LIBDIR)/tags $(RUBY) + cd $(LIBDIR); \ + $(RUBY) ${PWD}/sandbox-bindgen.rb; \ + mv mkxp-sandbox-bindgen.h $(OUTDIR); \ + mv mkxp-sandbox-bindgen.cpp $(OUTDIR) + +$(LIBDIR)/tags: $(LIBDIR)/tags.c + $(CTAGS) -R --fields=S --kinds-c=p --kinds-c++=p -o $(LIBDIR)/tags $(LIBDIR)/tags.c + +$(LIBDIR)/tags.c: $(DOWNLOADS)/ruby/.ext/include/wasm32-wasip1/ruby/config.h + echo '#include ' | $(WASI_CC) -E -I$(DOWNLOADS)/ruby/include -I$(DOWNLOADS)/ruby/.ext/include/wasm32-wasip1 -o $(LIBDIR)/tags.c - + +$(DOWNLOADS)/ruby/Makefile $(DOWNLOADS)/ruby/.ext/include/wasm32-wasip1/ruby/config.h: $(DOWNLOADS)/ruby/configure $(RUBY) $(LIBDIR)/usr/local/lib/libyaml.a $(LIBDIR)/usr/local/lib/libz.a $(LIBDIR)/usr/local/lib/libssl.a cd $(DOWNLOADS)/ruby; \ ./configure \ --prefix=/mkxp-retro-dist \ @@ -107,18 +119,6 @@ $(DOWNLOADS)/ruby/configure: $(DOWNLOADS)/baseruby/configure # Base ruby -$(OUTDIR)/mkxp-sandbox-bindgen.cpp $(OUTDIR)/mkxp-sandbox-bindgen.h: $(LIBDIR)/tags $(RUBY) - cd $(LIBDIR); \ - $(RUBY) ${PWD}/sandbox-bindgen.rb; \ - mv mkxp-sandbox-bindgen.h $(OUTDIR); \ - mv mkxp-sandbox-bindgen.cpp $(OUTDIR) - -$(LIBDIR)/tags: $(LIBDIR)/tags.c - $(CTAGS) -R --fields=S --kinds-c=p --kinds-c++=p -o $(LIBDIR)/tags $(LIBDIR)/tags.c - -$(LIBDIR)/tags.c: $(RUBY) $(LIBDIR)/include/ruby-$(RUBY_VERSION).0 - echo '#include ' | $(CC) -E -I$(LIBDIR)/include/ruby-$(RUBY_VERSION).0 -I$(LIBDIR)/include/ruby-$(RUBY_VERSION).0/$(shell $(RUBY) -e 'puts RUBY_PLATFORM') -o $(LIBDIR)/tags.c - - $(RUBY) $(LIBDIR)/include/ruby-$(RUBY_VERSION).0: $(DOWNLOADS)/baseruby/Makefile cd $(DOWNLOADS)/baseruby; \ make -j$(NPROC); \