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

ruby-changes:71310

From: Yuta <ko1@a...>
Date: Wed, 2 Mar 2022 09:41:08 +0900 (JST)
Subject: [ruby-changes:71310] 32ad8df9d1 (master): enc/depend: fix out-of-src build with --with-static-linked-ext

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

From 32ad8df9d1e07e1b2435a8890d070802fcd2989f Mon Sep 17 00:00:00 2001
From: Yuta Saito <kateinoigakukun@g...>
Date: Tue, 1 Mar 2022 05:23:44 +0000
Subject: enc/depend: fix out-of-src build with --with-static-linked-ext

When out-of-src build, at the beginning of a build, `make -f enc.mk
srcs` generates trans C sources under build dir.

On the other hand, enc/trans/*.o were built from trans C sources
generated under srcdir due to the following auto-generated rules from
enc/depend.

```
encsrcdir = ../src/enc
...
enc/trans/big5.$(OBJEXT): $(encsrcdir)/trans/big5.c
```

Therefore, trans C sources are generated twice under srcdir and build
dir during a build.

Ideally, trans C sources have always been built before compilation of
enc/trans/*.o because the source generation is prereq, so making
enc/trans/*.o doesn't trigger trans C source generation and shouldn't
require MINIRUBY as a make arg for enc.mk. However, the second trans C
source gen is unintentionally triggered by enc/trans/*.o, so `make -f
enc.mk libencs` requires MINIRUBY for now.

When no `--with-static-linked-ext`, `make -f enc.mk libencs` is
triggered from common.mk with MINIRUBY, so there is no problem.
But when `--with-static-linked-ext`, libencs should be statically-linked
to ruby, so `make -f enc.mk libencs` is triggered from exts.mk, and
exts.mk invokes it without MINIRUBY.

Therefore, when out-of-src build and with `--with-static-linked-ext`,
the second trans C source gen fails due to missing MINIRUBY.
This issue is deterministically reproducible without -j because
common.mk's `main` rule also has libencs prerequisite.

This patch supresses the second trans C source gen.
---
 enc/depend | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/enc/depend b/enc/depend
index 60c5a3ebb2..60d4e82eac 100644
--- a/enc/depend
+++ b/enc/depend
@@ -143,11 +143,17 @@ enc/<%=e%>.$(OBJEXT): <%=deps.map {|n| rule_subst % n}.join(' ')%> https://github.com/ruby/ruby/blob/trunk/enc/depend#L143
 	$(Q)<%=cmd%>
 
 % end
-% dependencies.each do |e|
+% (ENCS + ["trans/transdb"]).each do |e|
 <%="enc/#{e}.$(OBJEXT)"%>: <%="$(encsrcdir)/#{e}.c"%>
 	$(ECHO) compiling <%= "$(encsrcdir)/#{e}.c"%>
 	$(Q)<%=COMPILE_C.gsub(/\$(\()?<(\:[^)]+)?(\))?/){"$(encsrcdir)/#{e}.c"}%>
 
+% end
+% ATRANS.each do |e|
+<%="enc/trans/#{e}.$(OBJEXT)"%>: <%=transvpath % "#{e}.c"%>
+	$(ECHO) compiling <%=transvpath % "#{e}.c"%>
+	$(Q)<%=COMPILE_C.gsub(/\$(\()?<(\:[^)]+)?(\))?/){ transvpath % "#{e}.c"}%>
+
 % end
 
 enc/encdb.$(OBJEXT): encdb.h
-- 
cgit v1.2.1


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

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