[前][次][番号順一覧][スレッド一覧]

ruby-changes:73636

From: Alan <ko1@a...>
Date: Wed, 21 Sep 2022 03:17:44 +0900 (JST)
Subject: [ruby-changes:73636] a8dc49b4d5 (master): YJIT: Support MAKE=bmake for release build

https://git.ruby-lang.org/ruby.git/commit/?id=a8dc49b4d5

From a8dc49b4d57e0a2d07691176f43e4b7f71874fa7 Mon Sep 17 00:00:00 2001
From: Alan Wu <XrXr@u...>
Date: Tue, 20 Sep 2022 08:36:06 -0400
Subject: YJIT: Support MAKE=bmake for release build

This add support for bmake, which should allow building with
`configure --enable-yjit` for the BSDs. Tested on FreeBSD 13 and
on macOS with `configure MAKE=bmake` on a case-sensitive file system.

It works by including a fragment into the Makefile through the configure
script, similar to common.mk. It uses the always rebuild approach to
keep build system changes minimal.
---
 common.mk         |  8 ++++++++
 configure.ac      |  6 +++++-
 yjit/not_gmake.mk | 14 ++++++++++++++
 yjit/yjit.mk      | 10 +---------
 4 files changed, 28 insertions(+), 10 deletions(-)
 create mode 100644 yjit/not_gmake.mk

diff --git a/common.mk b/common.mk
index c6d6e54c72..bef00d191f 100644
--- a/common.mk
+++ b/common.mk
@@ -219,6 +219,14 @@ MAKE_LINK = $(MINIRUBY) -rfileutils -e "include FileUtils::Verbose" \ https://github.com/ruby/ruby/blob/trunk/common.mk#L219
 	  -e "noraise {ln(src, dest)} or" \
 	  -e "cp(src, dest)"
 
+# For release builds
+YJIT_RUSTC_ARGS = --crate-name=yjit \
+	--crate-type=staticlib \
+	--edition=2021 \
+	-C opt-level=3 \
+	-C overflow-checks=on \
+	'--out-dir=$(CARGO_TARGET_DIR)/release/' \
+	$(top_srcdir)/yjit/src/lib.rs
 
 all: $(SHOWFLAGS) main docs
 
diff --git a/configure.ac b/configure.ac
index 8cf0f58067..9823198960 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4370,6 +4370,10 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L4370
 	AS_IF([test "$gnumake" != yes], [
 	    echo ['$(MKFILES): $(srcdir)/common.mk']
 	    sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk
+            AS_IF([test "$YJIT_SUPPORT" = yes], [
+                cat ${srcdir}/yjit/not_gmake.mk
+                echo ['$(MKFILES): ${srcdir}/yjit/not_gmake.mk']
+            ])
 	], [
 	    echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk'
 	])
@@ -4387,7 +4391,7 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L4391
 	echo 'ruby: $(PROGRAM);' >> $tmpmk
 	test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk"
     ]) && mv -f $tmpmk Makefile],
-[EXEEXT='$EXEEXT' MAKE='${MAKE-make}' gnumake='$gnumake' GIT='$GIT'])
+[EXEEXT='$EXEEXT' MAKE='${MAKE-make}' gnumake='$gnumake' GIT='$GIT' YJIT_SUPPORT='$YJIT_SUPPORT'])
 
 AC_ARG_WITH([ruby-pc],
 	    AS_HELP_STRING([--with-ruby-pc=FILENAME], [pc file basename]),
diff --git a/yjit/not_gmake.mk b/yjit/not_gmake.mk
new file mode 100644
index 0000000000..cbc60c09f1
--- /dev/null
+++ b/yjit/not_gmake.mk
@@ -0,0 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/yjit/not_gmake.mk#L1
+# This file is included into the Makefile when
+# we're *not* using GNU make. Stick to basic features.
+
+# Rebuild every time since we don't want to list Rust source
+# file dependencies.
+.PHONY: yjit-static-lib
+$(YJIT_LIBS): yjit-static-lib
+	$(empty)
+
+yjit-static-lib:
+	$(ECHO) 'building Rust YJIT (release mode)'
+	$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
+
+miniruby$(EXEEXT): $(YJIT_LIBS)
diff --git a/yjit/yjit.mk b/yjit/yjit.mk
index fe182b3dcc..fc0061eb29 100644
--- a/yjit/yjit.mk
+++ b/yjit/yjit.mk
@@ -23,14 +23,7 @@ YJIT_LIB_TOUCH = touch $@ https://github.com/ruby/ruby/blob/trunk/yjit/yjit.mk#L23
 ifeq ($(YJIT_SUPPORT),yes)
 $(YJIT_LIBS): $(YJIT_SRC_FILES)
 	$(ECHO) 'building Rust YJIT (release mode)'
-	$(Q) $(RUSTC) \
-	        --crate-name=yjit \
-	        --crate-type=staticlib \
-	        --edition=2021 \
-	        -C opt-level=3 \
-	        -C overflow-checks=on \
-	        '--out-dir=$(CARGO_TARGET_DIR)/release/' \
-	        $(top_srcdir)/yjit/src/lib.rs
+	$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
 	$(YJIT_LIB_TOUCH)
 else ifeq ($(YJIT_SUPPORT),no)
 $(YJIT_LIBS):
@@ -48,7 +41,6 @@ else https://github.com/ruby/ruby/blob/trunk/yjit/yjit.mk#L41
 endif
 
 # Put this here instead of in common.mk to avoid breaking nmake builds
-# TODO: might need to move for BSD Make support
 miniruby$(EXEEXT): $(YJIT_LIBS)
 
 # By using YJIT_BENCH_OPTS instead of RUN_OPTS, you can skip passing the options to `make install`
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]