summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-03-30 23:28:49 +0900
committerGitHub <noreply@github.com>2021-03-30 23:28:49 +0900
commit5cdf99f64e344b8e4638824d55f5caf33be682ca (patch)
treecc1a89a5b2583d6b81f9426aefa284a970ebdc62
parent9713acd731309647b901825ee48af35984a9b4b8 (diff)
mkmf: fixed install directories of header files in extension libraries [Bug #17761]
When installing an extension library which provides a header, that header should be installed under site_ruby (or vendor_ruby when "--vendor" option was given to extconf.rb). However, currently this file is about to be installed in the core include directory.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4339 Merged-By: nobu <nobu@ruby-lang.org>
-rw-r--r--lib/mkmf.rb8
-rw-r--r--test/mkmf/test_install.rb30
2 files changed, 34 insertions, 4 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 1ae9925..01f2401 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -207,8 +207,8 @@ module MakeMakefile
['RUBYCOMMONDIR', '$(vendordir)$(target_prefix)'],
['RUBYLIBDIR', '$(vendorlibdir)$(target_prefix)'],
['RUBYARCHDIR', '$(vendorarchdir)$(target_prefix)'],
- ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+ ['HDRDIR', '$(vendorhdrdir)$(target_prefix)'],
+ ['ARCHHDRDIR', '$(vendorarchhdrdir)$(target_prefix)'],
]
else
dirs = [
@@ -216,8 +216,8 @@ module MakeMakefile
['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
['RUBYLIBDIR', '$(sitelibdir)$(target_prefix)'],
['RUBYARCHDIR', '$(sitearchdir)$(target_prefix)'],
- ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+ ['HDRDIR', '$(sitehdrdir)$(target_prefix)'],
+ ['ARCHHDRDIR', '$(sitearchhdrdir)$(target_prefix)'],
]
end
dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
diff --git a/test/mkmf/test_install.rb b/test/mkmf/test_install.rb
new file mode 100644
index 0000000..7f8c603
--- /dev/null
+++ b/test/mkmf/test_install.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: false
+require_relative 'base'
+
+class TestMkmf
+ class TestInstall < TestMkmf
+ def test_install_dirs
+ Dir.mktmpdir do |dir|
+ File.write(dir+"/extconf.rb", "require 'mkmf'; create_makefile('test')")
+ all_assertions do |a|
+ a.foreach(
+ ["site"],
+ ["vendor", "--vendor"],
+ ) do |dest, *options|
+ assert_ruby_status(["-C", dir, "extconf.rb", *options])
+ mf = File.read(dir+"/Makefile")
+ a.foreach(
+ ["RUBYCOMMONDIR", "$(#{dest}dir)$(target_prefix)"],
+ ["RUBYLIBDIR", "$(#{dest}libdir)$(target_prefix)"],
+ ["RUBYARCHDIR", "$(#{dest}archdir)$(target_prefix)"],
+ ["HDRDIR", "$(#{dest}hdrdir)$(target_prefix)"],
+ ["ARCHHDRDIR", "$(#{dest}archhdrdir)$(target_prefix)"],
+ ) do |(var, path)|
+ assert_equal path, mf[/^#{var}\s*=\s*(.*)$/, 1]
+ end
+ end
+ end
+ end
+ end
+ end
+end