summaryrefslogtreecommitdiff
path: root/ext/etc/extconf.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-07-12 20:39:16 +0900
committergit <svn-admin@ruby-lang.org>2023-07-12 14:18:39 +0000
commit2fa77fb82d14deb8c2fa2064305c9a7f0ae63057 (patch)
treebab39ce555559d07fbb5f5025dcb17791e5b233f /ext/etc/extconf.rb
parentefd8ea366b31e7874c21a2e667ddeb69f2cddd7e (diff)
[ruby/etc] Fix for srcdir with spaces
Fixes https://github.com/ruby/etc/pull/22. Build failure when the ruby installed directory name contains spaces. https://github.com/ruby/etc/commit/1ab19d5815
Diffstat (limited to 'ext/etc/extconf.rb')
-rw-r--r--ext/etc/extconf.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 7c30b38bfd..1e8bd16d1d 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -43,9 +43,15 @@ have_struct_member('struct group', 'gr_passwd', 'grp.h')
# for https://github.com/ruby/etc
srcdir = File.expand_path("..", __FILE__)
-if !File.exist?("#{srcdir}/depend")
- %x[#{RbConfig.ruby} #{srcdir}/mkconstants.rb -o #{srcdir}/constdefs.h]
+constdefs = "#{srcdir}/constdefs.h"
+ruby = RbConfig.ruby
+if File.file?(ruby)
+ ruby = [ruby]
+else
+ require "shellwords"
+ ruby = Shellwords.split(ruby)
end
+system(*ruby, "#{srcdir}/mkconstants.rb", "-o", constdefs)
# TODO: remove when dropping 2.7 support, as exported since 3.0
have_func('rb_deprecate_constant(Qnil, "None")')