summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-04-27 18:12:53 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2022-04-27 18:59:10 -0400
commitc466f270b891962518763ad299f907beac0ebf62 (patch)
treeb00c5993a67528ed7918118299db4bdf08aac60f /template
parent840dbe1cbfac5f46a16fa8e4f651e2c1f6973aa2 (diff)
Work around shell syntax error on Solaris
The shell in Solaris 10 has trouble understanding the syntax I used in YJIT's library merging script. This commit reduces the code the shell needs to parse before exiting on non-YJIT builds to hopefully fix the error on Solaris.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5854
Diffstat (limited to 'template')
-rw-r--r--template/Makefile.in12
1 files changed, 9 insertions, 3 deletions
diff --git a/template/Makefile.in b/template/Makefile.in
index fee62c8d30..d7f205894f 100644
--- a/template/Makefile.in
+++ b/template/Makefile.in
@@ -272,6 +272,13 @@ DESTDIR = @DESTDIR@
configure_args = @configure_args@
#### End of variables
+# Shell short-circuiting for dodging syntax error on older shells, e.g.
+# Solaris. Hack: make sends <backslash><newline> to the shell per POSIX, and
+# two backslashes stops escaping the newline.
+YJIT_BUILD_ONLY0 = $(YJIT_SUPPORT:no=exit; \\)
+YJIT_BUILD_ONLY1 = $(YJIT_BUILD_ONLY0:dev=)
+YJIT_BUILD_ONLY = $(YJIT_BUILD_ONLY1:yes=)
+
ABI_VERSION_HDR = $(hdrdir)/ruby/internal/abi.h
.SUFFIXES: .inc .h .c .y .i .$(ASMEXT) .$(DTRACE_EXT)
@@ -305,15 +312,14 @@ $(LIBRUBY_A):
@-[ -z "$(EXTSTATIC)" ] || $(PRE_LIBRUBY_UPDATE)
$(ECHO) linking static-library $@
$(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBY_A_OBJS) $(INITOBJS)
- $(Q) if [ -f '$(YJIT_LIBS)' ]; then \
+ $(Q) $(YJIT_BUILD_ONLY)\
set -eu && \
echo 'merging $(YJIT_LIBS) into $@' && \
$(RMALL) '$(CARGO_TARGET_DIR)/libyjit/' && \
$(MAKEDIRS) '$(CARGO_TARGET_DIR)/libyjit/' && \
$(CP) '$(YJIT_LIBS)' '$(CARGO_TARGET_DIR)/libyjit/' && \
(cd '$(CARGO_TARGET_DIR)/libyjit/' && $(AR) -x libyjit.a) && \
- $(AR) $(ARFLAGS) $@ $$(find '$(CARGO_TARGET_DIR)/libyjit/' -name '*.o') ; \
- fi
+ $(AR) $(ARFLAGS) $@ $$(find '$(CARGO_TARGET_DIR)/libyjit/' -name '*.o') ;
@-$(RANLIB) $@ 2> /dev/null || true
verify-static-library: $(LIBRUBY_A)