From 7c67d0fd79a3cffe857587fa3cf576b611023840 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 2 Sep 2022 23:41:41 +0900 Subject: [PATCH] Make sources by BASERUBY if available instead of miniruby --- common.mk | 25 +++++++++++++++---------- configure.ac | 6 +++++- cygwin/GNUmakefile.in | 4 ++-- template/Makefile.in | 2 +- win32/Makefile.sub | 10 ++++++++-- 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/common.mk b/common.mk index 1ebdcf48d2..430eade9ad 100644 --- a/common.mk +++ b/common.mk @@ -82,7 +82,7 @@ EXTSOLIBS = MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT) dmyext.$(OBJEXT) ENC_MK = enc.mk MAKE_ENC = -f $(ENC_MK) V="$(V)" UNICODE_HDR_DIR="$(UNICODE_HDR_DIR)" \ - RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(mflags) + RUBY="$(BOOTSTRAPRUBY)" MINIRUBY="$(BOOTSTRAPRUBY)" $(mflags) COMMONOBJS = array.$(OBJEXT) \ ast.$(OBJEXT) \ @@ -755,9 +755,12 @@ fake: $(CROSS_COMPILING)-fake yes-fake: $(arch)-fake.rb $(RBCONFIG) PHONY no-fake -fake: PHONY -# really doesn't depend on .o, just ensure newer than headers which -# version.o depends on. -$(arch)-fake.rb: $(srcdir)/template/fake.rb.in $(tooldir)/generic_erb.rb version.$(OBJEXT) miniruby$(EXEEXT) +$(HAVE_BASERUBY:no=)$(arch)-fake.rb: miniruby$(EXEEXT) + +# actually depending on other headers more. +$(arch)-fake.rb: $(top_srcdir)/revision.h $(top_srcdir)/version.h $(srcdir)/version.c {$(VPATH)}vm_opts.h + +$(arch)-fake.rb: $(srcdir)/template/fake.rb.in $(tooldir)/generic_erb.rb $(ECHO) generating $@ $(Q) $(CPP) -DRUBY_EXPORT $(INCFLAGS) $(CPPFLAGS) "$(srcdir)/version.c" | \ $(BOOTSTRAPRUBY) "$(tooldir)/generic_erb.rb" -o $@ "$(srcdir)/template/fake.rb.in" \ @@ -841,6 +844,7 @@ extconf: $(PREP) rbconfig.rb: $(RBCONFIG) +$(HAVE_BASERUBY:no=)$(RBCONFIG): $(PREP) $(RBCONFIG): $(tooldir)/mkconfig.rb config.status $(srcdir)/version.h $(Q)$(BOOTSTRAPRUBY) -n \ -e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \ @@ -887,9 +891,10 @@ libtrans trans: {$(VPATH)}transdb.h ENC_HEADERS = $(srcdir)/enc/jis/props.h # Use MINIRUBY which loads fake.rb for cross compiling $(ENC_MK): $(srcdir)/enc/make_encmake.rb $(srcdir)/enc/Makefile.in $(srcdir)/enc/depend \ - $(srcdir)/enc/encinit.c.erb $(ENC_HEADERS) $(srcdir)/lib/mkmf.rb $(RBCONFIG) fake + $(srcdir)/enc/encinit.c.erb $(ENC_HEADERS) $(srcdir)/lib/mkmf.rb $(RBCONFIG) $(HAVE_BASERUBY)-fake $(ECHO) generating $@ - $(Q) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(ENCSTATIC) $(ENCS) $@ + $(Q) $(BOOTSTRAPRUBY) -r./$(arch)-fake $(srcdir)/enc/make_encmake.rb \ + --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(ENCSTATIC) $(ENCS) $@ .PRECIOUS: $(MKFILES) @@ -1130,13 +1135,13 @@ node_name.inc: $(tooldir)/node_name.rb $(srcdir)/node.h $(ECHO) generating $@ $(Q) $(BASERUBY) -n $(tooldir)/node_name.rb < $(srcdir)/node.h > $@ -encdb.h: $(PREP) $(tooldir)/generic_erb.rb $(srcdir)/template/encdb.h.tmpl +encdb.h: $(RBCONFIG) $(tooldir)/generic_erb.rb $(srcdir)/template/encdb.h.tmpl $(ECHO) generating $@ - $(Q) $(MINIRUBY) $(tooldir)/generic_erb.rb -c -o $@ $(srcdir)/template/encdb.h.tmpl $(srcdir)/enc enc + $(Q) $(BOOTSTRAPRUBY) $(tooldir)/generic_erb.rb -c -o $@ $(srcdir)/template/encdb.h.tmpl $(srcdir)/enc enc -transdb.h: $(PREP) srcs-enc $(tooldir)/generic_erb.rb $(srcdir)/template/transdb.h.tmpl +transdb.h: $(RBCONFIG) srcs-enc $(tooldir)/generic_erb.rb $(srcdir)/template/transdb.h.tmpl $(ECHO) generating $@ - $(Q) $(MINIRUBY) $(tooldir)/generic_erb.rb -c -o $@ $(srcdir)/template/transdb.h.tmpl $(srcdir)/enc/trans enc/trans + $(Q) $(BOOTSTRAPRUBY) $(tooldir)/generic_erb.rb -c -o $@ $(srcdir)/template/transdb.h.tmpl $(srcdir)/enc/trans enc/trans enc/encinit.c: $(ENC_MK) $(srcdir)/enc/encinit.c.erb diff --git a/configure.ac b/configure.ac index d6ed24c5b7..a3d758341a 100644 --- a/configure.ac +++ b/configure.ac @@ -3348,6 +3348,7 @@ done BTESTRUBY='$(MINIRUBY)' BOOTSTRAPRUBY='$(BASERUBY)' +BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY)' AS_IF([test x"$cross_compiling" = xyes], [ test x"$MINIRUBY" = x && MINIRUBY="${RUBY-$BASERUBY} -I`$CHDIR .; pwd` "-r'$(arch)-fake' XRUBY_LIBDIR=`${RUBY-$BASERUBY} -rrbconfig -e ['puts RbConfig::CONFIG["libdir"]']` @@ -3370,7 +3371,9 @@ AS_IF([test x"$cross_compiling" = xyes], [ RUNRUBY_COMMAND='$(MINIRUBY) $(tooldir)/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)' RUNRUBY='$(RUNRUBY_COMMAND) --' XRUBY='$(RUNRUBY)' - AS_CASE(["$HAVE_BASERUBY"], [no], [BOOTSTRAPRUBY='$(MINIRUBY)']) + AS_CASE(["$HAVE_BASERUBY"], + [yes], [BOOTSTRAPRUBY_COMMAND='$(BOOTSTRAPRUBY) -r./$(arch)-fake'], + [BOOTSTRAPRUBY='$(MINIRUBY)']) TEST_RUNNABLE=yes CROSS_COMPILING=no ]) @@ -3383,6 +3386,7 @@ AC_SUBST(RUNRUBY_COMMAND) AC_SUBST(RUNRUBY) AC_SUBST(XRUBY) AC_SUBST(BOOTSTRAPRUBY) +AC_SUBST(BOOTSTRAPRUBY_COMMAND) AC_SUBST(EXTOUT, [${EXTOUT=.ext}]) FIRSTMAKEFILE="" diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in index a61815c5e7..3b11d3f69c 100644 --- a/cygwin/GNUmakefile.in +++ b/cygwin/GNUmakefile.in @@ -54,7 +54,7 @@ $(RUBY_EXP) $(LIBRUBY_SO): $(DLL_BASE_NAME).res.$(OBJEXT) %.rc: $(RBCONFIG) $(srcdir)/revision.h $(srcdir)/win32/resource.rb $(ECHO) generating $@ - $(Q) $(MINIRUBY) $(srcdir)/win32/resource.rb \ + $(Q) $(BOOTSTRAPRUBY_COMMAND) $(srcdir)/win32/resource.rb \ -ruby_name=$(RUBY_INSTALL_NAME) -rubyw_name=$(RUBYW_INSTALL_NAME) \ -so_name=$(DLL_BASE_NAME) -output=$(*F) \ . $(icondirs) $(srcdir)/win32 @@ -96,7 +96,7 @@ $(LIBRUBY_SO): $(RUBYDEF) $(RUBYDEF): $(LIBRUBY_A) $(PREP) $(RBCONFIG) $(ECHO) generating $@ - $(Q) $(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A) + $(Q) $(BOOTSTRAPRUBY_COMMAND) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A) clean-local:: @$(RM) $(RUBYDEF) diff --git a/template/Makefile.in b/template/Makefile.in index c5a926b538..942f8fcb80 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -166,6 +166,7 @@ XRUBY_LIBDIR = @XRUBY_LIBDIR@ XRUBY_RUBYLIBDIR = @XRUBY_RUBYLIBDIR@ XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@ BOOTSTRAPRUBY = @BOOTSTRAPRUBY@ +BOOTSTRAPRUBY_COMMAND = @BOOTSTRAPRUBY_COMMAND@ COROUTINE_H = @X_COROUTINE_H@ COROUTINE_OBJ = $(COROUTINE_H:.h=.$(OBJEXT)) @@ -669,7 +670,6 @@ $(INSNS): $(srcdir)/insns.def vm_opts.h \ $(ECHO) generating $@ $(Q) $(BASERUBY) -Ku $(tooldir)/insns2vm.rb $(INSNS2VMOPT) $@ - loadpath: verconf.h @$(CPP) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/loadpath.c | \ sed -e '1,/^const char ruby_initial_load_paths/d;/;/,$$d' \ diff --git a/win32/Makefile.sub b/win32/Makefile.sub index bb9e12d3ca..05a088fe5c 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -358,8 +358,10 @@ RUNRUBY = $(RUNRUBY) "$(tooldir)/runruby.rb" --extout="$(EXTOUT)" $(RUNRUBYOPT) !if "$(CROSS_COMPILING)" == "yes" XRUBY = $(MINIRUBY) BOOTSTRAPRUBY = $(BASERUBY) +BOOTSTRAPRUBY_COMMAND = $(BOOTSTRAPRUBY) -r./$(arch)-fake !else BOOTSTRAPRUBY = $(MINIRUBY) +BOOTSTRAPRUBY_COMMAND = $(BOOTSTRAPRUBY) XRUBY = $(RUNRUBY) !endif BTESTRUBY = $(MINIRUBY) -r./$(arch)-fake @@ -1088,6 +1090,10 @@ s,@ruby_pc@,$(ruby_pc),;t t s,@MJIT_SUPPORT@,$(MJIT_SUPPORT),;t t <