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

ruby-changes:60381

From: Nobuyoshi <ko1@a...>
Date: Fri, 13 Mar 2020 15:37:20 +0900 (JST)
Subject: [ruby-changes:60381] 88f4ebac83 (master): Update and extract for each gem

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

From 88f4ebac83a77f933e9da099eabdf05004767de9 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 13 Mar 2020 15:31:21 +0900
Subject: Update and extract for each gem


diff --git a/common.mk b/common.mk
index 0742cbc..e8f3511 100644
--- a/common.mk
+++ b/common.mk
@@ -1276,7 +1276,7 @@ update-config_files: PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1276
 refresh-gems: update-bundled_gems prepare-gems
 prepare-gems: update-gems extract-gems
 
-update-gems: PHONY
+update-gems$(gnumake:yes=-nongnumake): PHONY
 	$(ECHO) Downloading bundled gem files...
 	$(Q) $(BASERUBY) -C "$(srcdir)" \
 	    -I./tool -rdownloader -answ \
@@ -1289,7 +1289,7 @@ update-gems: PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1289
 	    -e 'FileUtils.rm_rf(old.map{'"|n|"'n.chomp(".gem")})' \
 	    gems/bundled_gems
 
-extract-gems: PHONY
+extract-gems$(gnumake:yes=-nongnumake): PHONY
 	$(ECHO) Extracting bundled gem files...
 	$(Q) $(RUNRUBY) -C "$(srcdir)" \
 	    -Itool -rgem-unpack -answ \
diff --git a/defs/gmake.mk b/defs/gmake.mk
index a359b44..874a7af 100644
--- a/defs/gmake.mk
+++ b/defs/gmake.mk
@@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L1
 # -*- mode: makefile-gmake; indent-tabs-mode: t -*-
 
-gnumake = yes
 override gnumake_recursive := $(if $(findstring n,$(firstword $(MFLAGS))),,+)
 override mflags := $(filter-out -j%,$(MFLAGS))
 MSPECOPT += $(if $(filter -j%,$(MFLAGS)),-j)
@@ -243,9 +242,34 @@ HELP_EXTRA_TASKS = \ https://github.com/ruby/ruby/blob/trunk/defs/gmake.mk#L242
 	"  update-github:       merge master branch and push it to Pull Request [PR=1234]" \
 	""
 
-ifneq ($(filter refresh-gems prepare-gems,$(MAKECMDGOALS)),)
 extract-gems: update-gems
-endif
+
+BUNDLED_GEMS := $(shell sed 's/[ 	][ 	]*/-/;s/[ 	].*//' $(srcdir)/gems/bundled_gems)
+
+update-gems: | $(patsubst %,gems/%.gem,$(BUNDLED_GEMS))
+
+gems/%.gem:
+	$(ECHO) Downloading bundled gem $*...
+	$(Q) $(BASERUBY) -C "$(srcdir)" \
+	    -I./tool -rdownloader \
+	    -e 'gem = "$(@F)"' \
+	    -e 'old = Dir.glob("gems/"+gem.sub(/-[^-]*$$/, "-*.gem"))' \
+	    -e 'Downloader::RubyGems.download(gem, "gems", nil) and' \
+	    -e '(old.delete("gems/#{gem}"); !old.empty?) and' \
+	    -e 'File.unlink(*old) and' \
+	    -e 'FileUtils.rm_rf(old.map{'"|n|"'n.chomp(".gem")})'
+
+extract-gems: | $(patsubst %,.bundle/gems/%,$(BUNDLED_GEMS))
+
+.bundle/gems/%: gems/%.gem | .bundle/gems
+	$(ECHO) Extracting bundle gem $*...
+	$(Q) $(RUNRUBY) -C "$(srcdir)" \
+	    -Itool -rgem-unpack \
+	    -e 'Gem.unpack("gems/$(@F).gem", ".bundle/gems")'
+
+$(srcdir)/.bundle/gems:
+	$(MAKEDIRS) $@
+
 ifneq ($(filter update-bundled_gems refresh-gems,$(MAKECMDGOALS)),)
 update-gems: update-bundled_gems
 endif
diff --git a/template/GNUmakefile.in b/template/GNUmakefile.in
index d0444d3..444e44b 100644
--- a/template/GNUmakefile.in
+++ b/template/GNUmakefile.in
@@ -1,3 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/template/GNUmakefile.in#L1
+gnumake = yes
+
 include Makefile
 
 ifeq ($(HAVE_BASERUBY),yes)
-- 
cgit v0.10.2


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

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