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

ruby-changes:70409

From: Yuta <ko1@a...>
Date: Tue, 21 Dec 2021 15:15:09 +0900 (JST)
Subject: [ruby-changes:70409] 3c7e95966d (master): rbinstall.rb: install ext only when it's configured [Bug #18414]

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

From 3c7e95966d6b9efd201170eb59b0e4a3c4eb6134 Mon Sep 17 00:00:00 2001
From: Yuta Saito <kateinoigakukun@g...>
Date: Sat, 18 Dec 2021 14:59:39 +0000
Subject: rbinstall.rb: install ext only when it's configured [Bug #18414]

---
 common.mk         |  1 +
 tool/rbinstall.rb | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/common.mk b/common.mk
index a2fbac18aa2..14ef9cb4ec3 100644
--- a/common.mk
+++ b/common.mk
@@ -176,6 +176,7 @@ GOLFPRELUDES  = {$(srcdir)}golf_prelude.c https://github.com/ruby/ruby/blob/trunk/common.mk#L176
 
 SCRIPT_ARGS   =	--dest-dir="$(DESTDIR)" \
 		--extout="$(EXTOUT)" \
+		--ext-build-dir="./ext" \
 		--mflags="$(MFLAGS)" \
 		--make-flags="$(MAKEFLAGS)"
 EXTMK_ARGS    =	$(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) \
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 80d65bba13b..0b1195e3603 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -61,6 +61,7 @@ def parse_args(argv = ARGV) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L61
   opt.on('-n', '--dry-run') {$dryrun = true}
   opt.on('--dest-dir=DIR') {|dir| $destdir = dir}
   opt.on('--extout=DIR') {|dir| $extout = (dir unless dir.empty?)}
+  opt.on('--ext-build-dir=DIR') {|v| $ext_build_dir = v }
   opt.on('--make=COMMAND') {|make| $make = make}
   opt.on('--mantype=MAN') {|man| $mantype = man}
   opt.on('--make-flags=FLAGS', '--mflags', Shellwords) do |v|
@@ -151,6 +152,9 @@ def parse_args(argv = ARGV) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L152
 
   $dir_mode ||= $prog_mode | 0700
   $script_mode ||= $prog_mode
+  if $ext_build_dir.nil?
+    raise OptionParser::MissingArgument.new("--ext-build-dir=DIR")
+  end
 end
 
 $install_procs = Hash.new {[]}
@@ -729,6 +733,16 @@ module RbInstall https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L733
         (ruby_libraries + built_libraries).sort
       end
 
+      def skip_install?(files)
+        case type
+        when "ext"
+          # install ext only when it's configured
+          !File.exist?("#{$ext_build_dir}/#{relative_base}/Makefile")
+        when "lib"
+          files.empty?
+        end
+      end
+
       private
       def type
         /\/(ext|lib)?\/.*?\z/ =~ @base_dir
@@ -966,6 +980,9 @@ def install_default_gem(dir, srcdir, bindir) https://github.com/ruby/ruby/blob/trunk/tool/rbinstall.rb#L980
     spec = load_gemspec(src)
     file_collector = RbInstall::Specs::FileCollector.new(src)
     files = file_collector.collect
+    if file_collector.skip_install?(files)
+      next
+    end
     spec.files = files
     spec
   }
-- 
cgit v1.2.1


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

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